liquid_feedback_frontend
view app/main/suggestion/new.lua @ 1702:4ddc5841e136
Added MOTD top internal
| author | bsw | 
|---|---|
| date | Mon Sep 27 10:57:00 2021 +0200 (2021-09-27) | 
| parents | ce00a6d5f610 | 
| children | 7dcbcbf492e3 | 
 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           },
    24           attr = { class = "section vertical" },
    25           content = function()
    27             local supported = Supporter:by_pk(initiative_id, app.session.member.id) and true or false
    28             if not supported then
    29               ui.field.text{
    30                 attr = { class = "warning" },
    31                 value = _"You are currently not supporting this initiative directly. By adding suggestions to this initiative you will automatically become a potential supporter."
    32               }
    33             end
    34             ui.field.text{ label = _"A short title (80 chars max)", name = "name" }
    36             if not config.enforce_formatting_engine then
    37               ui.field.select{
    38                 label = _"Wiki engine",
    39                 name = "formatting_engine",
    40                 foreign_records = config.formatting_engines,
    41                 attr = {id = "formatting_engine"},
    42                 foreign_id = "id",
    43                 foreign_name = "name",
    44                 value = param.get("formatting_engine")
    45               }
    46               ui.tag{
    47                 tag = "div",
    48                 content = function()
    49                   ui.tag{
    50                     tag = "label",
    51                     attr = { class = "ui_field_label" },
    52                     content = function() slot.put(" ") end,
    53                   }
    54                   ui.tag{
    55                     content = function()
    56                       ui.link{
    57                         text = _"Syntax help",
    58                         module = "help",
    59                         view = "show",
    60                         id = "wikisyntax",
    61                         attr = {onClick="this.href=this.href.replace(/wikisyntax[^.]*/g, 'wikisyntax_'+getElementById('formatting_engine').value)"}
    62                       }
    63                       slot.put(" ")
    64                       ui.link{
    65                         text = _"(new window)",
    66                         module = "help",
    67                         view = "show",
    68                         id = "wikisyntax",
    69                         attr = {target = "_blank", onClick="this.href=this.href.replace(/wikisyntax[^.]*/g, 'wikisyntax_'+getElementById('formatting_engine').value)"}
    70                       }
    71                     end
    72                   }
    73                 end
    74               }
    75             end
    77             ui.field.text{
    78               label = _"Describe how the proposal and/or the reasons of the initiative could be improved",
    79               name = "content",
    80               multiline = true, 
    81               attr = { style = "height: 50ex;" },
    82               value = param.get("content")
    83             }
    85             ui.field.select{
    86               label = _"How important is your suggestions for you?",
    87               name = "degree",
    88               foreign_records = {
    89                 { id =  1, name = _"should be implemented"},
    90                 { id =  2, name = _"must be implemented"},
    91               },
    92               foreign_id = "id",
    93               foreign_name = "name"
    94             }
    96             ui.submit{ 
    97               attr = { class = "mdl-button mdl-js-button mdl-button--raised mdl-button--colored mdl-js-ripple-effect" },
    98               text = _"publish suggestion" 
    99             }
   100             slot.put(" ")
   101             ui.link{
   102               attr = { class = "mdl-button mdl-js-button" },
   103               content = _"cancel",
   104               module = "initiative",
   105               view = "show",
   106               id = initiative_id,
   107               params = { tab = "suggestions" }
   108             }
   110           end
   111         }
   112       end }
   113     end }
   114   end }
   115 end }
