new preferences for network behaviour

This commit is contained in:
gabryon99 2020-12-23 10:12:50 +01:00
parent f45a16a5a0
commit 77442fb53f
5 changed files with 126 additions and 34 deletions

View file

@ -585,7 +585,7 @@ local function get_pref_redis_key(options)
end
function prefsToggleButton(subpage_active, params)
defaults = {
local defaults = {
to_switch = {}, -- a list of elements to be switched on or off
on_text = "On", -- The text when the button is on
on_value = "1", -- The value when the button is on
@ -600,6 +600,10 @@ function prefsToggleButton(subpage_active, params)
local options = table.merge(defaults, params)
local redis_key = get_pref_redis_key(options)
if (subpage_active.entries[options.field] ~= nil) then
traceError(TRACE_ERROR, TRACE_CONSOLE, "Missing entry '" .. options.field .. "' inside entries field")
end
return toggleTableButtonPrefs(params.title or subpage_active.entries[options.field].title,
(params.description or subpage_active.entries[options.field].description) .. (params.content or subpage_active.entries[options.field].content or ""),
options.on_text, options.on_value, options.on_class,