liquid_feedback_frontend

view app/main/contact/list.lua @ 1145:904f6807f7fa

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

Impressum / About Us