liquid_feedback_frontend
view app/main/member/edit.lua @ 1429:2305d3cb16da
Fixed wrong variable name2
| author | bsw | 
|---|---|
| date | Fri Oct 05 21:57:26 2018 +0200 (2018-10-05) | 
| parents | 32cc544d5a5b | 
| children | ce812dccaac2 | 
 line source
     1 ui.titleMember(_"Edit your profile data")
     3 local profile = app.session.member.profile
     5 ui.grid{ content = function()
     6   ui.cell_main{ content = function()
     8     ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function()
     9       ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
    10         ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = _"Edit your profile data" }
    11       end }
    12       ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function()
    13         ui.form{
    14           record = profile,
    15           attr = { class = "vertical" },
    16           module = "member",
    17           action = "update",
    18           routing = {
    19             ok = {
    20               mode = "redirect",
    21               module = "member",
    22               view = "show",
    23               id = app.session.member_id
    24             }
    25           },
    26           content = function()
    28             ui.container{ content = _"All fields are optional. Please enter only data which should be published." }
    30             for i, field in ipairs(config.member_profile_fields) do
    31               ui.container{
    32                 attr = { class = "mdl-textfield mdl-js-textfield mdl-textfield--floating-label" },
    33                 content = function()
    34                   ui.tag{ tag = "input", attr = { class = "mdl-textfield__input", name = field.id, id = "input_" .. field.id, readonly = config.locked_profile_fields[field.id], value = profile and profile.profile and profile.profile[field.id] or nil } }
    35                   ui.tag{ tag = "label", attr = { class = "mdl-textfield__label", ["for"] = "input_" .. field.id }, content = field.name }
    36               end }
    37               slot.put("<br />")
    38             end
    40             if not config.enforce_formatting_engine then
    41               ui.field.select{
    42                 label = _"Wiki engine for statement",
    43                 name = "formatting_engine",
    44                 foreign_records = config.formatting_engines,
    45                 attr = {id = "formatting_engine"},
    46                 foreign_id = "id",
    47                 foreign_name = "name",
    48                 value = param.get("formatting_engine")
    49               }
    50               ui.tag{
    51                 tag = "div",
    52                 content = function()
    53                   ui.tag{
    54                     tag = "label",
    55                     attr = { class = "ui_field_label" },
    56                     content = function() slot.put(" ") end,
    57                   }
    58                   ui.tag{
    59                     content = function()
    60                       ui.link{
    61                         text = _"Syntax help",
    62                         module = "help",
    63                         view = "show",
    64                         id = "wikisyntax",
    65                         attr = {onClick="this.href=this.href.replace(/wikisyntax[^.]*/g, 'wikisyntax_'+getElementById('formatting_engine').value)"}
    66                       }
    67                       slot.put(" ")
    68                       ui.link{
    69                         text = _"(new window)",
    70                         module = "help",
    71                         view = "show",
    72                         id = "wikisyntax",
    73                         attr = {target = "_blank", onClick="this.href=this.href.replace(/wikisyntax[^.]*/g, 'wikisyntax_'+getElementById('formatting_engine').value)"}
    74                       }
    75                     end
    76                   }
    77                 end
    78               }
    79             end
    80             ui.field.text{
    81               label = _"Statement",
    82               name = "statement",
    83               multiline = true, 
    84               attr = { style = "height: 50ex;" },
    85               value = param.get("statement")
    86             }
    87             slot.put("<br />")
    88             ui.container{ attr = { class = "actions" }, content = function()
    89               ui.tag{
    90                 tag = "input",
    91                 attr = {
    92                   type = "submit",
    93                   class = "mdl-button mdl-js-button mdl-button--raised mdl-button--colored mdl-js-ripple-effect",
    94                   value = _"publish profile data"
    95                 },
    96                 content = ""
    97               }
    98               slot.put("   ")
    99               ui.link{
   100                 attr = {
   101                   class = "mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect",
   102                 },
   103                 content = _"cancel",
   104                 module = "member", view = "show", id = app.session.member.id
   105               }
   106             end }
   107           end
   108         }
   110       end }
   111     end }
   112   end }
   114   ui.cell_sidebar{ content = function()
   115     execute.view {
   116       module = "member", view = "_sidebar_whatcanido", params = {
   117         member = app.session.member
   118       }
   119     }
   120   end }
   122 end }
