liquid_feedback_frontend
annotate app/main/admin/area_show.lua @ 145:90520c9fca44
implement area filter in timeline
allows the user to ignore any area in the timeline filter.
better display in javascript off
allows the user to ignore any area in the timeline filter.
better display in javascript off
| author | Daniel Poelzleithner <poelzi@poelzi.org> |
|---|---|
| date | Thu Oct 07 00:35:48 2010 +0200 (2010-10-07) |
| parents | 36aedac3e4bf |
| children | 46351752814f |
| rev | line source |
|---|---|
| bsw/jbe@0 | 1 local id = param.get_id() |
| bsw/jbe@0 | 2 |
| bsw/jbe@0 | 3 local area |
| bsw/jbe@0 | 4 if id then |
| bsw/jbe@0 | 5 area = Area:new_selector():add_where{ "id = ?", id }:single_object_mode():exec() |
| bsw/jbe@0 | 6 end |
| bsw/jbe@0 | 7 |
| bsw/jbe@0 | 8 slot.put_into("title", _"Create new area") |
| bsw/jbe@0 | 9 |
| bsw/jbe@0 | 10 ui.form{ |
| bsw/jbe@0 | 11 attr = { class = "vertical" }, |
| bsw/jbe@0 | 12 record = area, |
| bsw/jbe@5 | 13 module = "admin", |
| bsw/jbe@5 | 14 action = "area_update", |
| bsw/jbe@0 | 15 routing = { |
| bsw/jbe@0 | 16 default = { |
| bsw/jbe@0 | 17 mode = "redirect", |
| bsw/jbe@0 | 18 module = "admin", |
| bsw/jbe@0 | 19 view = "area_list" |
| bsw/jbe@0 | 20 } |
| bsw/jbe@0 | 21 }, |
| bsw/jbe@0 | 22 id = area and area.id or nil, |
| bsw/jbe@0 | 23 content = function() |
| poelzi@126 | 24 policies = Policy:new_selector():add_where{ "active='t'"}:exec() |
| poelzi@126 | 25 local def_policy = { |
| poelzi@126 | 26 { |
| poelzi@126 | 27 id = "-1", |
| poelzi@126 | 28 name = _"No default" |
| poelzi@126 | 29 } |
| poelzi@126 | 30 } |
| poelzi@126 | 31 for i, record in ipairs(policies) do |
| poelzi@126 | 32 def_policy[#def_policy+1] = record |
| poelzi@126 | 33 end |
| poelzi@126 | 34 |
| bsw/jbe@0 | 35 ui.field.text{ label = _"Name", name = "name" } |
| bsw/jbe@0 | 36 ui.field.boolean{ label = _"Active?", name = "active" } |
| bsw/jbe@0 | 37 ui.field.text{ label = _"Description", name = "description", multiline = true } |
| poelzi@126 | 38 ui.field.select{ label = _"Default Policy", name = "default_policy", |
| poelzi@126 | 39 value=area.default_policy and area.default_policy.id or "-1", |
| poelzi@126 | 40 foreign_records = def_policy, |
| poelzi@126 | 41 foreign_id = "id", |
| poelzi@126 | 42 foreign_name = "name" |
| poelzi@126 | 43 } |
| poelzi@119 | 44 ui.multiselect{ label = _"Policies", name = "allowed_policies[]", |
| poelzi@126 | 45 foreign_records = policies, |
| poelzi@119 | 46 foreign_id = "id", |
| poelzi@119 | 47 foreign_name = "name", |
| poelzi@119 | 48 connecting_records = area.allowed_policies, |
| poelzi@119 | 49 foreign_reference = "id" } |
| bsw/jbe@0 | 50 ui.submit{ text = _"Save" } |
| bsw/jbe@0 | 51 end |
| bsw/jbe@0 | 52 } |