liquid_feedback_frontend

annotate app/main/delegation/_info.lua @ 547:57a261a81c5a

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

Impressum / About Us