# HG changeset patch # User bsw # Date 1496742404 -7200 # Node ID a2ff42a662125a5c6b958f1c6a210382fe712308 # Parent a9fea293b2d6830174108d29b0eddc86eb88eba3 Added attr support for value container diff -r a9fea293b2d6 -r a2ff42a66212 framework/env/ui/container.lua --- a/framework/env/ui/container.lua Thu May 25 02:46:23 2017 +0200 +++ b/framework/env/ui/container.lua Tue Jun 06 11:46:44 2017 +0200 @@ -18,7 +18,7 @@ --]]-- function ui.container(args) - local attr, label, label_attr, legend, legend_attr, content + local attr, label, label_attr, legend, legend_attr, value_container_attr, content local auto_args = args.auto_args if auto_args then attr = auto_args.container_attr @@ -26,6 +26,7 @@ label_attr = auto_args.label_attr legend = auto_args.legend legend_attr = auto_args.legend_attr + value_container_attr = auto_args.value_container_attr if label and auto_args.attr and auto_args.attr.id then label_attr = table.new(label_attr) label_attr["for"] = auto_args.attr.id @@ -52,7 +53,14 @@ slot.put(" ") end if type(content) == "function" then - content() + if value_container_attr then + ui.container{ + attr = value_container_attr, + content = content + } + else + content() + end elseif content then slot.put(encode.html(content)) end @@ -82,7 +90,7 @@ end end } - elseif fieldset and label then + elseif legend and label then error("ui.container{...} may either get a label or a legend.") else return ui.tag{ tag = "div", attr = attr, content = content }