liquid_feedback_frontend

annotate app/main/delegation/_info.lua @ 526:18cd8595459b

Fixes for public access
author bsw
date Fri May 18 19:21:45 2012 +0200 (2012-05-18)
parents 63d6549cc00b
children 5ca9de94cb13
rev   line source
bsw@526 1 if not app.session.member_id then
bsw@526 2 return
bsw@526 3 end
bsw@526 4
bsw@525 5 local unit = param.get("unit", "table")
bsw@525 6 local area = param.get("area", "table")
bsw@525 7 local issue = param.get("issue", "table")
bsw@525 8
bsw@525 9 local unit_id = unit and unit.id or nil
bsw@525 10 local area_id = area and area.id or nil
bsw@525 11 local issue_id = issue and issue.id or nil
bsw@525 12
bsw@525 13 local info
bsw@525 14 local delegation_text
bsw@525 15
bsw@525 16 if unit then
bsw@525 17 unit:load_delegation_info_once_for_member_id(app.session.member_id)
bsw@525 18 info = unit.delegation_info
bsw@525 19 delegation_text = _"Delegate unit"
bsw@525 20 end
bsw@525 21
bsw@525 22 if area then
bsw@525 23 area:load_delegation_info_once_for_member_id(app.session.member_id)
bsw@525 24 info = area.delegation_info
bsw@525 25 delegation_text = _"Delegate area"
bsw@525 26 end
bsw@525 27
bsw@525 28 if issue then
bsw@525 29 issue:load_delegation_info_once_for_member_id(app.session.member_id)
bsw@525 30 info = issue.delegation_info
bsw@525 31 delegation_text = _"Delegate issue"
bsw@525 32 end
bsw@525 33
bsw@525 34 ui.link{
bsw@525 35 module = "delegation", view = "show", params = {
bsw@525 36 unit_id = unit_id,
bsw@525 37 area_id = area_id,
bsw@525 38 issue_id = issue_id
bsw@525 39 },
bsw@525 40 attr = { class = "delegation_info" }, content = function()
bsw@525 41
bsw@525 42
bsw@525 43 local participant_occured = false
bsw@525 44
bsw@525 45 if info.own_participation or info.first_trustee_id then
bsw@525 46
bsw@525 47 local class = "micro_avatar"
bsw@525 48 if info.own_participation then
bsw@525 49 participant_occured = true
bsw@525 50 class = class .. " highlighted"
bsw@525 51 end
bsw@525 52
bsw@525 53 execute.view{ module = "member_image", view = "_show", params = {
bsw@525 54 member = app.session.member, class = class, popup_text = app.session.member.name,
bsw@525 55 image_type = "avatar", show_dummy = true,
bsw@525 56 } }
bsw@525 57
bsw@525 58 end
bsw@525 59
bsw@525 60 if not info.first_trustee_id and (not issue or not issue.closed) then
bsw@525 61 slot.put(" ")
bsw@525 62 ui.tag{ attr = { class = "link" }, content = delegation_text }
bsw@525 63 end
bsw@525 64
bsw@525 65 if not (issue and issue.state == "voting" and info.own_participation) then
bsw@525 66
bsw@525 67 if info.first_trustee_id then
bsw@525 68
bsw@525 69 local text = _"delegates to"
bsw@525 70 ui.image{
bsw@525 71 attr = { class = "delegation_arrow", alt = text, title = text },
bsw@525 72 static = "delegation_arrow_24_horizontal.png"
bsw@525 73 }
bsw@525 74
bsw@525 75 local class = "micro_avatar"
bsw@525 76 if not participant_occured and info.first_trustee_participation then
bsw@525 77 participant_occured = true
bsw@525 78 class = class .. " highlighted"
bsw@525 79 end
bsw@525 80
bsw@525 81 execute.view{ module = "member_image", view = "_show", params = {
bsw@525 82 member_id = info.first_trustee_id, class = class, popup_text = info.first_trustee_name,
bsw@525 83 image_type = "avatar", show_dummy = true,
bsw@525 84 } }
bsw@525 85
bsw@525 86 end
bsw@525 87
bsw@525 88 if info.first_trustee_ellipsis then
bsw@525 89
bsw@525 90 local text = _"delegates to"
bsw@525 91 ui.image{
bsw@525 92 attr = { class = "delegation_arrow", alt = text, title = text },
bsw@525 93 static = "delegation_arrow_24_horizontal.png"
bsw@525 94 }
bsw@525 95
bsw@525 96 slot.put("...")
bsw@525 97
bsw@525 98 end
bsw@525 99
bsw@525 100 if info.other_trustee_id then
bsw@525 101
bsw@525 102 local text = _"delegates to"
bsw@525 103 ui.image{
bsw@525 104 attr = { class = "delegation_arrow", alt = text, title = text },
bsw@525 105 static = "delegation_arrow_24_horizontal.png"
bsw@525 106 }
bsw@525 107
bsw@525 108 local class = "micro_avatar"
bsw@525 109 if not participant_occured and info.other_trustee_participation then
bsw@525 110 participant_occured = true
bsw@525 111 class = class .. " highlighted"
bsw@525 112 end
bsw@525 113
bsw@525 114 execute.view{ module = "member_image", view = "_show", params = {
bsw@525 115 member_id = info.other_trustee_id, class = class, popup_text = info.other_trustee_name,
bsw@525 116 image_type = "avatar", show_dummy = true,
bsw@525 117 } }
bsw@525 118
bsw@525 119 end
bsw@525 120
bsw@525 121 if info.other_trustee_ellipsis then
bsw@525 122
bsw@525 123 local text = _"delegates to"
bsw@525 124 ui.image{
bsw@525 125 attr = { class = "delegation_arrow", alt = text, title = text },
bsw@525 126 static = "delegation_arrow_24_horizontal.png"
bsw@525 127 }
bsw@525 128
bsw@525 129 slot.put("...")
bsw@525 130
bsw@525 131 end
bsw@525 132
bsw@525 133 local trailing_ellipsis = info.other_trustee_ellipsis or
bsw@525 134 (info.first_trustee_ellipsis and not info.other_trustee_id)
bsw@525 135
bsw@525 136 if info.delegation_loop == "own" then
bsw@525 137
bsw@525 138 local text = _"delegates to"
bsw@525 139 ui.image{
bsw@525 140 attr = { class = "delegation_arrow", alt = text, title = text },
bsw@525 141 static = "delegation_arrow_24_horizontal.png"
bsw@525 142 }
bsw@525 143
bsw@525 144 execute.view{ module = "member_image", view = "_show", params = {
bsw@525 145 member = app.session.member, class = "micro_avatar", popup_text = app.session.member.name,
bsw@525 146 image_type = "avatar", show_dummy = true,
bsw@525 147 } }
bsw@525 148
bsw@525 149 elseif info.delegation_loop == "first" then
bsw@525 150 if info.first_trustee_ellipsis then
bsw@525 151 if not trailing_ellipsis then
bsw@525 152
bsw@525 153 local text = _"delegates to"
bsw@525 154 ui.image{
bsw@525 155 attr = { class = "delegation_arrow", alt = text, title = text },
bsw@525 156 static = "delegation_arrow_24_horizontal.png"
bsw@525 157 }
bsw@525 158
bsw@525 159 slot.put("...")
bsw@525 160 end
bsw@525 161
bsw@525 162 else
bsw@525 163
bsw@525 164 local text = _"delegates to"
bsw@525 165 ui.image{
bsw@525 166 attr = { class = "delegation_arrow", alt = text, title = text },
bsw@525 167 static = "delegation_arrow_24_horizontal.png"
bsw@525 168 }
bsw@525 169
bsw@525 170 execute.view{ module = "member_image", view = "_show", params = {
bsw@525 171 member_id = info.first_trustee_id, class = "micro_avatar", popup_text = info.first_trustee_name,
bsw@525 172 image_type = "avatar", show_dummy = true,
bsw@525 173 } }
bsw@525 174 end
bsw@525 175
bsw@525 176
bsw@525 177 elseif info.delegation_loop and not trailing_ellipsis then
bsw@525 178 local text = _"delegates to"
bsw@525 179 ui.image{
bsw@525 180 attr = { class = "delegation_arrow", alt = text, title = text },
bsw@525 181 static = "delegation_arrow_24_horizontal.png"
bsw@525 182 }
bsw@525 183
bsw@525 184 slot.put("...")
bsw@525 185 end
bsw@525 186
bsw@525 187 end
bsw@525 188
bsw@525 189 end
bsw@525 190
bsw@525 191 }
bsw@525 192

Impressum / About Us