bsw/jbe@0: local suggestion = Suggestion:by_id(param.get_id()) bsw/jbe@0: poelzi@142: -- redirect to initiative if suggestion does not exist anymore poelzi@142: if not suggestion then poelzi@142: local initiative_id = param.get('initiative_id', atom.integer) poelzi@142: if initiative_id then poelzi@142: slot.reset_all{except={"notice", "error"}} poelzi@142: request.redirect{ poelzi@142: module='initiative', poelzi@142: view='show', poelzi@142: id=initiative_id, poelzi@142: params = { tab = "suggestions" } poelzi@142: } poelzi@142: else poelzi@142: slot.put_into('error', _"Suggestion does not exist anymore") poelzi@142: end poelzi@142: return poelzi@142: end poelzi@142: bsw@1062: local initiative = suggestion.initiative poelzi@142: bsw@1062: initiative:load_everything_for_member_id(app.session.member_id) bsw@1062: initiative.issue:load_everything_for_member_id(app.session.member_id) bsw@1062: jorges@103: bsw@1062: execute.view{ module = "issue", view = "_sidebar_state", params = { bsw@1062: initiative = initiative bsw@1062: } } bsw/jbe@0: bsw@1062: execute.view { bsw@1062: module = "issue", view = "_sidebar_issue", bsw@1062: params = { bsw@1062: issue = initiative.issue, bsw@1062: highlight_initiative_id = initiative.id bsw/jbe@6: } bsw@1062: } bsw@1062: bsw@1062: execute.view { bsw@1062: module = "issue", view = "_sidebar_whatcanido", bsw@1062: params = { initiative = initiative } bsw@1062: } bsw/jbe@6: bsw@1062: execute.view { bsw@1062: module = "issue", view = "_sidebar_members", params = { bsw@1062: issue = initiative.issue, initiative = initiative bsw@1062: } bsw@1062: } bsw@1062: bsw@1062: bsw@1062: bsw@1062: execute.view { bsw@1062: module = "issue", view = "_head", params = { bsw@1062: issue = initiative.issue bsw/jbe@0: } jorges@103: } bsw@1062: bsw@1062: bsw@1062: ui.section( function() bsw@1062: ui.sectionHead( function() bsw@1062: ui.link{ bsw@1062: module = "initiative", view = "show", id = initiative.id, bsw@1062: content = function () bsw@1062: ui.heading { bsw@1062: level = 1, bsw@1062: content = initiative.display_name bsw@1062: } bsw@1062: end bsw@1062: } bsw@1062: ui.heading { level = 2, content = _("Suggestion for improvement #{id}", { id = suggestion.id }) } bsw@1062: end ) bsw@1062: ui.sectionRow( function() bsw@1062: bsw@1062: ui.heading{ level = 2, content = suggestion.name } bsw@1062: if app.session:has_access("authors_pseudonymous") and suggestion.author then bsw@1062: util.micro_avatar(suggestion.author) bsw@1062: end bsw@1062: end ) bsw@1062: ui.sectionRow( function() bsw@1062: ui.container{ bsw@1062: attr = { class = "suggestion_content wiki" }, bsw@1062: content = function() bsw@1062: slot.put(suggestion:get_content("html")) bsw@1062: end bsw@1062: } bsw@1062: bsw@1062: end ) bsw@1062: end ) bsw@1062: bsw@1062: ui.section( function() bsw@1062: ui.sectionHead( function() bsw@1062: ui.heading { level = 2, content = _"Collective rating" } bsw@1062: end ) bsw@1062: ui.sectionRow( function() bsw@1062: bsw@1062: execute.view{ bsw@1062: module = "suggestion", bsw@1062: view = "_list_element", bsw@1062: params = { bsw@1062: suggestions_selector = Suggestion:new_selector():add_where{ "id = ?", suggestion.id }, bsw@1062: initiative = suggestion.initiative, bsw@1062: show_name = false, bsw@1062: show_filter = false bsw@1062: } bsw@1062: } bsw@1062: end) bsw@1062: end) bsw@1062: bsw@1062: if app.session:has_access("all_pseudonymous") then bsw@1062: ui.section( function() bsw@1062: ui.sectionHead( function() bsw@1062: ui.heading { level = 2, content = _"Individual ratings" } bsw@1062: end ) bsw@1062: ui.sectionRow( function() bsw@1062: bsw@1062: execute.view{ bsw@1062: module = "opinion", bsw@1062: view = "_list", bsw@1062: params = { bsw@1062: opinions_selector = Opinion:new_selector() bsw@1062: :add_where{ "suggestion_id = ?", suggestion.id } bsw@1062: :join("member", nil, "member.id = opinion.member_id") bsw@1062: :add_order_by("member.id DESC") bsw@1062: } bsw@1062: } bsw@1062: bsw@1062: end) bsw@1062: end) bsw@1062: end