liquid_feedback_frontend

view app/main/initiative/_head.lua @ 1858:3d1f0464a3ea

Handle missing ldap.member.allowed function
author bsw
date Tue Sep 20 17:35:29 2022 +0200 (20 months ago)
parents c08690678b2d
children
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 ui.tag{ content = _"by" }
69 slot.put(" ")
70 for i, member in ipairs(initiators) do
71 if i > 1 then
72 slot.put(" ")
73 end
74 ui.link{ module = "member", view = "show", id = member.id, content = member.name }
75 end -- for i, member
76 end
78 if member then
79 ui.container { attr = { class = "mySupport float-right right" }, content = function ()
80 if initiative.issue.fully_frozen then
81 slot.put("<br />")
82 if initiative.issue.member_info.direct_voted then
83 ui.tag { content = _"You have voted" }
84 slot.put("<br />")
85 if not initiative.issue.closed then
86 ui.link {
87 module = "vote", view = "list",
88 params = { issue_id = initiative.issue.id },
89 text = _"change vote"
90 }
91 else
92 ui.link {
93 module = "vote", view = "list",
94 params = { issue_id = initiative.issue.id },
95 text = _"show vote"
96 }
97 end
98 slot.put(" ")
99 elseif active_trustee_id then
100 ui.tag { content = _"You have voted via delegation" }
101 ui.link {
102 content = _"Show voting ballot",
103 module = "vote", view = "list", params = {
104 issue_id = initiative.issue.id, member_id = active_trustee_id
105 }
106 }
107 elseif not initiative.issue.closed then
108 ui.link {
109 attr = { class = "btn btn-default" },
110 module = "vote", view = "list",
111 params = { issue_id = initiative.issue.id },
112 text = _"vote now"
113 }
114 end
115 elseif initiative.member_info.supported then
116 ui.container{ content = function()
117 ui.tag{ content = _"You are supporter" }
118 slot.put(" ")
119 if initiative.member_info.satisfied then
120 ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "thumb_up" }
121 else
122 ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "thumb_up" }
123 end
124 end }
125 if initiative.issue.member_info.own_participation then
126 ui.link {
127 attr = { class = "btn-link" },
128 module = "initiative", action = "remove_support",
129 routing = { default = {
130 mode = "redirect", module = "initiative", view = "show", id = initiative.id
131 } },
132 id = initiative.id,
133 text = _"remove my support"
134 }
136 else
138 ui.link {
139 module = "delegation", view = "show", params = {
140 issue_id = initiative.issue_id,
141 initiative_id = initiative.id
142 },
143 content = _"via delegation"
144 }
146 end
148 slot.put(" ")
150 end
151 end }
153 end
155 if config.initiative_abstract then
156 local abstract = string.match(initiative.current_draft.content, "(.+)<!%--END_OF_ABSTRACT%-->")
157 if abstract then
158 ui.container{
159 attr = { class = "abstract", style = "padding-right: 140px;" },
160 content = function() slot.put(abstract) end
161 }
162 end
163 end
165 ui.container { attr = { class = "support" }, content = function ()
167 if not config.voting_only then
168 execute.view {
169 module = "initiative", view = "_bargraph", params = {
170 initiative = initiative
171 }
172 }
173 slot.put(" ")
175 ui.supporter_count(initiative)
176 end
178 end }
180 end }
182 execute.view {
183 module = "initiative", view = "_sidebar_state",
184 params = { initiative = initiative }
185 }

Impressum / About Us