rev |
line source |
bsw/jbe@19
|
1 local initiative_id = param.get("initiative_id")
|
bsw/jbe@19
|
2
|
bsw@1479
|
3 ui.grid{ content = function()
|
bsw@1479
|
4
|
bsw@1479
|
5 ui.cell_main{ content = function()
|
bsw@1479
|
6 ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function()
|
bsw@1479
|
7 ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
|
bsw@1479
|
8 ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = _"Add a new suggestion for improvement" }
|
bsw@1479
|
9 end }
|
bsw@1479
|
10 ui.container{ attr = { class = "mdl-card__content" }, content = function()
|
bsw@1479
|
11 ui.form{
|
bsw@1479
|
12 module = "suggestion",
|
bsw@1479
|
13 action = "add",
|
bsw@1479
|
14 params = { initiative_id = initiative_id },
|
bsw@1479
|
15 routing = {
|
bsw@1479
|
16 default = {
|
bsw@1479
|
17 mode = "redirect",
|
bsw@1479
|
18 module = "initiative",
|
bsw@1479
|
19 view = "show",
|
bsw@1479
|
20 id = initiative_id,
|
bsw@1479
|
21 params = { tab = "suggestions" }
|
bsw@1479
|
22 }
|
bsw@1479
|
23 },
|
bsw@1479
|
24 attr = { class = "section vertical" },
|
bsw@279
|
25 content = function()
|
bsw@1479
|
26
|
bsw@1479
|
27 local supported = Supporter:by_pk(initiative_id, app.session.member.id) and true or false
|
bsw@1479
|
28 if not supported then
|
bsw@1479
|
29 ui.field.text{
|
bsw@1479
|
30 attr = { class = "warning" },
|
bsw@1479
|
31 value = _"You are currently not supporting this initiative directly. By adding suggestions to this initiative you will automatically become a potential supporter."
|
bsw@1479
|
32 }
|
bsw@1479
|
33 end
|
bsw@1479
|
34 ui.field.text{ label = _"A short title (80 chars max)", name = "name" }
|
bsw@1479
|
35
|
bsw@1479
|
36 if not config.enforce_formatting_engine then
|
bsw@1479
|
37 ui.field.select{
|
bsw@1479
|
38 label = _"Wiki engine",
|
bsw@1479
|
39 name = "formatting_engine",
|
bsw@1479
|
40 foreign_records = config.formatting_engines,
|
bsw@1479
|
41 attr = {id = "formatting_engine"},
|
bsw@1479
|
42 foreign_id = "id",
|
bsw@1479
|
43 foreign_name = "name",
|
bsw@1479
|
44 value = param.get("formatting_engine")
|
bsw@1479
|
45 }
|
bsw@1479
|
46 ui.tag{
|
bsw@1479
|
47 tag = "div",
|
bsw@1479
|
48 content = function()
|
bsw@1479
|
49 ui.tag{
|
bsw@1479
|
50 tag = "label",
|
bsw@1479
|
51 attr = { class = "ui_field_label" },
|
bsw@1479
|
52 content = function() slot.put(" ") end,
|
bsw@1479
|
53 }
|
bsw@1479
|
54 ui.tag{
|
bsw@1479
|
55 content = function()
|
bsw@1479
|
56 ui.link{
|
bsw@1479
|
57 text = _"Syntax help",
|
bsw@1479
|
58 module = "help",
|
bsw@1479
|
59 view = "show",
|
bsw@1479
|
60 id = "wikisyntax",
|
bsw@1479
|
61 attr = {onClick="this.href=this.href.replace(/wikisyntax[^.]*/g, 'wikisyntax_'+getElementById('formatting_engine').value)"}
|
bsw@1479
|
62 }
|
bsw@1479
|
63 slot.put(" ")
|
bsw@1479
|
64 ui.link{
|
bsw@1479
|
65 text = _"(new window)",
|
bsw@1479
|
66 module = "help",
|
bsw@1479
|
67 view = "show",
|
bsw@1479
|
68 id = "wikisyntax",
|
bsw@1479
|
69 attr = {target = "_blank", onClick="this.href=this.href.replace(/wikisyntax[^.]*/g, 'wikisyntax_'+getElementById('formatting_engine').value)"}
|
bsw@1479
|
70 }
|
bsw@1479
|
71 end
|
bsw@1479
|
72 }
|
bsw@1479
|
73 end
|
bsw@1479
|
74 }
|
bsw@1479
|
75 end
|
bsw@1479
|
76
|
bsw@1479
|
77 ui.field.text{
|
bsw@1479
|
78 label = _"Describe how the proposal and/or the reasons of the initiative could be improved",
|
bsw@1479
|
79 name = "content",
|
bsw@1479
|
80 multiline = true,
|
bsw@1479
|
81 attr = { style = "height: 50ex;" },
|
bsw@1479
|
82 value = param.get("content")
|
bsw@279
|
83 }
|
bsw@1479
|
84
|
bsw@1479
|
85 ui.field.select{
|
bsw@1479
|
86 label = _"How important is your suggestions for you?",
|
bsw@1479
|
87 name = "degree",
|
bsw@1479
|
88 foreign_records = {
|
bsw@1479
|
89 { id = 1, name = _"should be implemented"},
|
bsw@1479
|
90 { id = 2, name = _"must be implemented"},
|
bsw@1479
|
91 },
|
bsw@1479
|
92 foreign_id = "id",
|
bsw@1479
|
93 foreign_name = "name"
|
bsw@279
|
94 }
|
bsw@1479
|
95
|
bsw@1479
|
96 ui.submit{ text = _"publish suggestion" }
|
bsw@1479
|
97 slot.put(" ")
|
bsw@1479
|
98 ui.link{
|
bsw@1479
|
99 content = _"cancel",
|
bsw@1479
|
100 module = "initiative",
|
bsw@1479
|
101 view = "show",
|
bsw@1479
|
102 id = initiative_id,
|
bsw@1479
|
103 params = { tab = "suggestions" }
|
bsw@1479
|
104 }
|
bsw@1479
|
105
|
bsw@279
|
106 end
|
bsw@279
|
107 }
|
bsw@1479
|
108 end }
|
bsw@1479
|
109 end }
|
bsw@1479
|
110 end }
|
bsw@1479
|
111 end }
|