mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-07 05:16:41 +00:00
added template.render function
This commit is contained in:
parent
fc3d065180
commit
30bf1e5589
2 changed files with 13 additions and 2 deletions
|
|
@ -43,4 +43,12 @@ function template.gen(template_file, context, is_full_path)
|
|||
return template.compile(path, nil, nil)(context)
|
||||
end
|
||||
|
||||
---Print the template inside the requested page
|
||||
---@param template_file string The template file to render
|
||||
---@param context table The data used by the page template
|
||||
---@param is_full_path boolean Is an absolute path?
|
||||
function template.render(template_file, context, is_full_path)
|
||||
print(template.gen(template_file, context, is_full_path))
|
||||
end
|
||||
|
||||
return template
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ local template_utils = require("template_utils")
|
|||
|
||||
local ui_utils = {}
|
||||
|
||||
|
||||
function ui_utils.render_configuration_footer(item)
|
||||
return template_utils.gen('pages/components/manage-configuration-link.template', {item = item})
|
||||
end
|
||||
|
|
@ -63,9 +62,13 @@ function ui_utils.render_pools_dropdown(pools_instance, member, key)
|
|||
end
|
||||
|
||||
function ui_utils.create_navbar_title(title, subpage, title_link)
|
||||
|
||||
if isEmptyString(subpage) then return title end
|
||||
return "<a href='".. title_link .."'>".. title .. "</a> / <span>"..subpage.."</span>"
|
||||
end
|
||||
|
||||
--- Shortcut function to print a togglw switch inside the requested page
|
||||
function ui_utils.print_toggle_switch(context)
|
||||
print(template_utils.gen("on_off_switch.html", context))
|
||||
end
|
||||
|
||||
return ui_utils
|
||||
Loading…
Add table
Add a link
Reference in a new issue