rev |
line source |
bsw@198
|
1 local contacts_selector = Contact:build_selector{
|
bsw@198
|
2 member_id = app.session.member_id,
|
bsw@198
|
3 order = "name"
|
bsw@198
|
4 }
|
bsw@198
|
5
|
bsw@564
|
6 ui.title(_"Contacts")
|
bsw/jbe@0
|
7
|
bsw@198
|
8
|
bsw/jbe@4
|
9 util.help("contact.list")
|
bsw/jbe@4
|
10
|
bsw@198
|
11
|
bsw@198
|
12 ui.paginate{
|
bsw@198
|
13 selector = contacts_selector,
|
bsw@198
|
14 content = function()
|
bsw@198
|
15 local contacts = contacts_selector:exec()
|
bsw@198
|
16 if #contacts == 0 then
|
jbe@233
|
17 ui.field.text{ value = _"You didn't save any member as contact yet." }
|
bsw@198
|
18 else
|
bsw@198
|
19 ui.list{
|
bsw@198
|
20 records = contacts,
|
bsw@198
|
21 columns = {
|
bsw@198
|
22 {
|
bsw@198
|
23 label = _"Name",
|
bsw@198
|
24 content = function(record)
|
bsw@198
|
25 ui.link{
|
bsw@198
|
26 text = record.other_member.name,
|
bsw@198
|
27 module = "member",
|
bsw@198
|
28 view = "show",
|
bsw@198
|
29 id = record.other_member_id
|
bsw@198
|
30 }
|
bsw@198
|
31 end
|
bsw@198
|
32 },
|
bsw@198
|
33 {
|
bsw@198
|
34 label = _"Published",
|
bsw@198
|
35 content = function(record)
|
bsw@198
|
36 ui.field.boolean{ value = record.public }
|
bsw@198
|
37 end
|
bsw@198
|
38 },
|
bsw@198
|
39 {
|
bsw@198
|
40 content = function(record)
|
bsw@198
|
41 if record.public then
|
bsw@198
|
42 ui.link{
|
bsw@198
|
43 attr = { class = "action" },
|
bsw@198
|
44 text = _"Hide",
|
bsw@198
|
45 module = "contact",
|
bsw@198
|
46 action = "add_member",
|
bsw@198
|
47 id = record.other_member_id,
|
bsw@198
|
48 params = { public = false },
|
bsw@198
|
49 routing = {
|
bsw@198
|
50 default = {
|
bsw@198
|
51 mode = "redirect",
|
bsw@198
|
52 module = request.get_module(),
|
bsw@198
|
53 view = request.get_view(),
|
bsw@198
|
54 id = param.get_id_cgi(),
|
bsw@198
|
55 params = param.get_all_cgi()
|
bsw@198
|
56 }
|
bsw@198
|
57 }
|
bsw@198
|
58 }
|
bsw@198
|
59 else
|
bsw@198
|
60 ui.link{
|
bsw@198
|
61 attr = { class = "action" },
|
bsw@198
|
62 text = _"Publish",
|
bsw@198
|
63 module = "contact",
|
bsw@198
|
64 action = "add_member",
|
bsw@198
|
65 id = record.other_member_id,
|
bsw@198
|
66 params = { public = true },
|
bsw@198
|
67 routing = {
|
bsw@198
|
68 default = {
|
bsw@198
|
69 mode = "redirect",
|
bsw@198
|
70 module = request.get_module(),
|
bsw@198
|
71 view = request.get_view(),
|
bsw@198
|
72 id = param.get_id_cgi(),
|
bsw@198
|
73 params = param.get_all_cgi()
|
bsw@198
|
74 }
|
bsw@198
|
75 }
|
bsw@198
|
76 }
|
bsw@198
|
77 end
|
bsw@198
|
78 end
|
bsw@198
|
79 },
|
bsw@198
|
80 {
|
bsw@198
|
81 content = function(record)
|
bsw@198
|
82 ui.link{
|
bsw@198
|
83 attr = { class = "action" },
|
bsw@198
|
84 text = _"Remove",
|
bsw@198
|
85 module = "contact",
|
bsw@198
|
86 action = "remove_member",
|
bsw@198
|
87 id = record.other_member_id,
|
bsw@198
|
88 routing = {
|
bsw@198
|
89 default = {
|
bsw@198
|
90 mode = "redirect",
|
bsw@198
|
91 module = request.get_module(),
|
bsw@198
|
92 view = request.get_view(),
|
bsw@198
|
93 id = param.get_id_cgi(),
|
bsw@198
|
94 params = param.get_all_cgi()
|
bsw@198
|
95 }
|
bsw@198
|
96 }
|
bsw@198
|
97 }
|
bsw@198
|
98 end
|
bsw@198
|
99 },
|
bsw@198
|
100 }
|
bsw@198
|
101 }
|
bsw@198
|
102 end
|
bsw@198
|
103 end
|
bsw/jbe@0
|
104 }
|