mirror of
https://github.com/craigerl/aprsd.git
synced 2025-04-16 00:09:12 -04:00
webchat: set to_call to value of tab when selected
This patch will set the to_call form field to the callsign of the tab when the tab is activated in the UI. NOTE: still need to populate it when clicking on the already active tab.
This commit is contained in:
parent
b4e02c760e
commit
8a90d5480a
@ -172,7 +172,7 @@ function create_callsign_tab(callsign, active=false) {
|
||||
}
|
||||
|
||||
item_html = '<li class="nav-item" role="presentation">';
|
||||
item_html += '<button class="nav-link '+active_str+'" id="'+tab_id+'" data-bs-toggle="tab" data-bs-target="#'+tab_content+'" type="button" role="tab" aria-controls="'+callsign+'" aria-selected="true">';
|
||||
item_html += '<button callsign="'+callsign+'" class="nav-link '+active_str+'" id="'+tab_id+'" data-bs-toggle="tab" data-bs-target="#'+tab_content+'" type="button" role="tab" aria-controls="'+callsign+'" aria-selected="true">';
|
||||
item_html += callsign+' ';
|
||||
item_html += '<span onclick="delete_tab(\''+callsign+'\');">×</span>';
|
||||
item_html += '</button></li>'
|
||||
|
@ -49,6 +49,15 @@
|
||||
localStorage.clear();
|
||||
});
|
||||
});
|
||||
|
||||
// When a tab is clicked, populate the to_call form field.
|
||||
$(document).on('shown.bs.tab', 'button[data-bs-toggle="tab"]', function (e) {
|
||||
var tab = $(e.target);
|
||||
var callsign = tab.attr("callsign");
|
||||
var to_call = $('#to_call');
|
||||
console.log("Tab clicked on " + callsign);
|
||||
to_call.val(callsign);
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user