liquid_feedback_frontend

view app/main/contact/list.lua @ 1309:32cc544d5a5b

Cumulative patch for upcoming frontend version 4
author bsw/jbe
date Sun Jul 15 14:07:29 2018 +0200 (2018-07-15)
parents 904f6807f7fa
children
line source
1 local contacts_selector = Contact:build_selector{
2 member_id = app.session.member_id,
3 order = "name"
4 }
6 ui.title(_"Contacts")
8 ui.grid{ content = function()
9 ui.cell_main{ content = function()
11 ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function()
12 ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
13 ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = _"Contacts" }
14 end }
15 ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function()
18 ui.paginate{
19 selector = contacts_selector,
20 content = function()
21 local contacts = contacts_selector:exec()
22 if #contacts == 0 then
23 ui.field.text{ value = _"You didn't save any member as contact yet." }
24 else
25 ui.list{
26 attr = { class = "mdl-data-table mdl-js-data-table mdl-shadow--2dp" },
27 records = contacts,
28 columns = {
29 {
30 label = _"Name",
31 content = function(record)
32 ui.link{
33 text = record.other_member.name,
34 module = "member",
35 view = "show",
36 id = record.other_member_id
37 }
38 end
39 },
40 {
41 label = _"Published",
42 content = function(record)
43 ui.field.boolean{ value = record.public }
44 end
45 },
46 {
47 content = function(record)
48 if record.public then
49 ui.link{
50 attr = { class = "action" },
51 text = _"Hide",
52 module = "contact",
53 action = "add_member",
54 id = record.other_member_id,
55 params = { public = false },
56 routing = {
57 default = {
58 mode = "redirect",
59 module = request.get_module(),
60 view = request.get_view(),
61 id = request.get_id_string(),
62 params = request.get_param_strings()
63 }
64 }
65 }
66 else
67 ui.link{
68 attr = { class = "action" },
69 text = _"Publish",
70 module = "contact",
71 action = "add_member",
72 id = record.other_member_id,
73 params = { public = true },
74 routing = {
75 default = {
76 mode = "redirect",
77 module = request.get_module(),
78 view = request.get_view(),
79 id = request.get_id_string(),
80 params = request.get_param_strings()
81 }
82 }
83 }
84 end
85 end
86 },
87 {
88 content = function(record)
89 ui.link{
90 attr = { class = "action" },
91 text = _"Remove",
92 module = "contact",
93 action = "remove_member",
94 id = record.other_member_id,
95 routing = {
96 default = {
97 mode = "redirect",
98 module = request.get_module(),
99 view = request.get_view(),
100 id = request.get_id_string(),
101 params = request.get_param_strings()
102 }
103 }
104 }
105 end
106 },
107 }
108 }
109 end
110 end
111 }
113 end }
114 end }
115 end }
116 end }

Impressum / About Us