liquid_feedback_frontend

view app/main/initiative/_head.lua @ 1123:9d901be8ea01

Added missing translation function call to initiative head view
author bsw
date Wed Dec 24 12:06:51 2014 +0100 (2014-12-24)
parents 701a5cf6b067
children c02aea493bc1
line source
1 local initiative = param.get("initiative", "table")
2 local member = param.get("member", "table") or app.session.member
4 -- TODO performance
5 local initiator
6 if member then
7 initiator = Initiator:by_pk(initiative.id, member.id)
8 end
10 local initiators_members_selector = initiative:get_reference_selector("initiating_members")
11 :add_field("initiator.accepted", "accepted")
12 :add_order_by("member.name")
13 if initiator and initiator.accepted then
14 initiators_members_selector:add_where("initiator.accepted ISNULL OR initiator.accepted")
15 else
16 initiators_members_selector:add_where("initiator.accepted")
17 end
19 local initiators = initiators_members_selector:exec()
22 ui.sectionHead( "initiativeInfo", function ()
24 ui.heading {
25 level = 1,
26 content = initiative.display_name
27 }
29 ui.container { attr = { class = "support" }, content = function ()
30 if initiative.supporter_count == nil then
31 ui.tag {
32 attr = { class = "supporterCount" },
33 content = _"[calculating]"
34 }
35 elseif initiative.issue.closed == nil then
36 ui.tag {
37 attr = { class = "satisfiedSupporterCount" },
38 content = _("#{count} supporter", { count = initiative.satisfied_supporter_count })
39 }
40 if initiative.potential_supporter_count and
41 initiative.potential_supporter_count > 0
42 then
43 slot.put ( " " )
44 ui.tag {
45 attr = { class = "potentialSupporterCount" },
46 content = _("(+ #{count} potential)", { count = initiative.potential_supporter_count })
47 }
48 end
50 end
52 slot.put ( "<br />" )
54 execute.view {
55 module = "initiative", view = "_bargraph", params = {
56 initiative = initiative
57 }
58 }
59 end }
61 if member then
62 ui.container { attr = { class = "mySupport right" }, content = function ()
63 if initiative.issue.fully_frozen then
64 if initiative.issue.member_info.direct_voted then
65 --ui.image { attr = { class = "icon48 right" }, static = "icons/48/voted_ok.png" }
66 ui.tag { content = _"You have voted" }
67 slot.put("<br />")
68 if not initiative.issue.closed then
69 ui.link {
70 module = "vote", view = "list",
71 params = { issue_id = initiative.issue.id },
72 text = _"change vote"
73 }
74 else
75 ui.link {
76 module = "vote", view = "list",
77 params = { issue_id = initiative.issue.id },
78 text = _"show vote"
79 }
80 end
81 slot.put(" ")
82 elseif active_trustee_id then
83 ui.tag { content = _"You have voted via delegation" }
84 ui.link {
85 content = _"Show voting ballot",
86 module = "vote", view = "list", params = {
87 issue_id = initiative.issue.id, member_id = active_trustee_id
88 }
89 }
90 elseif not initiative.issue.closed then
91 ui.link {
92 attr = { class = "btn btn-default" },
93 module = "vote", view = "list",
94 params = { issue_id = initiative.issue.id },
95 text = _"vote now"
96 }
97 end
98 elseif initiative.member_info.supported then
99 if initiative.member_info.satisfied then
100 ui.image { attr = { class = "icon48 right" }, static = "icons/32/support_satisfied.png" }
101 else
102 ui.image { attr = { class = "icon48 right" }, static = "icons/32/support_unsatisfied.png" }
103 end
104 ui.container { content = _"You are supporter" }
106 if initiative.issue.member_info.own_participation then
107 ui.link {
108 attr = { class = "btn-link" },
109 module = "initiative", action = "remove_support",
110 routing = { default = {
111 mode = "redirect", module = "initiative", view = "show", id = initiative.id
112 } },
113 id = initiative.id,
114 text = _"remove my support"
115 }
117 else
119 ui.link {
120 module = "delegation", view = "show", params = {
121 issue_id = initiative.issue_id,
122 initiative_id = initiative.id
123 },
124 content = _"via delegation"
125 }
127 end
129 slot.put(" ")
132 else
133 ui.link {
134 attr = { class = "btn btn-default" },
135 module = "initiative", action = "add_support",
136 routing = { default = {
137 mode = "redirect", module = "initiative", view = "show", id = initiative.id
138 } },
139 id = initiative.id,
140 text = _"add my support"
141 }
143 end
144 end }
146 end
148 slot.put("<br style='clear: both;'/>")
150 ui.container {
151 attr = { class = "initiators" },
152 content = function ()
154 if app.session:has_access("authors_pseudonymous") then
155 for i, member in ipairs(initiators) do
156 if i > 1 then
157 slot.put(" ")
158 end
159 util.micro_avatar(member)
160 if member.accepted == nil then
161 slot.put ( " " )
162 ui.tag { content = _"(invited)" }
163 end
164 end -- for i, member
166 end
168 end
169 } -- ui.container "initiators"
171 ui.container {
172 attr = { class = "links" },
173 content = function ()
175 local drafts_count = initiative:get_reference_selector("drafts"):count()
176 ui.link {
177 content = _("suggestions (#{count}) ↓", {
178 count = # ( initiative.suggestions )
179 }),
180 external = "#suggestions"
181 }
183 slot.put ( " | " )
185 ui.link{
186 module = "initiative", view = "history", id = initiative.id,
187 content = _("draft history (#{count})", { count = drafts_count })
188 }
190 end
191 } -- ui.containers "links"
192 end )
194 execute.view {
195 module = "initiative", view = "_sidebar_state",
196 params = { initiative = initiative }
197 }

Impressum / About Us