liquid_feedback_frontend

view app/main/index/check_delegations.lua @ 993:14dfa591bc97

Show different help text for forced delegation checking
author bsw
date Sat Apr 20 19:50:47 2013 +0200 (2013-04-20)
parents 81bde33c2256
children a1c5e8bc4cf6
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 if app.session.needs_delegation_check then
12 util.help("index.check_delegations_hard", _"Check delegations")
13 else
14 util.help("index.check_delegations", _"Check delegations")
15 end
17 ui.form{
18 module = "index", action = "check_delegations",
19 routing = {
20 default = { mode = "redirect", module = "index", view = "index" },
21 error = { mode = "redirect", module = "index", view = "check_delegations" }
22 },
23 content = function()
25 ui.tag{ tag = "table", attr = { class = "striped" }, content = function()
27 ui.tag{ tag = "tr", content = function()
29 ui.tag{ tag = "th", content = _"unit / area" }
30 ui.tag{ tag = "th", content = _"delegated to" }
31 ui.tag{ tag = "th", content = _"action" }
33 end }
35 for i, delegation in ipairs(delegations) do
37 local unit = Unit:by_id(delegation.unit_id)
38 local area = Area:by_id(delegation.area_id)
39 local member = Member:by_id(delegation.trustee_id)
40 local info
41 if area then
42 area:load_delegation_info_once_for_member_id(app.session.member_id)
43 info = area.delegation_info
44 else
45 unit:load_delegation_info_once_for_member_id(app.session.member_id)
46 info = unit.delegation_info
47 end
49 ui.tag{ tag = "tr", content = function ()
51 ui.tag { tag = "td", content = function()
52 ui.tag{ tag = "span", attr = { class = "unit_link" }, content = delegation.unit_name }
53 ui.tag{ tag = "span", attr = { class = "area_link" }, content = delegation.area_name }
54 end }
56 ui.tag { tag = "td", content = function()
57 if (member) then
58 local text = _"delegates to"
59 ui.image{
60 attr = { class = "delegation_arrow", alt = text, title = text },
61 static = "delegation_arrow_24_horizontal.png"
62 }
63 execute.view{ module = "member_image", view = "_show", params = {
64 member = member, class = "micro_avatar", popup_text = member.name,
65 image_type = "avatar", show_dummy = true,
66 } }
67 slot.put(" ")
68 ui.tag { tag = "span", content = delegation.member_name }
69 else
70 ui.tag{ tag = "span", content = _"Abandon unit delegation" }
71 end
72 end }
74 ui.tag { tag = "td", content = function()
75 local checked = config.check_delegations_default
76 ui.tag{ tag = "input", attr = {
77 type = "radio",
78 id = "delegation_" .. delegation.id .. "_confirm",
79 name = "delegation_" .. delegation.id,
80 value = "confirm",
81 checked = checked == "confirm" and "checked" or nil
82 } }
83 ui.tag{
84 tag = "label",
85 attr = { ["for"] = "delegation_" .. delegation.id .. "_confirm" },
86 content = _"confirm"
87 }
88 ui.tag{ tag = "input", attr = {
89 type = "radio",
90 id = "delegation_" .. delegation.id .. "_revoke",
91 name = "delegation_" .. delegation.id,
92 value = "revoke",
93 checked = checked == "revoke" and "checked" or nil
94 } }
95 ui.tag{
96 tag = "label",
97 attr = { ["for"] = "delegation_" .. delegation.id .. "_revoke" },
98 content = _"revoke"
99 }
100 end}
102 end }
104 end
106 end}
109 slot.put("<br />")
111 ui.submit{ text = "Finish delegation check" }
113 end
114 }

Impressum / About Us