rev |
line source |
bsw/jbe@19
|
1 local initiative_id = param.get("initiative_id")
|
bsw/jbe@19
|
2
|
bsw/jbe@19
|
3 slot.put_into("title", _"Add new suggestion")
|
bsw/jbe@19
|
4
|
bsw@951
|
5 ui.actions(function()
|
bsw/jbe@19
|
6 ui.link{
|
bsw/jbe@19
|
7 content = function()
|
bsw/jbe@19
|
8 ui.image{ static = "icons/16/cancel.png" }
|
bsw/jbe@19
|
9 slot.put(_"Cancel")
|
bsw/jbe@19
|
10 end,
|
bsw/jbe@19
|
11 module = "initiative",
|
bsw/jbe@19
|
12 view = "show",
|
bsw/jbe@19
|
13 id = initiative_id,
|
bsw/jbe@19
|
14 params = { tab = "suggestions" }
|
bsw/jbe@19
|
15 }
|
bsw/jbe@19
|
16 end)
|
bsw/jbe@19
|
17
|
bsw/jbe@19
|
18 ui.form{
|
bsw/jbe@19
|
19 module = "suggestion",
|
bsw/jbe@19
|
20 action = "add",
|
bsw/jbe@19
|
21 params = { initiative_id = initiative_id },
|
bsw/jbe@19
|
22 routing = {
|
bsw/jbe@19
|
23 default = {
|
bsw/jbe@19
|
24 mode = "redirect",
|
bsw/jbe@19
|
25 module = "initiative",
|
bsw/jbe@19
|
26 view = "show",
|
bsw/jbe@19
|
27 id = initiative_id,
|
bsw/jbe@19
|
28 params = { tab = "suggestions" }
|
bsw/jbe@19
|
29 }
|
bsw/jbe@19
|
30 },
|
bsw/jbe@19
|
31 attr = { class = "vertical" },
|
bsw/jbe@19
|
32 content = function()
|
bsw/jbe@19
|
33 local supported = Supporter:by_pk(initiative_id, app.session.member.id) and true or false
|
bsw/jbe@19
|
34 if not supported then
|
bsw/jbe@19
|
35 ui.field.text{
|
bsw/jbe@19
|
36 attr = { class = "warning" },
|
poelzi@135
|
37 value = _"You are currently not supporting this initiative directly. By adding suggestions to this initiative you will automatically become a potential supporter."
|
bsw/jbe@19
|
38 }
|
bsw/jbe@19
|
39 end
|
bsw/jbe@19
|
40 ui.field.select{
|
bsw/jbe@19
|
41 label = _"Degree",
|
bsw/jbe@19
|
42 name = "degree",
|
bsw/jbe@19
|
43 foreign_records = {
|
bsw/jbe@19
|
44 { id = 1, name = _"should"},
|
bsw/jbe@19
|
45 { id = 2, name = _"must"},
|
bsw/jbe@19
|
46 },
|
bsw/jbe@19
|
47 foreign_id = "id",
|
bsw/jbe@19
|
48 foreign_name = "name"
|
bsw/jbe@19
|
49 }
|
bsw@279
|
50 ui.field.text{ label = _"Title (80 chars max)", name = "name" }
|
bsw@279
|
51 ui.field.select{
|
bsw@279
|
52 label = _"Wiki engine",
|
bsw@279
|
53 name = "formatting_engine",
|
bsw@279
|
54 foreign_records = {
|
bsw@279
|
55 { id = "rocketwiki", name = "RocketWiki" },
|
bsw@279
|
56 { id = "compat", name = _"Traditional wiki syntax" }
|
bsw@279
|
57 },
|
bsw@279
|
58 attr = {id = "formatting_engine"},
|
bsw@279
|
59 foreign_id = "id",
|
bsw@279
|
60 foreign_name = "name",
|
bsw@279
|
61 value = param.get("formatting_engine")
|
bsw@279
|
62 }
|
bsw@279
|
63 ui.tag{
|
bsw@279
|
64 tag = "div",
|
bsw@279
|
65 content = function()
|
bsw@279
|
66 ui.tag{
|
bsw@279
|
67 tag = "label",
|
bsw@279
|
68 attr = { class = "ui_field_label" },
|
bsw@279
|
69 content = function() slot.put(" ") end,
|
bsw@279
|
70 }
|
bsw@279
|
71 ui.tag{
|
bsw@279
|
72 content = function()
|
bsw@279
|
73 ui.link{
|
bsw@279
|
74 text = _"Syntax help",
|
bsw@279
|
75 module = "help",
|
bsw@279
|
76 view = "show",
|
bsw@279
|
77 id = "wikisyntax",
|
bsw@279
|
78 attr = {onClick="this.href=this.href.replace(/wikisyntax[^.]*/g, 'wikisyntax_'+getElementById('formatting_engine').value)"}
|
bsw@279
|
79 }
|
bsw@279
|
80 slot.put(" ")
|
bsw@279
|
81 ui.link{
|
bsw@279
|
82 text = _"(new window)",
|
bsw@279
|
83 module = "help",
|
bsw@279
|
84 view = "show",
|
bsw@279
|
85 id = "wikisyntax",
|
bsw@279
|
86 attr = {target = "_blank", onClick="this.href=this.href.replace(/wikisyntax[^.]*/g, 'wikisyntax_'+getElementById('formatting_engine').value)"}
|
bsw@279
|
87 }
|
bsw@279
|
88 end
|
bsw@279
|
89 }
|
bsw@279
|
90 end
|
bsw@279
|
91 }
|
bsw@279
|
92 ui.field.text{
|
bsw@279
|
93 label = _"Description",
|
bsw@279
|
94 name = "content",
|
bsw@279
|
95 multiline = true,
|
bsw@279
|
96 attr = { style = "height: 50ex;" },
|
bsw@279
|
97 value = param.get("content")
|
bsw@279
|
98 }
|
bsw@279
|
99
|
bsw@279
|
100
|
bsw/jbe@19
|
101 ui.submit{ text = _"Commit suggestion" }
|
bsw/jbe@19
|
102 end
|
bsw/jbe@19
|
103 }
|