bsw@1045: ui.titleMember(_"Edit your profile data")
bsw/jbe@0: 
bsw/jbe@1309: local profile = app.session.member.profile
bsw/jbe@1309: 
bsw/jbe@1309: ui.grid{ content = function()
bsw/jbe@1309:   ui.cell_main{ content = function()
bsw/jbe@4: 
bsw/jbe@1309:     ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function()
bsw/jbe@1309:       ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
bsw/jbe@1309:         ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = _"Edit your profile data" }
bsw/jbe@1309:       end }
bsw/jbe@1309:       ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function()
bsw/jbe@1309:         ui.form{
bsw/jbe@1309:           record = profile,
bsw/jbe@1309:           attr = { class = "vertical" },
bsw/jbe@1309:           module = "member",
bsw/jbe@1309:           action = "update",
bsw/jbe@1309:           routing = {
bsw/jbe@1309:             ok = {
bsw/jbe@1309:               mode = "redirect",
bsw/jbe@1309:               module = "member",
bsw/jbe@1309:               view = "show",
bsw/jbe@1309:               id = app.session.member_id
bsw/jbe@1309:             }
bsw/jbe@1309:           },
bsw/jbe@1309:           content = function()
bsw/jbe@1309:           
bsw@1489: --            ui.container{ content = _"All fields are optional. Please enter only data which should be published." }
bsw/jbe@1309:             
bsw@1488:             if config.member_profile_fields then
bsw@1488:               for i, field in ipairs(config.member_profile_fields) do
bsw@1488:                 ui.container{
bsw@1488:                   attr = { class = "mdl-textfield mdl-js-textfield mdl-textfield--floating-label" },
bsw@1488:                   content = function()
bsw@1488:                     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:                     ui.tag{ tag = "label", attr = { class = "mdl-textfield__label", ["for"] = "input_" .. field.id }, content = field.name }
bsw@1488:                 end }
bsw@1488:                 slot.put("
")
bsw@1488:               end
bsw/jbe@1309:             end
bsw/jbe@1309:             if not config.enforce_formatting_engine then
bsw/jbe@1309:               ui.field.select{
bsw/jbe@1309:                 label = _"Wiki engine for statement",
bsw/jbe@1309:                 name = "formatting_engine",
bsw/jbe@1309:                 foreign_records = config.formatting_engines,
bsw/jbe@1309:                 attr = {id = "formatting_engine"},
bsw/jbe@1309:                 foreign_id = "id",
bsw/jbe@1309:                 foreign_name = "name",
bsw/jbe@1309:                 value = param.get("formatting_engine")
bsw@1045:               }
bsw@1045:               ui.tag{
bsw/jbe@1309:                 tag = "div",
bsw@1045:                 content = function()
bsw/jbe@1309:                   ui.tag{
bsw/jbe@1309:                     tag = "label",
bsw/jbe@1309:                     attr = { class = "ui_field_label" },
bsw/jbe@1309:                     content = function() slot.put(" ") end,
bsw@1045:                   }
bsw/jbe@1309:                   ui.tag{
bsw/jbe@1309:                     content = function()
bsw/jbe@1309:                       ui.link{
bsw/jbe@1309:                         text = _"Syntax help",
bsw/jbe@1309:                         module = "help",
bsw/jbe@1309:                         view = "show",
bsw/jbe@1309:                         id = "wikisyntax",
bsw/jbe@1309:                         attr = {onClick="this.href=this.href.replace(/wikisyntax[^.]*/g, 'wikisyntax_'+getElementById('formatting_engine').value)"}
bsw/jbe@1309:                       }
bsw/jbe@1309:                       slot.put(" ")
bsw/jbe@1309:                       ui.link{
bsw/jbe@1309:                         text = _"(new window)",
bsw/jbe@1309:                         module = "help",
bsw/jbe@1309:                         view = "show",
bsw/jbe@1309:                         id = "wikisyntax",
bsw/jbe@1309:                         attr = {target = "_blank", onClick="this.href=this.href.replace(/wikisyntax[^.]*/g, 'wikisyntax_'+getElementById('formatting_engine').value)"}
bsw/jbe@1309:                       }
bsw/jbe@1309:                     end
bsw@1045:                   }
bsw@1045:                 end
bsw@1045:               }
bsw@1045:             end
bsw/jbe@1309:             ui.field.text{
bsw/jbe@1309:               label = _"Statement",
bsw/jbe@1309:               name = "statement",
bsw/jbe@1309:               multiline = true, 
bsw/jbe@1309:               attr = { style = "height: 50ex;" },
bsw/jbe@1309:               value = param.get("statement")
bsw/jbe@1309:             }
bsw/jbe@1309:             slot.put("
")
bsw/jbe@1309:             ui.container{ attr = { class = "actions" }, content = function()
bsw/jbe@1309:               ui.tag{
bsw/jbe@1309:                 tag = "input",
bsw/jbe@1309:                 attr = {
bsw/jbe@1309:                   type = "submit",
bsw/jbe@1309:                   class = "mdl-button mdl-js-button mdl-button--raised mdl-button--colored mdl-js-ripple-effect",
bsw/jbe@1309:                   value = _"publish profile data"
bsw/jbe@1309:                 },
bsw/jbe@1309:                 content = ""
bsw/jbe@1309:               }
bsw/jbe@1309:               slot.put("   ")
bsw/jbe@1309:               ui.link{
bsw/jbe@1309:                 attr = {
bsw/jbe@1309:                   class = "mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect",
bsw/jbe@1309:                 },
bsw/jbe@1309:                 content = _"cancel",
bsw/jbe@1309:                 module = "member", view = "show", id = app.session.member.id
bsw/jbe@1309:               }
bsw/jbe@1309:             end }
bsw/jbe@1309:           end
bsw@280:         }
bsw/jbe@1309: 
bsw/jbe@1309:       end }
bsw/jbe@1309:     end }
bsw/jbe@1309:   end }
bsw/jbe@1309:   
bsw/jbe@1309:   ui.cell_sidebar{ content = function()
bsw/jbe@1309:     execute.view {
bsw/jbe@1309:       module = "member", view = "_sidebar_whatcanido", params = {
bsw/jbe@1309:         member = app.session.member
bsw/jbe@1309:       }
bsw/jbe@1309:     }
bsw/jbe@1309:   end }
bsw/jbe@1309: 
bsw/jbe@1309: end }