liquid_feedback_frontend
view app/main/admin/area_show.lua @ 154:6b6c82f9ca9f
speedup member image loading when non set
we can add the location of the default file directy instead of going through another slow request
we can add the location of the default file directy instead of going through another slow request
author | Daniel Poelzleithner <poelzi@poelzi.org> |
---|---|
date | Fri Oct 08 15:25:10 2010 +0200 (2010-10-08) |
parents | 36aedac3e4bf |
children | 46351752814f |
line source
1 local id = param.get_id()
3 local area
4 if id then
5 area = Area:new_selector():add_where{ "id = ?", id }:single_object_mode():exec()
6 end
8 slot.put_into("title", _"Create new area")
10 ui.form{
11 attr = { class = "vertical" },
12 record = area,
13 module = "admin",
14 action = "area_update",
15 routing = {
16 default = {
17 mode = "redirect",
18 module = "admin",
19 view = "area_list"
20 }
21 },
22 id = area and area.id or nil,
23 content = function()
24 policies = Policy:new_selector():add_where{ "active='t'"}:exec()
25 local def_policy = {
26 {
27 id = "-1",
28 name = _"No default"
29 }
30 }
31 for i, record in ipairs(policies) do
32 def_policy[#def_policy+1] = record
33 end
35 ui.field.text{ label = _"Name", name = "name" }
36 ui.field.boolean{ label = _"Active?", name = "active" }
37 ui.field.text{ label = _"Description", name = "description", multiline = true }
38 ui.field.select{ label = _"Default Policy", name = "default_policy",
39 value=area.default_policy and area.default_policy.id or "-1",
40 foreign_records = def_policy,
41 foreign_id = "id",
42 foreign_name = "name"
43 }
44 ui.multiselect{ label = _"Policies", name = "allowed_policies[]",
45 foreign_records = policies,
46 foreign_id = "id",
47 foreign_name = "name",
48 connecting_records = area.allowed_policies,
49 foreign_reference = "id" }
50 ui.submit{ text = _"Save" }
51 end
52 }