webmcp

changeset 475:a2ff42a66212

Added attr support for value container
author bsw
date Tue Jun 06 11:46:44 2017 +0200 (16 months ago)
parents a9fea293b2d6
children 993fbee179ae
files framework/env/ui/container.lua
line diff
     1.1 --- a/framework/env/ui/container.lua	Thu May 25 02:46:23 2017 +0200
     1.2 +++ b/framework/env/ui/container.lua	Tue Jun 06 11:46:44 2017 +0200
     1.3 @@ -18,7 +18,7 @@
     1.4  --]]--
     1.5  
     1.6  function ui.container(args)
     1.7 -  local attr, label, label_attr, legend, legend_attr, content
     1.8 +  local attr, label, label_attr, legend, legend_attr, value_container_attr, content
     1.9    local auto_args = args.auto_args
    1.10    if auto_args then
    1.11      attr        = auto_args.container_attr
    1.12 @@ -26,6 +26,7 @@
    1.13      label_attr  = auto_args.label_attr
    1.14      legend      = auto_args.legend
    1.15      legend_attr = auto_args.legend_attr
    1.16 +    value_container_attr = auto_args.value_container_attr
    1.17      if label and auto_args.attr and auto_args.attr.id then
    1.18        label_attr = table.new(label_attr)
    1.19        label_attr["for"] = auto_args.attr.id
    1.20 @@ -52,7 +53,14 @@
    1.21            slot.put(" ")
    1.22          end
    1.23          if type(content) == "function" then
    1.24 -          content()
    1.25 +          if value_container_attr then
    1.26 +            ui.container{
    1.27 +              attr = value_container_attr,
    1.28 +              content = content
    1.29 +            }
    1.30 +          else
    1.31 +            content()
    1.32 +          end
    1.33          elseif content then
    1.34            slot.put(encode.html(content))
    1.35          end
    1.36 @@ -82,7 +90,7 @@
    1.37          end
    1.38        end
    1.39      }
    1.40 -  elseif fieldset and label then
    1.41 +  elseif legend and label then
    1.42      error("ui.container{...} may either get a label or a legend.")
    1.43    else
    1.44      return ui.tag{ tag = "div", attr = attr, content = content }

Impressum / About Us