liquid_feedback_frontend

annotate app/main/delegation/_info.lua @ 703:eedb4b514b24

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

Impressum / About Us