liquid_feedback_frontend

view app/main/initiative/_head.lua @ 1430:5d891c23c8d7

Removed wrong condition
author bsw
date Fri Oct 05 21:58:05 2018 +0200 (2018-10-05)
parents 32cc544d5a5b
children c08690678b2d
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.container{ attr = { class = "mdl-card__title mdl-card--has-fab mdl-card--border" }, content = function ()
24 ui.heading {
25 attr = { class = "mdl-card__title-text" },
26 level = 2,
27 content = function()
28 ui.tag{ content = initiative.display_name }
29 end
30 }
32 if app.session.member and app.session.member:has_voting_right_for_unit_id(initiative.issue.area.unit_id) then
33 if not initiative.issue.closed and not initiative.member_info.supported then
34 if not initiative.issue.fully_frozen then
35 ui.link {
36 attr = { class = "mdl-button mdl-js-button mdl-button--fab mdl-button--colored" ,
37 style = "position: absolute; right: 20px; bottom: -27px;"
38 },
39 module = "initiative", action = "add_support",
40 routing = { default = {
41 mode = "redirect", module = "initiative", view = "show", id = initiative.id
42 } },
43 id = initiative.id,
44 content = function()
45 ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "thumb_up" }
46 end
47 }
48 end
49 end
50 if initiative.issue.fully_frozen and not initiative.issue.closed and not initiative.issue.member_info.direct_voted then
51 ui.link {
52 attr = { class = "mdl-button mdl-js-button mdl-button--fab mdl-button--colored" ,
53 style = "position: absolute; right: 20px; bottom: -27px;"
54 },
55 module = "vote", view = "list",
56 params = { issue_id = initiative.issue_id },
57 content = function()
58 ui.tag{ tag = "i", attr = { class = "material-icons" }, content = config.voting_icon or "mail_outline" }
59 end
60 }
61 end
62 end
63 end }
65 ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function ()
67 if not config.voting_only and app.session:has_access("authors_pseudonymous") then
68 for i, member in ipairs(initiators) do
69 if i > 1 then
70 slot.put(" ")
71 end
72 util.micro_avatar( member )
73 end -- for i, member
74 end
76 if member then
77 ui.container { attr = { class = "mySupport float-right right" }, content = function ()
78 if initiative.issue.fully_frozen then
79 slot.put("<br />")
80 if initiative.issue.member_info.direct_voted then
81 ui.tag { content = _"You have voted" }
82 slot.put("<br />")
83 if not initiative.issue.closed then
84 ui.link {
85 module = "vote", view = "list",
86 params = { issue_id = initiative.issue.id },
87 text = _"change vote"
88 }
89 else
90 ui.link {
91 module = "vote", view = "list",
92 params = { issue_id = initiative.issue.id },
93 text = _"show vote"
94 }
95 end
96 slot.put(" ")
97 elseif active_trustee_id then
98 ui.tag { content = _"You have voted via delegation" }
99 ui.link {
100 content = _"Show voting ballot",
101 module = "vote", view = "list", params = {
102 issue_id = initiative.issue.id, member_id = active_trustee_id
103 }
104 }
105 elseif not initiative.issue.closed then
106 ui.link {
107 attr = { class = "btn btn-default" },
108 module = "vote", view = "list",
109 params = { issue_id = initiative.issue.id },
110 text = _"vote now"
111 }
112 end
113 elseif initiative.member_info.supported then
114 ui.container{ content = function()
115 ui.tag{ content = _"You are supporter" }
116 slot.put(" ")
117 if initiative.member_info.satisfied then
118 ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "thumb_up" }
119 else
120 ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "thumb_up" }
121 end
122 end }
123 if initiative.issue.member_info.own_participation then
124 ui.link {
125 attr = { class = "btn-link" },
126 module = "initiative", action = "remove_support",
127 routing = { default = {
128 mode = "redirect", module = "initiative", view = "show", id = initiative.id
129 } },
130 id = initiative.id,
131 text = _"remove my support"
132 }
134 else
136 ui.link {
137 module = "delegation", view = "show", params = {
138 issue_id = initiative.issue_id,
139 initiative_id = initiative.id
140 },
141 content = _"via delegation"
142 }
144 end
146 slot.put(" ")
148 end
149 end }
151 end
153 if config.initiative_abstract then
154 local abstract = string.match(initiative.current_draft.content, "(.+)<!%--END_OF_ABSTRACT%-->")
155 if abstract then
156 ui.container{
157 attr = { class = "abstract", style = "padding-right: 140px;" },
158 content = function() slot.put(abstract) end
159 }
160 end
161 end
163 ui.container { attr = { class = "support" }, content = function ()
165 if not config.voting_only then
166 execute.view {
167 module = "initiative", view = "_bargraph", params = {
168 initiative = initiative
169 }
170 }
171 slot.put(" ")
173 ui.supporter_count(initiative)
174 end
176 end }
178 end }
180 execute.view {
181 module = "initiative", view = "_sidebar_state",
182 params = { initiative = initiative }
183 }

Impressum / About Us