liquid_feedback_frontend

annotate app/main/initiative/_head.lua @ 1859:02c34183b6df

Fixed wrong filename in INSTALL file
author bsw
date Tue Nov 28 18:54:51 2023 +0100 (6 months ago)
parents c08690678b2d
children
rev   line source
bsw@1045 1 local initiative = param.get("initiative", "table")
bsw@1045 2 local member = param.get("member", "table") or app.session.member
bsw@1045 3
bsw@1045 4 -- TODO performance
bsw@1045 5 local initiator
bsw@1045 6 if member then
bsw@1045 7 initiator = Initiator:by_pk(initiative.id, member.id)
bsw@1045 8 end
bsw@1045 9
bsw@1045 10 local initiators_members_selector = initiative:get_reference_selector("initiating_members")
bsw@1045 11 :add_field("initiator.accepted", "accepted")
bsw@1045 12 :add_order_by("member.name")
bsw@1045 13 if initiator and initiator.accepted then
bsw@1045 14 initiators_members_selector:add_where("initiator.accepted ISNULL OR initiator.accepted")
bsw@1045 15 else
bsw@1045 16 initiators_members_selector:add_where("initiator.accepted")
bsw@1045 17 end
bsw@1045 18
bsw@1045 19 local initiators = initiators_members_selector:exec()
bsw@1045 20
bsw@1045 21
bsw/jbe@1309 22 ui.container{ attr = { class = "mdl-card__title mdl-card--has-fab mdl-card--border" }, content = function ()
bsw/jbe@1309 23
bsw/jbe@1309 24 ui.heading {
bsw/jbe@1309 25 attr = { class = "mdl-card__title-text" },
bsw/jbe@1309 26 level = 2,
bsw/jbe@1309 27 content = function()
bsw/jbe@1309 28 ui.tag{ content = initiative.display_name }
bsw/jbe@1309 29 end
bsw/jbe@1309 30 }
bsw@1045 31
bsw/jbe@1309 32 if app.session.member and app.session.member:has_voting_right_for_unit_id(initiative.issue.area.unit_id) then
bsw/jbe@1309 33 if not initiative.issue.closed and not initiative.member_info.supported then
bsw/jbe@1309 34 if not initiative.issue.fully_frozen then
bsw/jbe@1309 35 ui.link {
bsw/jbe@1309 36 attr = { class = "mdl-button mdl-js-button mdl-button--fab mdl-button--colored" ,
bsw/jbe@1309 37 style = "position: absolute; right: 20px; bottom: -27px;"
bsw/jbe@1309 38 },
bsw/jbe@1309 39 module = "initiative", action = "add_support",
bsw/jbe@1309 40 routing = { default = {
bsw/jbe@1309 41 mode = "redirect", module = "initiative", view = "show", id = initiative.id
bsw/jbe@1309 42 } },
bsw/jbe@1309 43 id = initiative.id,
bsw/jbe@1309 44 content = function()
bsw/jbe@1309 45 ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "thumb_up" }
bsw/jbe@1309 46 end
bsw@1045 47 }
bsw/jbe@1309 48 end
bsw/jbe@1309 49 end
bsw/jbe@1309 50 if initiative.issue.fully_frozen and not initiative.issue.closed and not initiative.issue.member_info.direct_voted then
bsw/jbe@1309 51 ui.link {
bsw/jbe@1309 52 attr = { class = "mdl-button mdl-js-button mdl-button--fab mdl-button--colored" ,
bsw/jbe@1309 53 style = "position: absolute; right: 20px; bottom: -27px;"
bsw/jbe@1309 54 },
bsw/jbe@1309 55 module = "vote", view = "list",
bsw/jbe@1309 56 params = { issue_id = initiative.issue_id },
bsw/jbe@1309 57 content = function()
bsw/jbe@1309 58 ui.tag{ tag = "i", attr = { class = "material-icons" }, content = config.voting_icon or "mail_outline" }
bsw/jbe@1309 59 end
bsw/jbe@1309 60 }
bsw/jbe@1309 61 end
bsw/jbe@1309 62 end
bsw/jbe@1309 63 end }
bsw/jbe@1309 64
bsw/jbe@1309 65 ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function ()
bsw/jbe@1309 66
bsw/jbe@1309 67 if not config.voting_only and app.session:has_access("authors_pseudonymous") then
bsw@1658 68 ui.tag{ content = _"by" }
bsw@1658 69 slot.put(" ")
bsw/jbe@1309 70 for i, member in ipairs(initiators) do
bsw/jbe@1309 71 if i > 1 then
bsw/jbe@1309 72 slot.put(" ")
bsw/jbe@1309 73 end
bsw@1658 74 ui.link{ module = "member", view = "show", id = member.id, content = member.name }
bsw/jbe@1309 75 end -- for i, member
bsw/jbe@1309 76 end
bsw/jbe@1309 77
bsw/jbe@1309 78 if member then
bsw/jbe@1309 79 ui.container { attr = { class = "mySupport float-right right" }, content = function ()
bsw/jbe@1309 80 if initiative.issue.fully_frozen then
bsw/jbe@1309 81 slot.put("<br />")
bsw/jbe@1309 82 if initiative.issue.member_info.direct_voted then
bsw/jbe@1309 83 ui.tag { content = _"You have voted" }
bsw/jbe@1309 84 slot.put("<br />")
bsw/jbe@1309 85 if not initiative.issue.closed then
bsw/jbe@1309 86 ui.link {
bsw/jbe@1309 87 module = "vote", view = "list",
bsw/jbe@1309 88 params = { issue_id = initiative.issue.id },
bsw/jbe@1309 89 text = _"change vote"
bsw/jbe@1309 90 }
bsw/jbe@1309 91 else
bsw/jbe@1309 92 ui.link {
bsw/jbe@1309 93 module = "vote", view = "list",
bsw/jbe@1309 94 params = { issue_id = initiative.issue.id },
bsw/jbe@1309 95 text = _"show vote"
bsw/jbe@1309 96 }
bsw/jbe@1309 97 end
bsw/jbe@1309 98 slot.put(" ")
bsw/jbe@1309 99 elseif active_trustee_id then
bsw/jbe@1309 100 ui.tag { content = _"You have voted via delegation" }
bsw/jbe@1309 101 ui.link {
bsw/jbe@1309 102 content = _"Show voting ballot",
bsw/jbe@1309 103 module = "vote", view = "list", params = {
bsw/jbe@1309 104 issue_id = initiative.issue.id, member_id = active_trustee_id
bsw/jbe@1309 105 }
bsw/jbe@1309 106 }
bsw/jbe@1309 107 elseif not initiative.issue.closed then
bsw/jbe@1309 108 ui.link {
bsw/jbe@1309 109 attr = { class = "btn btn-default" },
bsw/jbe@1309 110 module = "vote", view = "list",
bsw/jbe@1309 111 params = { issue_id = initiative.issue.id },
bsw/jbe@1309 112 text = _"vote now"
bsw@1045 113 }
bsw@1045 114 end
bsw/jbe@1309 115 elseif initiative.member_info.supported then
bsw/jbe@1309 116 ui.container{ content = function()
bsw/jbe@1309 117 ui.tag{ content = _"You are supporter" }
bsw/jbe@1309 118 slot.put(" ")
bsw/jbe@1309 119 if initiative.member_info.satisfied then
bsw/jbe@1309 120 ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "thumb_up" }
bsw/jbe@1309 121 else
bsw/jbe@1309 122 ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "thumb_up" }
bsw/jbe@1309 123 end
bsw/jbe@1309 124 end }
bsw/jbe@1309 125 if initiative.issue.member_info.own_participation then
bsw/jbe@1309 126 ui.link {
bsw/jbe@1309 127 attr = { class = "btn-link" },
bsw/jbe@1309 128 module = "initiative", action = "remove_support",
bsw/jbe@1309 129 routing = { default = {
bsw/jbe@1309 130 mode = "redirect", module = "initiative", view = "show", id = initiative.id
bsw/jbe@1309 131 } },
bsw/jbe@1309 132 id = initiative.id,
bsw/jbe@1309 133 text = _"remove my support"
bsw/jbe@1309 134 }
bsw/jbe@1309 135
bsw/jbe@1309 136 else
bsw/jbe@1309 137
bsw/jbe@1309 138 ui.link {
bsw/jbe@1309 139 module = "delegation", view = "show", params = {
bsw/jbe@1309 140 issue_id = initiative.issue_id,
bsw/jbe@1309 141 initiative_id = initiative.id
bsw/jbe@1309 142 },
bsw/jbe@1309 143 content = _"via delegation"
bsw/jbe@1309 144 }
bsw/jbe@1309 145
bsw/jbe@1309 146 end
bsw/jbe@1309 147
bsw/jbe@1309 148 slot.put(" ")
bsw/jbe@1309 149
bsw/jbe@1309 150 end
bsw/jbe@1309 151 end }
bsw/jbe@1309 152
bsw/jbe@1309 153 end
bsw/jbe@1309 154
bsw/jbe@1309 155 if config.initiative_abstract then
bsw/jbe@1309 156 local abstract = string.match(initiative.current_draft.content, "(.+)<!%--END_OF_ABSTRACT%-->")
bsw/jbe@1309 157 if abstract then
bsw/jbe@1309 158 ui.container{
bsw/jbe@1309 159 attr = { class = "abstract", style = "padding-right: 140px;" },
bsw/jbe@1309 160 content = function() slot.put(abstract) end
bsw/jbe@1309 161 }
bsw/jbe@1309 162 end
bsw/jbe@1309 163 end
bsw/jbe@1309 164
bsw/jbe@1309 165 ui.container { attr = { class = "support" }, content = function ()
bsw/jbe@1309 166
bsw/jbe@1309 167 if not config.voting_only then
bsw@1045 168 execute.view {
bsw@1045 169 module = "initiative", view = "_bargraph", params = {
bsw@1045 170 initiative = initiative
bsw@1045 171 }
bsw@1045 172 }
bsw/jbe@1309 173 slot.put(" ")
bsw@1045 174
bsw/jbe@1309 175 ui.supporter_count(initiative)
bsw@1045 176 end
bsw@1045 177
bsw/jbe@1309 178 end }
bsw/jbe@1309 179
bsw/jbe@1309 180 end }
bsw@1045 181
bsw/jbe@1309 182 execute.view {
bsw/jbe@1309 183 module = "initiative", view = "_sidebar_state",
bsw/jbe@1309 184 params = { initiative = initiative }
bsw/jbe@1309 185 }
bsw@1045 186

Impressum / About Us