rev |
line source |
bsw/jbe@0
|
1 local suggestion = Suggestion:by_id(param.get_id())
|
bsw/jbe@0
|
2
|
poelzi@142
|
3 -- redirect to initiative if suggestion does not exist anymore
|
poelzi@142
|
4 if not suggestion then
|
poelzi@142
|
5 local initiative_id = param.get('initiative_id', atom.integer)
|
poelzi@142
|
6 if initiative_id then
|
poelzi@142
|
7 slot.reset_all{except={"notice", "error"}}
|
poelzi@142
|
8 request.redirect{
|
poelzi@142
|
9 module='initiative',
|
poelzi@142
|
10 view='show',
|
poelzi@142
|
11 id=initiative_id,
|
poelzi@142
|
12 params = { tab = "suggestions" }
|
poelzi@142
|
13 }
|
poelzi@142
|
14 else
|
poelzi@142
|
15 slot.put_into('error', _"Suggestion does not exist anymore")
|
poelzi@142
|
16 end
|
poelzi@142
|
17 return
|
poelzi@142
|
18 end
|
poelzi@142
|
19
|
bsw@1062
|
20 local initiative = suggestion.initiative
|
poelzi@142
|
21
|
bsw@1062
|
22 initiative:load_everything_for_member_id(app.session.member_id)
|
bsw@1062
|
23 initiative.issue:load_everything_for_member_id(app.session.member_id)
|
bsw@1062
|
24
|
jorges@103
|
25
|
bsw@1649
|
26
|
bsw@1649
|
27 execute.view{ module = "issue", view = "_head", params = { issue = initiative.issue, link_issue = true } }
|
bsw/jbe@0
|
28
|
bsw@1649
|
29 ui.grid{ content = function()
|
bsw@1649
|
30 ui.cell_main{ content = function()
|
bsw@1062
|
31
|
bsw@1649
|
32 ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function()
|
bsw@1649
|
33 ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
|
bsw@1649
|
34 ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = suggestion.name }
|
bsw@1649
|
35 end }
|
bsw@1062
|
36
|
bsw@1649
|
37 ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function()
|
bsw@1649
|
38 if app.session:has_access("authors_pseudonymous") and suggestion.author then
|
bsw@1649
|
39 util.micro_avatar(suggestion.author)
|
bsw@1649
|
40 end
|
bsw@1649
|
41 execute.view{
|
bsw@1649
|
42 module = "suggestion", view = "_collective_rating", params = {
|
bsw@1649
|
43 suggestion = suggestion
|
bsw@1649
|
44 }
|
bsw@1062
|
45 }
|
bsw@1649
|
46 end }
|
bsw@1062
|
47
|
bsw@1649
|
48 ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function()
|
bsw@1062
|
49 slot.put(suggestion:get_content("html"))
|
bsw@1649
|
50 end }
|
bsw@1062
|
51
|
bsw@1649
|
52 if app.session:has_access("all_pseudonymous") then
|
bsw@1649
|
53 ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function()
|
bsw@1649
|
54 execute.view{
|
bsw@1649
|
55 module = "opinion",
|
bsw@1649
|
56 view = "_list",
|
bsw@1649
|
57 params = {
|
bsw@1649
|
58 opinions_selector = Opinion:new_selector()
|
bsw@1649
|
59 :add_where{ "suggestion_id = ?", suggestion.id }
|
bsw@1649
|
60 :join("member", nil, "member.id = opinion.member_id")
|
bsw@1649
|
61 :add_order_by("member.id DESC")
|
bsw@1649
|
62 }
|
bsw@1649
|
63 }
|
bsw@1649
|
64 end }
|
bsw@1649
|
65 end
|
bsw@1062
|
66
|
bsw@1649
|
67 end }
|
bsw@1649
|
68 end }
|
bsw@1649
|
69 end }
|
bsw@1062
|
70
|