liquid_feedback_frontend
view app/main/contact/_list.lua @ 0:3bfb2fcf7ab9
Version alpha1
author | bsw/jbe |
---|---|
date | Wed Nov 18 12:00:00 2009 +0100 (2009-11-18) |
parents | |
children | 80c215dbf076 |
line source
2 local contacts_selector = Contact:new_selector()
3 :add_where{ "member_id = ?", app.session.member.id }
4 :join("member", nil, "member.id = contact.other_member_id")
5 :add_order_by("member.login")
7 ui.paginate{
8 selector = contacts_selector,
9 content = function()
10 local contacts = contacts_selector:exec()
11 if #contacts == 0 then
12 ui.field.text{ value = _"You didn't saved any member as contact yet." }
13 else
14 ui.list{
15 records = contacts,
16 columns = {
17 {
18 label = _"Login",
19 content = function(record)
20 ui.link{
21 text = record.other_member.login,
22 module = "member",
23 view = "show",
24 id = record.other_member_id
25 }
26 end
27 },
28 {
29 label = _"Name",
30 content = function(record)
31 ui.link{
32 text = record.other_member.name,
33 module = "member",
34 view = "show",
35 id = record.other_member_id
36 }
37 end
38 },
39 {
40 label = _"Published",
41 content = function(record)
42 ui.field.boolean{ value = record.public }
43 end
44 },
45 {
46 content = function(record)
47 if record.public then
48 ui.link{
49 attr = { class = "action" },
50 text = _"Hide",
51 module = "contact",
52 action = "add_member",
53 id = record.other_member_id,
54 params = { public = false },
55 routing = {
56 default = {
57 mode = "redirect",
58 module = request.get_module(),
59 view = request.get_view(),
60 id = param.get_id_cgi(),
61 params = param.get_all_cgi()
62 }
63 }
64 }
65 else
66 ui.link{
67 attr = { class = "action" },
68 text = _"Publish",
69 module = "contact",
70 action = "add_member",
71 id = record.other_member_id,
72 params = { public = true },
73 routing = {
74 default = {
75 mode = "redirect",
76 module = request.get_module(),
77 view = request.get_view(),
78 id = param.get_id_cgi(),
79 params = param.get_all_cgi()
80 }
81 }
82 }
83 end
84 end
85 },
86 {
87 content = function(record)
88 ui.link{
89 attr = { class = "action" },
90 text = _"Remove",
91 module = "contact",
92 action = "remove_member",
93 id = record.other_member_id,
94 routing = {
95 default = {
96 mode = "redirect",
97 module = request.get_module(),
98 view = request.get_view(),
99 id = param.get_id_cgi(),
100 params = param.get_all_cgi()
101 }
102 }
103 }
104 end
105 },
106 {
107 content = function(record)
108 ui.link{
109 attr = { class = "action" },
110 text = _"Global delegation",
111 module = "delegation",
112 action = "update",
113 params = {
114 trustee_id = record.other_member_id,
115 },
116 routing = {
117 default = {
118 mode = "redirect",
119 module = request.get_module(),
120 view = request.get_view(),
121 id = param.get_id_cgi(),
122 params = param.get_all_cgi()
123 }
124 }
125 }
126 end
127 }
128 }
129 }
130 end
131 end
132 }