rev |
line source |
bsw@193
|
1 local show_locked = param.get("show_locked", atom.boolean)
|
bsw@193
|
2
|
bsw@581
|
3 local locked = show_locked or false
|
bsw@581
|
4 local search = param.get("search")
|
bsw@581
|
5 if search then
|
bsw@581
|
6 locked = nil
|
bsw@581
|
7 end
|
bsw@581
|
8
|
bsw@581
|
9 local members_selector = Member:build_selector{
|
bsw@581
|
10 admin_search = search,
|
bsw@581
|
11 locked = locked,
|
bsw@581
|
12 order = "identification"
|
bsw@193
|
13 }
|
bsw@193
|
14
|
bsw@193
|
15
|
bsw@581
|
16 ui.title(_"Member list")
|
bsw/jbe@0
|
17
|
bsw@193
|
18
|
bsw@581
|
19 slot.select("head", function()
|
bsw@581
|
20 ui.container{ attr = { class = "content" }, content = function()
|
bsw@581
|
21 ui.container{ attr = { class = "actions" }, content = function()
|
bsw@581
|
22 ui.link{
|
bsw@581
|
23 attr = { class = { "admin_only" } },
|
bsw@581
|
24 text = _"Register new member",
|
bsw@581
|
25 module = "admin",
|
bsw@581
|
26 view = "member_edit"
|
bsw@581
|
27 }
|
bsw@581
|
28 slot.put(" · ")
|
bsw@581
|
29 if show_locked then
|
bsw@581
|
30 ui.link{
|
bsw@581
|
31 attr = { class = { "admin_only" } },
|
bsw@581
|
32 text = _"Show active members",
|
bsw@581
|
33 module = "admin",
|
bsw@581
|
34 view = "member_list"
|
bsw@581
|
35 }
|
bsw@581
|
36 else
|
bsw@581
|
37 ui.link{
|
bsw@581
|
38 attr = { class = { "admin_only" } },
|
bsw@581
|
39 text = _"Show locked members",
|
bsw@581
|
40 module = "admin",
|
bsw@581
|
41 view = "member_list",
|
bsw@581
|
42 params = { show_locked = true }
|
bsw@581
|
43 }
|
bsw@581
|
44 end
|
bsw@581
|
45 end }
|
bsw@581
|
46 end }
|
bsw/jbe@0
|
47 end)
|
bsw/jbe@0
|
48
|
bsw/jbe@0
|
49
|
bsw@581
|
50 ui.form{
|
bsw@581
|
51 module = "admin", view = "member_list",
|
bsw@581
|
52 content = function()
|
bsw@581
|
53
|
bsw@581
|
54 ui.field.text{ label = _"Search for members", name = "search" }
|
bsw@581
|
55
|
bsw@581
|
56 ui.submit{ value = _"Start search" }
|
bsw@581
|
57
|
bsw@581
|
58 end
|
bsw@581
|
59 }
|
bsw@581
|
60
|
bsw/jbe@0
|
61 ui.paginate{
|
bsw/jbe@0
|
62 selector = members_selector,
|
bsw@193
|
63 per_page = 30,
|
bsw/jbe@0
|
64 content = function()
|
bsw/jbe@0
|
65 ui.list{
|
bsw/jbe@0
|
66 records = members_selector:exec(),
|
bsw/jbe@0
|
67 columns = {
|
bsw/jbe@0
|
68 {
|
bsw/jbe@0
|
69 field_attr = { style = "text-align: right;" },
|
bsw/jbe@0
|
70 label = _"Id",
|
bsw/jbe@0
|
71 name = "id"
|
bsw/jbe@0
|
72 },
|
bsw/jbe@0
|
73 {
|
bsw@581
|
74 label = _"Identification",
|
bsw@581
|
75 name = "identification"
|
bsw/jbe@0
|
76 },
|
bsw/jbe@0
|
77 {
|
bsw@581
|
78 label = _"Screen name",
|
bsw@581
|
79 name = "name"
|
bsw@581
|
80 },
|
bsw@581
|
81 {
|
bsw@581
|
82 label = _"Admin?",
|
bsw/jbe@0
|
83 content = function(record)
|
bsw@581
|
84 if record.admin then
|
bsw@581
|
85 ui.field.text{ value = "admin" }
|
bsw@581
|
86 end
|
bsw/jbe@0
|
87 end
|
bsw/jbe@0
|
88 },
|
bsw/jbe@0
|
89 {
|
bsw/jbe@0
|
90 content = function(record)
|
bsw@581
|
91 if record.locked then
|
bsw/jbe@0
|
92 ui.field.text{ value = "locked" }
|
bsw@581
|
93 elseif not record.activated then
|
bsw@581
|
94 ui.field.text{ value = "not activated" }
|
bsw@581
|
95 elseif not record.active then
|
bsw@581
|
96 ui.field.text{ value = "inactive" }
|
bsw/jbe@0
|
97 end
|
bsw/jbe@0
|
98 end
|
bsw/jbe@0
|
99 },
|
bsw/jbe@0
|
100 {
|
bsw/jbe@0
|
101 content = function(record)
|
bsw@193
|
102 ui.link{
|
bsw@193
|
103 attr = { class = "action admin_only" },
|
bsw@193
|
104 text = _"Edit",
|
bsw@193
|
105 module = "admin",
|
bsw@193
|
106 view = "member_edit",
|
bsw@193
|
107 id = record.id
|
bsw@193
|
108 }
|
bsw/jbe@0
|
109 end
|
bsw/jbe@0
|
110 }
|
bsw/jbe@0
|
111 }
|
bsw/jbe@0
|
112 }
|
bsw/jbe@0
|
113 end
|
bsw/jbe@0
|
114 } |