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@1649: bsw@1649: execute.view{ module = "issue", view = "_head", params = { issue = initiative.issue, link_issue = true } } bsw/jbe@0: bsw@1649: ui.grid{ content = function() bsw@1649: ui.cell_main{ content = function() bsw@1062: bsw@1649: ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function() bsw@1649: ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function() bsw@1649: ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = suggestion.name } bsw@1649: end } bsw@1062: bsw@1649: ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function() bsw@1649: if app.session:has_access("authors_pseudonymous") and suggestion.author then bsw@1649: util.micro_avatar(suggestion.author) bsw@1649: end bsw@1649: execute.view{ bsw@1649: module = "suggestion", view = "_collective_rating", params = { bsw@1649: suggestion = suggestion bsw@1649: } bsw@1062: } bsw@1649: end } bsw@1062: bsw@1649: ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function() bsw@1062: slot.put(suggestion:get_content("html")) bsw@1649: end } bsw@1062: bsw@1649: if app.session:has_access("all_pseudonymous") then bsw@1649: ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function() bsw@1649: execute.view{ bsw@1649: module = "opinion", bsw@1649: view = "_list", bsw@1649: params = { bsw@1649: opinions_selector = Opinion:new_selector() bsw@1649: :add_where{ "suggestion_id = ?", suggestion.id } bsw@1649: :join("member", nil, "member.id = opinion.member_id") bsw@1649: :add_order_by("member.id DESC") bsw@1649: } bsw@1649: } bsw@1649: end } bsw@1649: end bsw@1062: bsw@1649: end } bsw@1649: end } bsw@1649: end } bsw@1062: