diff options
author | Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> | 2013-09-27 11:35:27 +0300 |
---|---|---|
committer | Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> | 2013-10-04 13:48:15 +0300 |
commit | 4a9a64f191d32130d2e86eacfaf0cf9e1bdf4c64 (patch) | |
tree | d2e05eda0f2e75e590507cbbd0591add5c78e56d /acf/model/init.lua | |
parent | 021bf1538afb8c8a80ed3252f30f276653d06900 (diff) | |
download | aconf-4a9a64f191d32130d2e86eacfaf0cf9e1bdf4c64.tar.bz2 aconf-4a9a64f191d32130d2e86eacfaf0cf9e1bdf4c64.tar.xz |
web client: multi-checkbox widget for reference sets
Diffstat (limited to 'acf/model/init.lua')
-rw-r--r-- | acf/model/init.lua | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/acf/model/init.lua b/acf/model/init.lua index 78f5032..1de5202 100644 --- a/acf/model/init.lua +++ b/acf/model/init.lua @@ -47,6 +47,7 @@ M.node.Set = require('acf.model.set').Set local object = require('acf.object') local class = object.class +local isinstance = object.isinstance local super = object.super local pth = require('acf.path') @@ -97,7 +98,7 @@ function M.Reference:_validate(context, value) if value == nil then return end - if object.isinstance(value, node.TreeNode) then value = node.path(value) end + if isinstance(value, node.TreeNode) then value = node.path(value) end local path = context.path if type(value) ~= 'string' then raise(path, 'Path name must be string') end @@ -169,7 +170,12 @@ function M.List:init(params) super(self, M.List):init(params, node.List) end M.Set = class(M.Collection) -function M.Set:init(params) super(self, M.Set):init(params, M.node.Set) end +function M.Set:init(params) + if not params.widget and isinstance(params.type, M.Reference) then + params.widget = 'checkboxes' + end + super(self, M.Set):init(params, M.node.Set) +end function M.Set.save_member(tn, k, v) node.insert(tn, v) end |