liquid_feedback_frontend

annotate app/main/admin/member_edit.lua @ 1460:637fc7b37964

Nicer heading for admin member edit view
author bsw
date Thu Oct 18 17:28:35 2018 +0200 (2018-10-18)
parents ad2297c57457
children 22a1a6711154
rev   line source
bsw/jbe@0 1 local id = param.get_id()
bsw/jbe@0 2
bsw@193 3 local member = Member:by_id(id)
bsw@193 4
bsw@1088 5 local deactivated = member and member.locked and member.login == nil and member.authority_login == nil
bsw@1088 6
bsw@1184 7 ui.titleAdmin(_"Member")
bsw/jbe@0 8
bsw@513 9 local units_selector = Unit:new_selector()
bsw@512 10
bsw@513 11 if member then
bsw@513 12 units_selector
bsw@513 13 :left_join("privilege", nil, { "privilege.member_id = ? AND privilege.unit_id = unit.id", member.id })
bsw@513 14 :add_field("privilege.voting_right", "voting_right")
bsw@1438 15 :add_order_by("unit.name")
bsw@513 16 end
bsw@513 17
bsw@513 18 local units = units_selector:exec()
bsw@512 19
bsw@1455 20 ui.grid{ content = function()
bsw@310 21
bsw@1455 22 ui.cell_main{ content = function()
bsw@1455 23 ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function()
bsw@1455 24 ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
bsw@1455 25 ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = _"Member" }
bsw@1455 26 end }
bsw@1455 27 ui.container{ attr = { class = "mdl-card__content" }, content = function()
bsw@1455 28 ui.form{
bsw@1455 29 attr = { class = "vertical section" },
bsw@1455 30 module = "admin",
bsw@1455 31 action = "member_update",
bsw@1455 32 id = member and member.id,
bsw@1455 33 record = member,
bsw@1455 34 readonly = not app.session.member.admin,
bsw@1455 35 routing = {
bsw@1455 36 default = {
bsw@1455 37 mode = "redirect",
bsw@1455 38 modules = "admin",
bsw@1455 39 view = "index"
bsw@1455 40 }
bsw@1455 41 },
bsw@1455 42 content = function()
bsw@1455 43
bsw@1456 44 if member and member.identification then
bsw@1456 45 ui.heading { level = 3, content = member.identification }
bsw@1460 46 else
bsw@1460 47 ui.heading { level = 3, content = _"New member" }
bsw@1456 48 end
bsw@1455 49
bsw@1456 50 ui.field.text{ label = _"Identification", name = "identification" }
bsw@1456 51 ui.field.text{ label = _"Notification email (confirmed)", name = "notify_email" }
bsw@1456 52 ui.field.text{ label = _"Notification email (unconfirmed)", name = "notify_email_unconfirmed" }
bsw@1458 53
bsw@1456 54 if member and member.activated then
bsw@1456 55 ui.field.text{ label = _"Screen name", name = "name" }
bsw@1456 56 end
bsw@1456 57
bsw@1456 58 if member and member.activated and not deactivated then
bsw@1456 59 ui.field.text{ label = _"Login name", name = "login" }
bsw@1456 60 end
bsw@1088 61
bsw@1456 62 for i, unit in ipairs(units) do
bsw@1456 63 ui.field.boolean{
bsw@1459 64 name = "unit_" .. unit.id,
bsw@1459 65 label = unit.name,
bsw@1459 66 value = unit.voting_right
bsw@1459 67 }
bsw@1458 68 end
bsw@1455 69 slot.put("<br /><br />")
bsw@1045 70
bsw@1455 71 if member then
bsw@1455 72 ui.field.text{ label = _"Activated", name = "activated", readonly = true }
bsw@1455 73 end
bsw@1455 74
bsw@1455 75 if not member or not member.activated then
bsw@1455 76 ui.field.boolean{ label = _"Send invite?", name = "invite_member" }
bsw@1455 77 end
bsw@1455 78
bsw@1455 79 if member then
bsw@1455 80 ui.field.boolean{
bsw@1455 81 label = _"Member inactive?", name = "deactivate",
bsw@1455 82 readonly = true,
bsw@1455 83 value = member and member.active == false
bsw@1455 84 }
bsw@1455 85 end
bsw@1455 86
bsw@1455 87 if member then
bsw@1455 88 ui.field.boolean{
bsw@1455 89 label = _"Lock member?", name = "locked",
bsw@1455 90 }
bsw@1455 91 end
bsw@1455 92
bsw@1455 93 slot.put("<br />")
bsw@1455 94 ui.field.boolean{ label = _"Admin?", name = "admin" }
bsw@1455 95 slot.put("<br />")
bsw@1455 96 ui.submit{ text = _"update member" }
bsw@1455 97 slot.put(" ")
bsw@1455 98 if member then
bsw@1455 99 ui.link { module = "admin", view = "member_deactivate", content = _"Deactivate member", id = member.id }
bsw@1455 100 slot.put(" ")
bsw@1455 101 end
bsw@1455 102 ui.link { module = "admin", view = "index", content = _"cancel" }
bsw@1456 103
bsw@1457 104 end
bsw@1457 105 }
bsw@1457 106 end }
bsw@1455 107 end }
bsw@1455 108 end }
bsw@1455 109 end }

Impressum / About Us