Skip to content

Commit

Permalink
Adds comments
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Kastl <daniel@georepublic.de>
  • Loading branch information
dkastl committed May 31, 2024
1 parent 6b5851d commit f4cea75
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/views/settings/gtt/_settings.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
<%= render_tabs plugin_tabs %>
<%= javascript_tag do %>
// Read query parameter
function getQueryParam(param) {
var urlParams = new URLSearchParams(window.location.search);
return urlParams.get(param);
}

// Activate tab by name
function activateTab(tabName) {
var tabLinks = document.querySelectorAll('.tabs a');
tabLinks.forEach(function(link) {
Expand All @@ -21,12 +23,14 @@
});
}

// Activate tab if it is specified in the URL
document.addEventListener('DOMContentLoaded', function() {
var tab = getQueryParam('tab');
if (tab) {
activateTab(tab);
}
});

// Apply settings
window.gtt_setting()
<% end %>

0 comments on commit f4cea75

Please sign in to comment.