liquid_feedback_frontend
view app/main/suggestion/new.lua @ 1086:2d69cc034132
Fixed access privileges for view issue/history
| author | bsw | 
|---|---|
| date | Fri Aug 15 12:19:36 2014 +0200 (2014-08-15) | 
| parents | 701a5cf6b067 | 
| children | 00d281ba3099 | 
 line source
     1 local initiative_id = param.get("initiative_id")
     3 ui.form{
     4   module = "suggestion",
     5   action = "add",
     6   params = { initiative_id = initiative_id },
     7   routing = {
     8     default = {
     9       mode = "redirect",
    10       module = "initiative",
    11       view = "show",
    12       id = initiative_id,
    13       params = { tab = "suggestions" }
    14     }
    15   },
    16   attr = { class = "section vertical" },
    17   content = function()
    19     ui.sectionHead( function()
    20       ui.heading { level = 1, content = _"Add a new suggestion for improvement" }
    21     end)
    23     ui.sectionRow( function()
    25       local supported = Supporter:by_pk(initiative_id, app.session.member.id) and true or false
    26       if not supported then
    27         ui.field.text{
    28           attr = { class = "warning" },
    29           value = _"You are currently not supporting this initiative directly. By adding suggestions to this initiative you will automatically become a potential supporter."
    30         }
    31       end
    32       ui.field.text{ label = _"A short title (80 chars max)", name = "name" }
    34       if not config.enforce_formatting_engine then
    35         ui.field.select{
    36           label = _"Wiki engine",
    37           name = "formatting_engine",
    38           foreign_records = config.formatting_engines,
    39           attr = {id = "formatting_engine"},
    40           foreign_id = "id",
    41           foreign_name = "name",
    42           value = param.get("formatting_engine")
    43         }
    44         ui.tag{
    45           tag = "div",
    46           content = function()
    47             ui.tag{
    48               tag = "label",
    49               attr = { class = "ui_field_label" },
    50               content = function() slot.put(" ") end,
    51             }
    52             ui.tag{
    53               content = function()
    54                 ui.link{
    55                   text = _"Syntax help",
    56                   module = "help",
    57                   view = "show",
    58                   id = "wikisyntax",
    59                   attr = {onClick="this.href=this.href.replace(/wikisyntax[^.]*/g, 'wikisyntax_'+getElementById('formatting_engine').value)"}
    60                 }
    61                 slot.put(" ")
    62                 ui.link{
    63                   text = _"(new window)",
    64                   module = "help",
    65                   view = "show",
    66                   id = "wikisyntax",
    67                   attr = {target = "_blank", onClick="this.href=this.href.replace(/wikisyntax[^.]*/g, 'wikisyntax_'+getElementById('formatting_engine').value)"}
    68                 }
    69               end
    70             }
    71           end
    72         }
    73       end
    75       ui.field.text{
    76         label = _"Describe how the proposal and/or the reasons of the initiative could be improved",
    77         name = "content",
    78         multiline = true, 
    79         attr = { style = "height: 50ex;" },
    80         value = param.get("content")
    81       }
    83       ui.field.select{
    84         label = _"How important is your suggestions for you?",
    85         name = "degree",
    86         foreign_records = {
    87           { id =  1, name = _"should be implemented"},
    88           { id =  2, name = _"must be implemented"},
    89         },
    90         foreign_id = "id",
    91         foreign_name = "name"
    92       }
    94       ui.submit{ text = _"publish suggestion" }
    95       slot.put(" ")
    96       ui.link{
    97         content = _"cancel",
    98         module = "initiative",
    99         view = "show",
   100         id = initiative_id,
   101         params = { tab = "suggestions" }
   102       }
   104     end )
   105   end
   106 }
