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