liquid_feedback_frontend

view app/main/admin/member_edit.lua @ 1459:ad2297c57457

Fixed nesting again part 3
author bsw
date Thu Oct 18 17:27:23 2018 +0200 (2018-10-18)
parents 3494edd607e7
children 637fc7b37964
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 :add_order_by("unit.name")
16 end
18 local units = units_selector:exec()
20 ui.grid{ content = function()
22 ui.cell_main{ content = function()
23 ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function()
24 ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
25 ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = _"Member" }
26 end }
27 ui.container{ attr = { class = "mdl-card__content" }, content = function()
28 ui.form{
29 attr = { class = "vertical section" },
30 module = "admin",
31 action = "member_update",
32 id = member and member.id,
33 record = member,
34 readonly = not app.session.member.admin,
35 routing = {
36 default = {
37 mode = "redirect",
38 modules = "admin",
39 view = "index"
40 }
41 },
42 content = function()
44 ui.heading { level = 1, content = member and (member.name or member.id) or _"New member" }
46 if member and member.identification then
47 ui.heading { level = 3, content = member.identification }
48 end
50 ui.field.text{ label = _"Identification", name = "identification" }
51 ui.field.text{ label = _"Notification email (confirmed)", name = "notify_email" }
52 ui.field.text{ label = _"Notification email (unconfirmed)", name = "notify_email_unconfirmed" }
54 if member and member.activated then
55 ui.field.text{ label = _"Screen name", name = "name" }
56 end
58 if member and member.activated and not deactivated then
59 ui.field.text{ label = _"Login name", name = "login" }
60 end
62 for i, unit in ipairs(units) do
63 ui.field.boolean{
64 name = "unit_" .. unit.id,
65 label = unit.name,
66 value = unit.voting_right
67 }
68 end
69 slot.put("<br /><br />")
71 if member then
72 ui.field.text{ label = _"Activated", name = "activated", readonly = true }
73 end
75 if not member or not member.activated then
76 ui.field.boolean{ label = _"Send invite?", name = "invite_member" }
77 end
79 if member then
80 ui.field.boolean{
81 label = _"Member inactive?", name = "deactivate",
82 readonly = true,
83 value = member and member.active == false
84 }
85 end
87 if member then
88 ui.field.boolean{
89 label = _"Lock member?", name = "locked",
90 }
91 end
93 slot.put("<br />")
94 ui.field.boolean{ label = _"Admin?", name = "admin" }
95 slot.put("<br />")
96 ui.submit{ text = _"update member" }
97 slot.put(" ")
98 if member then
99 ui.link { module = "admin", view = "member_deactivate", content = _"Deactivate member", id = member.id }
100 slot.put(" ")
101 end
102 ui.link { module = "admin", view = "index", content = _"cancel" }
104 end
105 }
106 end }
107 end }
108 end }
109 end }

Impressum / About Us