| 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             ui.field.text{
 | 
| 
bsw@1479
 | 
    37               label = _"Describe how the proposal and/or the reasons of the initiative could be improved",
 | 
| 
bsw@1479
 | 
    38               name = "content",
 | 
| 
bsw@1479
 | 
    39               multiline = true, 
 | 
| 
bsw@1479
 | 
    40               attr = { style = "height: 50ex;" },
 | 
| 
bsw@1479
 | 
    41               value = param.get("content")
 | 
| 
bsw@279
 | 
    42             }
 | 
| 
bsw@1479
 | 
    43 
 | 
| 
bsw@1479
 | 
    44             ui.field.select{
 | 
| 
bsw@1479
 | 
    45               label = _"How important is your suggestions for you?",
 | 
| 
bsw@1479
 | 
    46               name = "degree",
 | 
| 
bsw@1479
 | 
    47               foreign_records = {
 | 
| 
bsw@1479
 | 
    48                 { id =  1, name = _"should be implemented"},
 | 
| 
bsw@1479
 | 
    49                 { id =  2, name = _"must be implemented"},
 | 
| 
bsw@1479
 | 
    50               },
 | 
| 
bsw@1479
 | 
    51               foreign_id = "id",
 | 
| 
bsw@1479
 | 
    52               foreign_name = "name"
 | 
| 
bsw@279
 | 
    53             }
 | 
| 
bsw@1479
 | 
    54             
 | 
| 
bsw@1480
 | 
    55             ui.submit{ 
 | 
| 
bsw@1480
 | 
    56               attr = { class = "mdl-button mdl-js-button mdl-button--raised mdl-button--colored mdl-js-ripple-effect" },
 | 
| 
bsw@1480
 | 
    57               text = _"publish suggestion" 
 | 
| 
bsw@1480
 | 
    58             }
 | 
| 
bsw@1479
 | 
    59             slot.put(" ")
 | 
| 
bsw@1479
 | 
    60             ui.link{
 | 
| 
bsw@1480
 | 
    61               attr = { class = "mdl-button mdl-js-button" },
 | 
| 
bsw@1479
 | 
    62               content = _"cancel",
 | 
| 
bsw@1479
 | 
    63               module = "initiative",
 | 
| 
bsw@1479
 | 
    64               view = "show",
 | 
| 
bsw@1479
 | 
    65               id = initiative_id,
 | 
| 
bsw@1479
 | 
    66               params = { tab = "suggestions" }
 | 
| 
bsw@1479
 | 
    67             }
 | 
| 
bsw@1479
 | 
    68 
 | 
| 
bsw@279
 | 
    69           end
 | 
| 
bsw@279
 | 
    70         }
 | 
| 
bsw@1479
 | 
    71       end }
 | 
| 
bsw@1479
 | 
    72     end }
 | 
| 
bsw@1479
 | 
    73   end }
 | 
| 
bsw@1479
 | 
    74 end }
 |