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