liquid_feedback_frontend
view app/main/suggestion/new.lua @ 397:6cfdb2e5d3d4
Force render of members statement after it got changed
| author | bsw | 
|---|---|
| date | Wed Mar 07 12:29:15 2012 +0100 (2012-03-07) | 
| parents | 23c98752e697 | 
| children | 99852ec8ee37 | 
 line source
     1 local initiative_id = param.get("initiative_id")
     3 slot.put_into("title", _"Add new suggestion")
     5 slot.select("actions", function()
     6   ui.link{
     7     content = function()
     8         ui.image{ static = "icons/16/cancel.png" }
     9         slot.put(_"Cancel")
    10     end,
    11     module = "initiative",
    12     view = "show",
    13     id = initiative_id,
    14     params = { tab = "suggestions" }
    15   }
    16 end)
    18 ui.form{
    19   module = "suggestion",
    20   action = "add",
    21   params = { initiative_id = initiative_id },
    22   routing = {
    23     default = {
    24       mode = "redirect",
    25       module = "initiative",
    26       view = "show",
    27       id = initiative_id,
    28       params = { tab = "suggestions" }
    29     }
    30   },
    31   attr = { class = "vertical" },
    32   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
    40     ui.field.select{
    41       label = _"Degree",
    42       name = "degree",
    43       foreign_records = {
    44         { id =  1, name = _"should"},
    45         { id =  2, name = _"must"},
    46       },
    47       foreign_id = "id",
    48       foreign_name = "name"
    49     }
    50     ui.field.text{ label = _"Title (80 chars max)", name = "name" }
    51     ui.field.select{
    52       label = _"Wiki engine",
    53       name = "formatting_engine",
    54       foreign_records = {
    55         { id = "rocketwiki", name = "RocketWiki" },
    56         { id = "compat", name = _"Traditional wiki syntax" }
    57       },
    58       attr = {id = "formatting_engine"},
    59       foreign_id = "id",
    60       foreign_name = "name",
    61       value = param.get("formatting_engine")
    62     }
    63     ui.tag{
    64       tag = "div",
    65       content = function()
    66         ui.tag{
    67           tag = "label",
    68           attr = { class = "ui_field_label" },
    69           content = function() slot.put(" ") end,
    70         }
    71         ui.tag{
    72           content = function()
    73             ui.link{
    74               text = _"Syntax help",
    75               module = "help",
    76               view = "show",
    77               id = "wikisyntax",
    78               attr = {onClick="this.href=this.href.replace(/wikisyntax[^.]*/g, 'wikisyntax_'+getElementById('formatting_engine').value)"}
    79             }
    80             slot.put(" ")
    81             ui.link{
    82               text = _"(new window)",
    83               module = "help",
    84               view = "show",
    85               id = "wikisyntax",
    86               attr = {target = "_blank", onClick="this.href=this.href.replace(/wikisyntax[^.]*/g, 'wikisyntax_'+getElementById('formatting_engine').value)"}
    87             }
    88           end
    89         }
    90       end
    91     }
    92     ui.field.text{
    93       label = _"Description",
    94       name = "content",
    95       multiline = true, 
    96       attr = { style = "height: 50ex;" },
    97       value = param.get("content")
    98     }
   101     ui.submit{ text = _"Commit suggestion" }
   102   end
   103 }
