Skip to content

Commit

Permalink
save "all help" preference in session for both legacy and new mvc pag…
Browse files Browse the repository at this point in the history
…es, closes #1915

(cherry picked from commit 7e3906a)
  • Loading branch information
AdSchellevis authored and fichtner committed Nov 20, 2017
1 parent 9738d46 commit 57e2403
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/opnsense/www/js/opnsense_ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,14 +241,23 @@ function initFormHelpUI() {
$('[id*="show_all_help"]').toggleClass("fa-toggle-on fa-toggle-off");
$('[id*="show_all_help"]').toggleClass("text-success text-danger");
if ($('[id*="show_all_help"]').hasClass("fa-toggle-on")) {
sessionStorage.setItem('all_help_preset', 1);
$('[for*="help_for"]').addClass("show");
$('[for*="help_for"]').removeClass("hidden");
} else {
$('[for*="help_for"]').addClass("hidden");
$('[for*="help_for"]').removeClass("show");
sessionStorage.setItem('all_help_preset', 0);
}
event.preventDefault();
});
if (sessionStorage.getItem('all_help_preset') == 1) {
// show all help messages when preset was stored
$('[id*="show_all_help"]').toggleClass("fa-toggle-on fa-toggle-off");
$('[id*="show_all_help"]').toggleClass("text-success text-danger");
$('[for*="help_for"]').addClass("show");
$('[for*="help_for"]').removeClass("hidden");
}
}

/**
Expand Down
9 changes: 9 additions & 0 deletions src/www/head.inc
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,23 @@ $pagetitle .= html_safe(sprintf(' | %s.%s', $config['system']['hostname'], $conf
$('[id*="show_all_help"]').toggleClass("fa-toggle-on fa-toggle-off");
$('[id*="show_all_help"]').toggleClass("text-success text-danger");
if ($('[id*="show_all_help"]').hasClass("fa-toggle-on")) {
sessionStorage.setItem('all_help_preset', 1);
$('[for*="help_for"]').addClass("show");
$('[for*="help_for"]').removeClass("hidden");
} else {
sessionStorage.setItem('all_help_preset', 0);
$('[for*="help_for"]').addClass("hidden");
$('[for*="help_for"]').removeClass("show");
}
event.preventDefault();
});
if (sessionStorage.getItem('all_help_preset') == 1) {
// show all help messages when preset was stored
$('[id*="show_all_help"]').toggleClass("fa-toggle-on fa-toggle-off");
$('[id*="show_all_help"]').toggleClass("text-success text-danger");
$('[for*="help_for"]').addClass("show");
$('[for*="help_for"]').removeClass("hidden");
}

// hide submenu items
$('#mainmenu .list-group-item').click(function(){
Expand Down

0 comments on commit 57e2403

Please sign in to comment.