liquid_feedback_frontend
view app/main/suggestion/show.lua @ 1859:02c34183b6df
Fixed wrong filename in INSTALL file
| author | bsw | 
|---|---|
| date | Tue Nov 28 18:54:51 2023 +0100 (23 months ago) | 
| parents | 4188405c2425 | 
| children | 
 line source
     1 local suggestion = Suggestion:by_id(param.get_id())
     3 -- redirect to initiative if suggestion does not exist anymore
     4 if not suggestion then
     5   local initiative_id = param.get('initiative_id', atom.integer)
     6   if initiative_id then
     7     slot.reset_all{except={"notice", "error"}}
     8     request.redirect{
     9       module='initiative',
    10       view='show',
    11       id=initiative_id,
    12       params = { tab = "suggestions" }
    13     }
    14   else
    15     slot.put_into('error', _"Suggestion does not exist anymore")
    16   end
    17   return
    18 end
    20 local initiative = suggestion.initiative
    22 initiative:load_everything_for_member_id(app.session.member_id)
    23 initiative.issue:load_everything_for_member_id(app.session.member_id)
    27 execute.view{ module = "issue", view = "_head", params = { issue = initiative.issue, link_issue = true } }
    29 ui.grid{ content = function()
    30   ui.cell_main{ content = function()
    32     ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function()
    33       ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
    34         ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = suggestion.name }
    35       end }
    37       ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function()
    38         if app.session:has_access("authors_pseudonymous") and suggestion.author then 
    39           util.micro_avatar(suggestion.author)
    40         end
    41         execute.view{
    42           module = "suggestion", view = "_collective_rating", params = {
    43             suggestion = suggestion
    44           }
    45         }
    46       end }
    48       ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function()
    49         slot.put(suggestion:get_content("html"))
    50       end }
    52       if app.session:has_access("all_pseudonymous") then
    53         ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function()
    54           execute.view{
    55             module = "opinion",
    56             view = "_list",
    57             params = { 
    58               opinions_selector = Opinion:new_selector()
    59                 :add_where{ "suggestion_id = ?", suggestion.id }
    60                 :join("member", nil, "member.id = opinion.member_id")
    61                 :add_order_by("member.id DESC")
    62             }
    63           }
    64         end }
    65       end
    67     end }
    68   end }
    69 end }
