liquid_feedback_frontend

annotate app/main/admin/member_edit.lua @ 1457:77fb282db8a1

Fixed nesting again
author bsw
date Thu Oct 18 17:25:35 2018 +0200 (2018-10-18)
parents 9e5cfd6411aa
children 3494edd607e7
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 ui.heading { level = 1, content = member and (member.name or member.id) or _"New member" }
bsw@1456 45 if member and member.identification then
bsw@1456 46 ui.heading { level = 3, content = member.identification }
bsw@1456 47 end
bsw@1455 48
bsw@1456 49 ui.field.text{ label = _"Identification", name = "identification" }
bsw@1456 50 ui.field.text{ label = _"Notification email (confirmed)", name = "notify_email" }
bsw@1456 51 ui.field.text{ label = _"Notification email (unconfirmed)", name = "notify_email_unconfirmed" }
bsw@1456 52 if member and member.activated then
bsw@1456 53 ui.field.text{ label = _"Screen name", name = "name" }
bsw@1456 54 end
bsw@1456 55
bsw@1456 56 if member and member.activated and not deactivated then
bsw@1456 57 ui.field.text{ label = _"Login name", name = "login" }
bsw@1456 58 end
bsw@1088 59
bsw@1456 60 for i, unit in ipairs(units) do
bsw@1456 61 ui.field.boolean{
bsw@1456 62 name = "unit_" .. unit.id,
bsw@1456 63 label = unit.name,
bsw@1456 64 value = unit.voting_right
bsw@1456 65 }
bsw@1455 66 slot.put("<br /><br />")
bsw@1045 67
bsw@1455 68 if member then
bsw@1455 69 ui.field.text{ label = _"Activated", name = "activated", readonly = true }
bsw@1455 70 end
bsw@1455 71
bsw@1455 72 if not member or not member.activated then
bsw@1455 73 ui.field.boolean{ label = _"Send invite?", name = "invite_member" }
bsw@1455 74 end
bsw@1455 75
bsw@1455 76 if member then
bsw@1455 77 ui.field.boolean{
bsw@1455 78 label = _"Member inactive?", name = "deactivate",
bsw@1455 79 readonly = true,
bsw@1455 80 value = member and member.active == false
bsw@1455 81 }
bsw@1455 82 end
bsw@1455 83
bsw@1455 84 if member then
bsw@1455 85 ui.field.boolean{
bsw@1455 86 label = _"Lock member?", name = "locked",
bsw@1455 87 }
bsw@1455 88 end
bsw@1455 89
bsw@1455 90 slot.put("<br />")
bsw@1455 91 ui.field.boolean{ label = _"Admin?", name = "admin" }
bsw@1455 92 slot.put("<br />")
bsw@1455 93 ui.submit{ text = _"update member" }
bsw@1455 94 slot.put(" ")
bsw@1455 95 if member then
bsw@1455 96 ui.link { module = "admin", view = "member_deactivate", content = _"Deactivate member", id = member.id }
bsw@1455 97 slot.put(" ")
bsw@1455 98 end
bsw@1455 99 ui.link { module = "admin", view = "index", content = _"cancel" }
bsw@1456 100
bsw@1457 101 end
bsw@1457 102 }
bsw@1457 103 end }
bsw@1455 104 end }
bsw@1455 105 end }
bsw@1455 106 end }

Impressum / About Us