liquid_feedback_frontend
view app/main/suggestion/new.lua @ 1847:bcfa66dd8980
Added version numbers
| author | bsw | 
|---|---|
| date | Thu Feb 03 16:07:59 2022 +0100 (2022-02-03) | 
| parents | bee9e998fa4d | 
| children | 
 line source
     1 local initiative_id = param.get("initiative_id")
     3 ui.grid{ content = function()
     5   ui.cell_main{ content = function()
     6     ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function()
     7       ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
     8         ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = _"Add a new suggestion for improvement" }
     9       end }
    10       ui.container{ attr = { class = "mdl-card__content" }, content = function()
    11         ui.form{
    12           module = "suggestion",
    13           action = "add",
    14           params = { initiative_id = initiative_id },
    15           routing = {
    16             default = {
    17               mode = "redirect",
    18               module = "initiative",
    19               view = "show",
    20               id = initiative_id,
    21               params = { tab = "suggestions" }
    22             },
    23             error = {
    24               mode = "forward",
    25               module = "suggestion",
    26               view = "new",
    27               params = { initiative_id = initiative_id }
    28             }
    29           },
    30           attr = { class = "section vertical" },
    31           content = function()
    33             local supported = Supporter:by_pk(initiative_id, app.session.member.id) and true or false
    34             if not supported then
    35               ui.field.text{
    36                 attr = { class = "warning" },
    37                 value = _"You are currently not supporting this initiative directly. By adding suggestions to this initiative you will automatically become a potential supporter."
    38               }
    39             end
    41             ui.container{ attr = { class = "mdl-textfield mdl-js-textfield mdl-textfield--floating-label mdl-card__fullwidth" }, content = function ()
    42               ui.field.text{
    43                 attr = { id = "lf-initiative__name", class = "mdl-textfield__input" },
    44                 label_attr = { class = "mdl-textfield__label", ["for"] = "lf-initiative__name" },
    45                 label = _"A short title (80 chars max)",
    46                 name  = "name"
    47               }
    48             end }
    50             ui.field.text{
    51               label = _"Describe how the proposal and/or the reasons of the initiative could be improved",
    52               name = "content",
    53               multiline = true, 
    54               attr = { style = "height: 50ex;" },
    55               value = param.get("content")
    56             }
    58             ui.field.select{
    59               label = _"How important is your suggestions for you?",
    60               name = "degree",
    61               foreign_records = {
    62                 { id =  1, name = _"should be implemented"},
    63                 { id =  2, name = _"must be implemented"},
    64               },
    65               foreign_id = "id",
    66               foreign_name = "name"
    67             }
    69             slot.put("<br>")
    71             ui.submit{ 
    72               attr = { class = "mdl-button mdl-js-button mdl-button--raised mdl-button--colored mdl-js-ripple-effect" },
    73               text = _"publish suggestion" 
    74             }
    75             slot.put(" ")
    76             ui.link{
    77               attr = { class = "mdl-button mdl-js-button" },
    78               content = _"cancel",
    79               module = "initiative",
    80               view = "show",
    81               id = initiative_id,
    82               params = { tab = "suggestions" }
    83             }
    85           end
    86         }
    87       end }
    88     end }
    89   end }
    90 end }
