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@1062
|
26 execute.view{ module = "issue", view = "_sidebar_state", params = {
|
bsw@1062
|
27 initiative = initiative
|
bsw@1062
|
28 } }
|
bsw/jbe@0
|
29
|
bsw@1062
|
30 execute.view {
|
bsw@1062
|
31 module = "issue", view = "_sidebar_issue",
|
bsw@1062
|
32 params = {
|
bsw@1062
|
33 issue = initiative.issue,
|
bsw@1062
|
34 highlight_initiative_id = initiative.id
|
bsw/jbe@6
|
35 }
|
bsw@1062
|
36 }
|
bsw@1062
|
37
|
bsw@1062
|
38 execute.view {
|
bsw@1062
|
39 module = "issue", view = "_sidebar_whatcanido",
|
bsw@1062
|
40 params = { initiative = initiative }
|
bsw@1062
|
41 }
|
bsw/jbe@6
|
42
|
bsw@1062
|
43 execute.view {
|
bsw@1062
|
44 module = "issue", view = "_sidebar_members", params = {
|
bsw@1062
|
45 issue = initiative.issue, initiative = initiative
|
bsw@1062
|
46 }
|
bsw@1062
|
47 }
|
bsw@1062
|
48
|
bsw@1062
|
49
|
bsw@1062
|
50
|
bsw@1062
|
51 execute.view {
|
bsw@1062
|
52 module = "issue", view = "_head", params = {
|
bsw@1062
|
53 issue = initiative.issue
|
bsw/jbe@0
|
54 }
|
jorges@103
|
55 }
|
bsw@1062
|
56
|
bsw@1062
|
57
|
bsw@1062
|
58 ui.section( function()
|
bsw@1062
|
59 ui.sectionHead( function()
|
bsw@1062
|
60 ui.link{
|
bsw@1062
|
61 module = "initiative", view = "show", id = initiative.id,
|
bsw@1062
|
62 content = function ()
|
bsw@1062
|
63 ui.heading {
|
bsw@1062
|
64 level = 1,
|
bsw@1062
|
65 content = initiative.display_name
|
bsw@1062
|
66 }
|
bsw@1062
|
67 end
|
bsw@1062
|
68 }
|
bsw@1062
|
69 ui.heading { level = 2, content = _("Suggestion for improvement #{id}", { id = suggestion.id }) }
|
bsw@1062
|
70 end )
|
bsw@1062
|
71 ui.sectionRow( function()
|
bsw@1062
|
72
|
bsw@1062
|
73 ui.heading{ level = 2, content = suggestion.name }
|
bsw@1062
|
74 if app.session:has_access("authors_pseudonymous") and suggestion.author then
|
bsw@1062
|
75 util.micro_avatar(suggestion.author)
|
bsw@1062
|
76 end
|
bsw@1062
|
77 end )
|
bsw@1062
|
78 ui.sectionRow( function()
|
bsw@1062
|
79 ui.container{
|
bsw@1062
|
80 attr = { class = "suggestion_content wiki" },
|
bsw@1062
|
81 content = function()
|
bsw@1062
|
82 slot.put(suggestion:get_content("html"))
|
bsw@1062
|
83 end
|
bsw@1062
|
84 }
|
bsw@1062
|
85
|
bsw@1062
|
86 end )
|
bsw@1062
|
87 end )
|
bsw@1062
|
88
|
bsw@1062
|
89 ui.section( function()
|
bsw@1062
|
90 ui.sectionHead( function()
|
bsw@1062
|
91 ui.heading { level = 2, content = _"Collective rating" }
|
bsw@1062
|
92 end )
|
bsw@1062
|
93 ui.sectionRow( function()
|
bsw@1062
|
94
|
bsw@1062
|
95 execute.view{
|
bsw@1062
|
96 module = "suggestion",
|
bsw@1062
|
97 view = "_list_element",
|
bsw@1062
|
98 params = {
|
bsw@1062
|
99 suggestions_selector = Suggestion:new_selector():add_where{ "id = ?", suggestion.id },
|
bsw@1062
|
100 initiative = suggestion.initiative,
|
bsw@1062
|
101 show_name = false,
|
bsw@1062
|
102 show_filter = false
|
bsw@1062
|
103 }
|
bsw@1062
|
104 }
|
bsw@1062
|
105 end)
|
bsw@1062
|
106 end)
|
bsw@1062
|
107
|
bsw@1062
|
108 if app.session:has_access("all_pseudonymous") then
|
bsw@1062
|
109 ui.section( function()
|
bsw@1062
|
110 ui.sectionHead( function()
|
bsw@1062
|
111 ui.heading { level = 2, content = _"Individual ratings" }
|
bsw@1062
|
112 end )
|
bsw@1062
|
113 ui.sectionRow( function()
|
bsw@1062
|
114
|
bsw@1062
|
115 execute.view{
|
bsw@1062
|
116 module = "opinion",
|
bsw@1062
|
117 view = "_list",
|
bsw@1062
|
118 params = {
|
bsw@1062
|
119 opinions_selector = Opinion:new_selector()
|
bsw@1062
|
120 :add_where{ "suggestion_id = ?", suggestion.id }
|
bsw@1062
|
121 :join("member", nil, "member.id = opinion.member_id")
|
bsw@1062
|
122 :add_order_by("member.id DESC")
|
bsw@1062
|
123 }
|
bsw@1062
|
124 }
|
bsw@1062
|
125
|
bsw@1062
|
126 end)
|
bsw@1062
|
127 end)
|
bsw@1062
|
128 end |