liquid_feedback_frontend
view app/main/admin/member_edit.lua @ 1341:35f343eec2b6
Fixed image display part 3
| author | bsw | 
|---|---|
| date | Fri Aug 03 17:36:10 2018 +0200 (2018-08-03) | 
| parents | 32cc544d5a5b | 
| children | d55f506f032b | 
 line source
     1 local id = param.get_id()
     3 local member = Member:by_id(id)
     5 local deactivated = member and member.locked and member.login == nil and member.authority_login == nil
     7 ui.titleAdmin(_"Member")
     9 local units_selector = Unit:new_selector()
    11 if member then
    12   units_selector
    13     :left_join("privilege", nil, { "privilege.member_id = ? AND privilege.unit_id = unit.id", member.id })
    14     :add_field("privilege.voting_right", "voting_right")
    15 end
    17 local units = units_selector:exec()
    19 ui.form{
    20   attr = { class = "vertical section" },
    21   module = "admin",
    22   action = "member_update",
    23   id = member and member.id,
    24   record = member,
    25   readonly = not app.session.member.admin,
    26   routing = {
    27     default = {
    28       mode = "redirect",
    29       modules = "admin",
    30       view = "index"
    31     }
    32   },
    33   content = function()
    35     ui.sectionHead( function()
    36       ui.heading { level = 1, content = member and (member.name or member.id) or _"New member" }
    37       if member and member.identification then
    38         ui.heading { level = 3, content = member.identification }
    39       end
    40     end )
    42     ui.sectionRow( function()
    43       ui.field.text{     label = _"Identification", name = "identification" }
    44       ui.field.text{     label = _"Notification email (confirmed)", name = "notify_email" }
    45       ui.field.text{     label = _"Notification email (unconfirmed)", name = "notify_email_unconfirmed" }
    46       if member and member.activated then
    47         ui.field.text{     label = _"Screen name",        name = "name" }
    48       end
    50       if member and member.activated and not deactivated then
    51         ui.field.text{     label = _"Login name",        name = "login" }
    52       end
    54       for i, unit in ipairs(units) do
    55         ui.field.boolean{
    56           name = "unit_" .. unit.id,
    57           label = unit.name,
    58           value = unit.voting_right
    59         }
    60       end
    61       slot.put("<br /><br />")
    63       if member then
    64         ui.field.text{  label = _"Activated",       name = "activated", readonly = true }
    65       end
    67       if not member or not member.activated then
    68         ui.field.boolean{  label = _"Send invite?",       name = "invite_member" }
    69       end
    71       if member then
    72         ui.field.boolean{ 
    73           label = _"Member inactive?", name = "deactivate",
    74           readonly = true, 
    75           value = member and member.active == false
    76         }
    77       end
    79       if member then
    80         ui.field.boolean{
    81           label = _"Lock member?", name = "locked",
    82         }
    83       end
    85       slot.put("<br />")
    86       ui.field.boolean{  label = _"Admin?", name = "admin" }
    87       slot.put("<br />")
    88       ui.submit{         text  = _"update member" }
    89       slot.put(" ")
    90       if member then
    91         ui.link { module = "admin", view = "member_deactivate", content = _"Deactivate member", id = member.id }
    92         slot.put(" ")
    93       end
    94       ui.link { module = "admin", view = "index", content = _"cancel" }
    95     end )
    96   end
    97 }
