liquid_feedback_frontend
diff app/main/suggestion/_list_element.lua @ 1062:f03fbffc1800
New layout for suggestion details view
author | bsw |
---|---|
date | Wed Jul 16 21:52:17 2014 +0200 (2014-07-16) |
parents | cc64a4fc6ab6 |
children |
line diff
1.1 --- a/app/main/suggestion/_list_element.lua Wed Jul 16 21:51:08 2014 +0200 1.2 +++ b/app/main/suggestion/_list_element.lua Wed Jul 16 21:52:17 2014 +0200 1.3 @@ -77,140 +77,6 @@ 1.4 end 1.5 }, 1.6 { 1.7 - label = _"My opinion", 1.8 - label_attr = { style = "width: 130px; font-style: italic;" }, 1.9 - content = function(record) 1.10 - local degree 1.11 - local opinion 1.12 - if app.session.member_id then 1.13 - opinion = Opinion:by_pk(app.session.member.id, record.id) 1.14 - end 1.15 - if opinion then 1.16 - degree = opinion.degree 1.17 - end 1.18 - ui.container{ 1.19 - attr = { class = "suggestion_my_opinion" }, 1.20 - content = function() 1.21 - local has_voting_right = app.session.member and app.session.member:has_voting_right_for_unit_id(initiative.issue.area.unit_id) 1.22 - if app.session.member_id and has_voting_right then 1.23 - if initiative.issue.state == "voting" or initiative.issue.state == "closed" then 1.24 - if degree == -2 then 1.25 - ui.tag{ 1.26 - tag = "span", 1.27 - attr = { 1.28 - class = "action" .. (degree == -2 and " active_red2" or "") 1.29 - }, 1.30 - content = _"must not" 1.31 - } 1.32 - end 1.33 - if degree == -1 then 1.34 - ui.tag{ 1.35 - tag = "span", 1.36 - attr = { class = "action" .. (degree == -1 and " active_red1" or "") }, 1.37 - content = _"should not" 1.38 - } 1.39 - end 1.40 - if degree == nil then 1.41 - ui.tag{ 1.42 - tag = "span", 1.43 - attr = { class = "action" .. (degree == nil and " active" or "") }, 1.44 - content = _"neutral" 1.45 - } 1.46 - end 1.47 - if degree == 1 then 1.48 - ui.tag{ 1.49 - tag = "span", 1.50 - attr = { class = "action" .. (degree == 1 and " active_green1" or "") }, 1.51 - content = _"should" 1.52 - } 1.53 - end 1.54 - if degree == 2 then 1.55 - ui.tag{ 1.56 - tag = "span", 1.57 - attr = { class = "action" .. (degree == 2 and " active_green2" or "") }, 1.58 - content = _"must" 1.59 - } 1.60 - end 1.61 - else 1.62 - -- we need to put initiative_id into the parameters to have a redirect target in case the suggestion is gone after the action 1.63 - params = param.get_all_cgi() 1.64 - params['initiative_id'] = initiative.id 1.65 - 1.66 - ui.link{ 1.67 - attr = { class = "action" .. (degree == 2 and " active_green2" or "") }, 1.68 - text = _"must", 1.69 - module = "opinion", 1.70 - action = "update", 1.71 - routing = { default = { mode = "redirect", module = request.get_module(), view = request.get_view(), id = param.get_id_cgi(), params = params } }, 1.72 - params = { 1.73 - suggestion_id = record.id, 1.74 - degree = 2 1.75 - }, 1.76 - partial = partial 1.77 - } 1.78 - slot.put(" ") 1.79 - ui.link{ 1.80 - attr = { class = "action" .. (degree == 1 and " active_green1" or "") }, 1.81 - text = _"should", 1.82 - module = "opinion", 1.83 - action = "update", 1.84 - routing = { default = { mode = "redirect", module = request.get_module(), view = request.get_view(), id = param.get_id_cgi(), params = params} }, 1.85 - params = { 1.86 - suggestion_id = record.id, 1.87 - degree = 1 1.88 - }, 1.89 - partial = partial 1.90 - } 1.91 - slot.put(" ") 1.92 - ui.link{ 1.93 - attr = { class = "action" .. (degree == nil and " active" or "") }, 1.94 - text = _"neutral", 1.95 - module = "opinion", 1.96 - action = "update", 1.97 - routing = { default = { mode = "redirect", module = request.get_module(), view = request.get_view(), id = param.get_id_cgi(), params = params } }, 1.98 - params = { 1.99 - suggestion_id = record.id, 1.100 - delete = true 1.101 - }, 1.102 - partial = partial 1.103 - } 1.104 - slot.put(" ") 1.105 - ui.link{ 1.106 - attr = { class = "action" .. (degree == -1 and " active_red1" or "") }, 1.107 - text = _"should not", 1.108 - module = "opinion", 1.109 - action = "update", 1.110 - routing = { default = { mode = "redirect", module = request.get_module(), view = request.get_view(), id = param.get_id_cgi(), params = params } }, 1.111 - params = { 1.112 - suggestion_id = record.id, 1.113 - degree = -1 1.114 - }, 1.115 - partial = partial 1.116 - } 1.117 - slot.put(" ") 1.118 - ui.link{ 1.119 - attr = { class = "action" .. (degree == -2 and " active_red2" or "") }, 1.120 - text = _"must not", 1.121 - module = "opinion", 1.122 - action = "update", 1.123 - routing = { default = { mode = "redirect", module = request.get_module(), view = request.get_view(), id = param.get_id_cgi(), params = params } }, 1.124 - params = { 1.125 - suggestion_id = record.id, 1.126 - degree = -2 1.127 - }, 1.128 - partial = partial 1.129 - } 1.130 - end 1.131 - elseif app.session.member_id then 1.132 - ui.field.text{ value = _"[No voting privilege]" } 1.133 - else 1.134 - ui.field.text{ value = _"[Registered members only]" } 1.135 - end 1.136 - end 1.137 - } 1.138 - end 1.139 - }, 1.140 - { 1.141 label = _"Suggestion currently not implemented", 1.142 label_attr = { style = "width: 101px;" }, 1.143 content = function(record) 1.144 @@ -250,70 +116,6 @@ 1.145 end 1.146 end 1.147 }, 1.148 - { 1.149 - label = app.session.member_id and _"I consider suggestion as" or nil, 1.150 - label_attr = { style = "width: 100px; font-style: italic;" }, 1.151 - content = function(record) 1.152 - local degree 1.153 - local opinion 1.154 - if app.session.member_id then 1.155 - opinion = Opinion:by_pk(app.session.member.id, record.id) 1.156 - end 1.157 - if opinion then 1.158 - degree = opinion.degree 1.159 - end 1.160 - if opinion then 1.161 - 1.162 - ui.link{ 1.163 - attr = { class = opinion.fulfilled and "action active" or "action" }, 1.164 - text = _"implemented", 1.165 - module = "opinion", 1.166 - action = "update", 1.167 - routing = { default = { mode = "redirect", module = request.get_module(), view = request.get_view(), id = param.get_id_cgi(), params = param.get_all_cgi() } }, 1.168 - params = { 1.169 - suggestion_id = record.id, 1.170 - fulfilled = true 1.171 - }, 1.172 - partial = partial 1.173 - } 1.174 - slot.put("<br />") 1.175 - ui.link{ 1.176 - attr = { class = not opinion.fulfilled and "action active" or "action" }, 1.177 - text = _"not implemented", 1.178 - module = "opinion", 1.179 - action = "update", 1.180 - routing = { default = { mode = "redirect", module = request.get_module(), view = request.get_view(), id = param.get_id_cgi(), params = param.get_all_cgi() } }, 1.181 - params = { 1.182 - suggestion_id = record.id, 1.183 - fulfilled = false 1.184 - }, 1.185 - partial = partial 1.186 - } 1.187 - 1.188 - end 1.189 - end 1.190 - }, 1.191 - { 1.192 - label = app.session.member_id and _"So I'm" or nil, 1.193 - content = function(record) 1.194 - local opinion 1.195 - if app.session.member_id then 1.196 - opinion = Opinion:by_pk(app.session.member.id, record.id) 1.197 - end 1.198 - if opinion then 1.199 - if (opinion.fulfilled and opinion.degree > 0) or (not opinion.fulfilled and opinion.degree < 0) then 1.200 - local title = _"satisfied" 1.201 - ui.image{ attr = { alt = title, title = title }, static = "icons/emoticon_happy.png" } 1.202 - elseif opinion.degree == 1 or opinion.degree == -1 then 1.203 - local title = _"a bit unsatisfied" 1.204 - ui.image{ attr = { alt = title, title = title }, static = "icons/emoticon_unhappy.png" } 1.205 - else 1.206 - local title = _"more unsatisfied" 1.207 - ui.image{ attr = { alt = title, title = title }, static = "icons/emoticon_unhappy_red.png" } 1.208 - end 1.209 - end 1.210 - end 1.211 - }, 1.212 } 1.213 } 1.214 end