mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-06 03:45:26 +00:00
Added dark/white theme button for unprivileged users
This commit is contained in:
parent
1811f90867
commit
2149e76876
3 changed files with 15 additions and 5 deletions
|
|
@ -1146,13 +1146,22 @@ print([[
|
|||
end
|
||||
|
||||
-- Rende Toggle Dark theme menu button
|
||||
if is_admin then
|
||||
print([[
|
||||
|
||||
local theme_selector = ntop.getPref("ntopng.prefs.theme")
|
||||
if(theme_selector ~= 'dark') then
|
||||
print([[
|
||||
<li class='dropdown-divider'></li>
|
||||
<li>
|
||||
<a class='dropdown-item toggle-dark-theme' href='#'><i class="fas fa-adjust"></i> ]].. i18n("toggle_dark_theme") ..[[</a>
|
||||
</li>
|
||||
]])
|
||||
else
|
||||
print([[
|
||||
<li class='dropdown-divider'></li>
|
||||
<li>
|
||||
<a class='dropdown-item toggle-dark-theme' href='#'><i class="fas fa-adjust"></i> ]].. i18n("toggle_dark_theme") ..[[</a>
|
||||
<a class='dropdown-item toggle-dark-theme' href='#'><i class="fas fa-adjust"></i> ]].. i18n("toggle_white_theme") ..[[</a>
|
||||
</li>
|
||||
]])
|
||||
]])
|
||||
end
|
||||
|
||||
-- Logout
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ if isAdministrator() then
|
|||
-- does the user want to toggle theme?
|
||||
local enabled = toboolean(_POST['toggle_dark_theme'])
|
||||
-- set dark theme or the default one
|
||||
ntop.setPref("ntopng.prefs.theme", (enabled and "dark" or ""))
|
||||
ntop.setPref("ntopng.prefs.theme", (enabled and "dark" or "white"))
|
||||
end
|
||||
res.success = true
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue