added new rtt gui page

This commit is contained in:
gabryon99 2020-03-17 22:48:41 +01:00
parent 7296331121
commit 5b1f7eb32c
4 changed files with 404 additions and 17 deletions

View file

@ -3416,6 +3416,30 @@ function generate_switch_toggle(id, label, disabled)
]])
end
-- ##############################################
--- Return an HTML `select` element with passed options.
--
function generate_select(id, name, is_required, is_disabled, options)
local required_flag = (is_required and "required" or "")
local disabled_flag = (is_disabled and "disabled" or "")
local name_attr = (name == "" and "name='" .. name .. "'" or "")
local parsed_options = ""
for i, option in ipairs(options) do
parsed_options = parsed_options .. ([[
<option value="]].. option.value ..[[">]].. option.title ..[[</option>
]])
end
return ([[
<select id="]].. id ..[[" class="form-control" ]].. name_attr ..[[ ]].. required_flag ..[[ ]] .. disabled_flag ..[[>
]].. parsed_options ..[[
</select>
]])
end
-- ###########################################
function getHttpUrlPrefix()