liquid_feedback_frontend
diff app/main/index/check_delegations.lua @ 988:81bde33c2256
Added support for regular delegation check, fixed css for pagination
author | bsw |
---|---|
date | Sat Apr 20 18:40:34 2013 +0200 (2013-04-20) |
parents | |
children | 14dfa591bc97 |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/app/main/index/check_delegations.lua Sat Apr 20 18:40:34 2013 +0200 1.3 @@ -0,0 +1,110 @@ 1.4 +local delegations = Delegation:delegations_to_check_for_member_id(app.session.member_id) 1.5 + 1.6 +ui.title(_"Current unit and area delegations need confirmation") 1.7 + 1.8 +ui.actions(function() 1.9 + if not app.session.needs_delegation_check then 1.10 + ui.link{ module = "index", view = "index", text = _"Cancel" } 1.11 + end 1.12 +end) 1.13 + 1.14 +util.help("index.check_delegations", _"Check delegations") 1.15 + 1.16 +ui.form{ 1.17 + module = "index", action = "check_delegations", 1.18 + routing = { 1.19 + default = { mode = "redirect", module = "index", view = "index" }, 1.20 + error = { mode = "redirect", module = "index", view = "check_delegations" } 1.21 + }, 1.22 + content = function() 1.23 + 1.24 + ui.tag{ tag = "table", attr = { class = "striped" }, content = function() 1.25 + 1.26 + ui.tag{ tag = "tr", content = function() 1.27 + 1.28 + ui.tag{ tag = "th", content = _"unit / area" } 1.29 + ui.tag{ tag = "th", content = _"delegated to" } 1.30 + ui.tag{ tag = "th", content = _"action" } 1.31 + 1.32 + end } 1.33 + 1.34 + for i, delegation in ipairs(delegations) do 1.35 + 1.36 + local unit = Unit:by_id(delegation.unit_id) 1.37 + local area = Area:by_id(delegation.area_id) 1.38 + local member = Member:by_id(delegation.trustee_id) 1.39 + local info 1.40 + if area then 1.41 + area:load_delegation_info_once_for_member_id(app.session.member_id) 1.42 + info = area.delegation_info 1.43 + else 1.44 + unit:load_delegation_info_once_for_member_id(app.session.member_id) 1.45 + info = unit.delegation_info 1.46 + end 1.47 + 1.48 + ui.tag{ tag = "tr", content = function () 1.49 + 1.50 + ui.tag { tag = "td", content = function() 1.51 + ui.tag{ tag = "span", attr = { class = "unit_link" }, content = delegation.unit_name } 1.52 + ui.tag{ tag = "span", attr = { class = "area_link" }, content = delegation.area_name } 1.53 + end } 1.54 + 1.55 + ui.tag { tag = "td", content = function() 1.56 + if (member) then 1.57 + local text = _"delegates to" 1.58 + ui.image{ 1.59 + attr = { class = "delegation_arrow", alt = text, title = text }, 1.60 + static = "delegation_arrow_24_horizontal.png" 1.61 + } 1.62 + execute.view{ module = "member_image", view = "_show", params = { 1.63 + member = member, class = "micro_avatar", popup_text = member.name, 1.64 + image_type = "avatar", show_dummy = true, 1.65 + } } 1.66 + slot.put(" ") 1.67 + ui.tag { tag = "span", content = delegation.member_name } 1.68 + else 1.69 + ui.tag{ tag = "span", content = _"Abandon unit delegation" } 1.70 + end 1.71 + end } 1.72 + 1.73 + ui.tag { tag = "td", content = function() 1.74 + local checked = config.check_delegations_default 1.75 + ui.tag{ tag = "input", attr = { 1.76 + type = "radio", 1.77 + id = "delegation_" .. delegation.id .. "_confirm", 1.78 + name = "delegation_" .. delegation.id, 1.79 + value = "confirm", 1.80 + checked = checked == "confirm" and "checked" or nil 1.81 + } } 1.82 + ui.tag{ 1.83 + tag = "label", 1.84 + attr = { ["for"] = "delegation_" .. delegation.id .. "_confirm" }, 1.85 + content = _"confirm" 1.86 + } 1.87 + ui.tag{ tag = "input", attr = { 1.88 + type = "radio", 1.89 + id = "delegation_" .. delegation.id .. "_revoke", 1.90 + name = "delegation_" .. delegation.id, 1.91 + value = "revoke", 1.92 + checked = checked == "revoke" and "checked" or nil 1.93 + } } 1.94 + ui.tag{ 1.95 + tag = "label", 1.96 + attr = { ["for"] = "delegation_" .. delegation.id .. "_revoke" }, 1.97 + content = _"revoke" 1.98 + } 1.99 + end} 1.100 + 1.101 + end } 1.102 + 1.103 + end 1.104 + 1.105 + end} 1.106 + 1.107 + 1.108 + slot.put("<br />") 1.109 + 1.110 + ui.submit{ text = "Finish delegation check" } 1.111 + 1.112 + end 1.113 +}