| 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@1838
 | 
    22             },
 | 
| 
bsw@1838
 | 
    23             error = {
 | 
| 
bsw@1838
 | 
    24               mode = "forward",
 | 
| 
bsw@1838
 | 
    25               module = "suggestion",
 | 
| 
bsw@1838
 | 
    26               view = "new",
 | 
| 
bsw@1838
 | 
    27               params = { initiative_id = initiative_id }
 | 
| 
bsw@1479
 | 
    28             }
 | 
| 
bsw@1479
 | 
    29           },
 | 
| 
bsw@1479
 | 
    30           attr = { class = "section vertical" },
 | 
| 
bsw@279
 | 
    31           content = function()
 | 
| 
bsw@1479
 | 
    32           
 | 
| 
bsw@1479
 | 
    33             local supported = Supporter:by_pk(initiative_id, app.session.member.id) and true or false
 | 
| 
bsw@1479
 | 
    34             if not supported then
 | 
| 
bsw@1479
 | 
    35               ui.field.text{
 | 
| 
bsw@1479
 | 
    36                 attr = { class = "warning" },
 | 
| 
bsw@1479
 | 
    37                 value = _"You are currently not supporting this initiative directly. By adding suggestions to this initiative you will automatically become a potential supporter."
 | 
| 
bsw@1479
 | 
    38               }
 | 
| 
bsw@1479
 | 
    39             end
 | 
| 
bsw@1838
 | 
    40 
 | 
| 
bsw@1838
 | 
    41             ui.container{ attr = { class = "mdl-textfield mdl-js-textfield mdl-textfield--floating-label mdl-card__fullwidth" }, content = function ()
 | 
| 
bsw@1838
 | 
    42               ui.field.text{
 | 
| 
bsw@1838
 | 
    43                 attr = { id = "lf-initiative__name", class = "mdl-textfield__input" },
 | 
| 
bsw@1838
 | 
    44                 label_attr = { class = "mdl-textfield__label", ["for"] = "lf-initiative__name" },
 | 
| 
bsw@1838
 | 
    45                 label = _"A short title (80 chars max)",
 | 
| 
bsw@1838
 | 
    46                 name  = "name"
 | 
| 
bsw@1838
 | 
    47               }
 | 
| 
bsw@1838
 | 
    48             end }
 | 
| 
bsw@1838
 | 
    49 
 | 
| 
bsw@1479
 | 
    50             ui.field.text{
 | 
| 
bsw@1479
 | 
    51               label = _"Describe how the proposal and/or the reasons of the initiative could be improved",
 | 
| 
bsw@1479
 | 
    52               name = "content",
 | 
| 
bsw@1479
 | 
    53               multiline = true, 
 | 
| 
bsw@1479
 | 
    54               attr = { style = "height: 50ex;" },
 | 
| 
bsw@1479
 | 
    55               value = param.get("content")
 | 
| 
bsw@279
 | 
    56             }
 | 
| 
bsw@1479
 | 
    57 
 | 
| 
bsw@1479
 | 
    58             ui.field.select{
 | 
| 
bsw@1479
 | 
    59               label = _"How important is your suggestions for you?",
 | 
| 
bsw@1479
 | 
    60               name = "degree",
 | 
| 
bsw@1479
 | 
    61               foreign_records = {
 | 
| 
bsw@1479
 | 
    62                 { id =  1, name = _"should be implemented"},
 | 
| 
bsw@1479
 | 
    63                 { id =  2, name = _"must be implemented"},
 | 
| 
bsw@1479
 | 
    64               },
 | 
| 
bsw@1479
 | 
    65               foreign_id = "id",
 | 
| 
bsw@1479
 | 
    66               foreign_name = "name"
 | 
| 
bsw@279
 | 
    67             }
 | 
| 
bsw@1838
 | 
    68 
 | 
| 
bsw@1838
 | 
    69             slot.put("<br>")
 | 
| 
bsw@1838
 | 
    70 
 | 
| 
bsw@1480
 | 
    71             ui.submit{ 
 | 
| 
bsw@1480
 | 
    72               attr = { class = "mdl-button mdl-js-button mdl-button--raised mdl-button--colored mdl-js-ripple-effect" },
 | 
| 
bsw@1480
 | 
    73               text = _"publish suggestion" 
 | 
| 
bsw@1480
 | 
    74             }
 | 
| 
bsw@1479
 | 
    75             slot.put(" ")
 | 
| 
bsw@1479
 | 
    76             ui.link{
 | 
| 
bsw@1480
 | 
    77               attr = { class = "mdl-button mdl-js-button" },
 | 
| 
bsw@1479
 | 
    78               content = _"cancel",
 | 
| 
bsw@1479
 | 
    79               module = "initiative",
 | 
| 
bsw@1479
 | 
    80               view = "show",
 | 
| 
bsw@1479
 | 
    81               id = initiative_id,
 | 
| 
bsw@1479
 | 
    82               params = { tab = "suggestions" }
 | 
| 
bsw@1479
 | 
    83             }
 | 
| 
bsw@1479
 | 
    84 
 | 
| 
bsw@279
 | 
    85           end
 | 
| 
bsw@279
 | 
    86         }
 | 
| 
bsw@1479
 | 
    87       end }
 | 
| 
bsw@1479
 | 
    88     end }
 | 
| 
bsw@1479
 | 
    89   end }
 | 
| 
bsw@1479
 | 
    90 end }
 |