liquid_feedback_frontend

view app/main/index/check_delegations.lua @ 990:77873f08d94f

Completed support for check delegations, removed debug code
author bsw
date Sat Apr 20 19:26:58 2013 +0200 (2013-04-20)
parents 81bde33c2256
children 14dfa591bc97
line source
1 local delegations = Delegation:delegations_to_check_for_member_id(app.session.member_id)
3 ui.title(_"Current unit and area delegations need confirmation")
5 ui.actions(function()
6 if not app.session.needs_delegation_check then
7 ui.link{ module = "index", view = "index", text = _"Cancel" }
8 end
9 end)
11 util.help("index.check_delegations", _"Check delegations")
13 ui.form{
14 module = "index", action = "check_delegations",
15 routing = {
16 default = { mode = "redirect", module = "index", view = "index" },
17 error = { mode = "redirect", module = "index", view = "check_delegations" }
18 },
19 content = function()
21 ui.tag{ tag = "table", attr = { class = "striped" }, content = function()
23 ui.tag{ tag = "tr", content = function()
25 ui.tag{ tag = "th", content = _"unit / area" }
26 ui.tag{ tag = "th", content = _"delegated to" }
27 ui.tag{ tag = "th", content = _"action" }
29 end }
31 for i, delegation in ipairs(delegations) do
33 local unit = Unit:by_id(delegation.unit_id)
34 local area = Area:by_id(delegation.area_id)
35 local member = Member:by_id(delegation.trustee_id)
36 local info
37 if area then
38 area:load_delegation_info_once_for_member_id(app.session.member_id)
39 info = area.delegation_info
40 else
41 unit:load_delegation_info_once_for_member_id(app.session.member_id)
42 info = unit.delegation_info
43 end
45 ui.tag{ tag = "tr", content = function ()
47 ui.tag { tag = "td", content = function()
48 ui.tag{ tag = "span", attr = { class = "unit_link" }, content = delegation.unit_name }
49 ui.tag{ tag = "span", attr = { class = "area_link" }, content = delegation.area_name }
50 end }
52 ui.tag { tag = "td", content = function()
53 if (member) then
54 local text = _"delegates to"
55 ui.image{
56 attr = { class = "delegation_arrow", alt = text, title = text },
57 static = "delegation_arrow_24_horizontal.png"
58 }
59 execute.view{ module = "member_image", view = "_show", params = {
60 member = member, class = "micro_avatar", popup_text = member.name,
61 image_type = "avatar", show_dummy = true,
62 } }
63 slot.put(" ")
64 ui.tag { tag = "span", content = delegation.member_name }
65 else
66 ui.tag{ tag = "span", content = _"Abandon unit delegation" }
67 end
68 end }
70 ui.tag { tag = "td", content = function()
71 local checked = config.check_delegations_default
72 ui.tag{ tag = "input", attr = {
73 type = "radio",
74 id = "delegation_" .. delegation.id .. "_confirm",
75 name = "delegation_" .. delegation.id,
76 value = "confirm",
77 checked = checked == "confirm" and "checked" or nil
78 } }
79 ui.tag{
80 tag = "label",
81 attr = { ["for"] = "delegation_" .. delegation.id .. "_confirm" },
82 content = _"confirm"
83 }
84 ui.tag{ tag = "input", attr = {
85 type = "radio",
86 id = "delegation_" .. delegation.id .. "_revoke",
87 name = "delegation_" .. delegation.id,
88 value = "revoke",
89 checked = checked == "revoke" and "checked" or nil
90 } }
91 ui.tag{
92 tag = "label",
93 attr = { ["for"] = "delegation_" .. delegation.id .. "_revoke" },
94 content = _"revoke"
95 }
96 end}
98 end }
100 end
102 end}
105 slot.put("<br />")
107 ui.submit{ text = "Finish delegation check" }
109 end
110 }

Impressum / About Us