liquid_feedback_frontend

view app/main/contact/_list.lua @ 124:f740026b1518

add initiator support in delegation

if a delegation is issued from the initiative view, the initiators
from that one are added to the delegation target list. this makes it easier to delegate to the author without the need to add him to the contact list.
author Daniel Poelzleithner <poelzi@poelzi.org>
date Mon Sep 20 20:32:04 2010 +0200 (2010-09-20)
parents 80c215dbf076
children
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.name")
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 = _"Name",
19 content = function(record)
20 ui.link{
21 text = record.other_member.name,
22 module = "member",
23 view = "show",
24 id = record.other_member_id
25 }
26 end
27 },
28 {
29 label = _"Published",
30 content = function(record)
31 ui.field.boolean{ value = record.public }
32 end
33 },
34 {
35 content = function(record)
36 if record.public then
37 ui.link{
38 attr = { class = "action" },
39 text = _"Hide",
40 module = "contact",
41 action = "add_member",
42 id = record.other_member_id,
43 params = { public = false },
44 routing = {
45 default = {
46 mode = "redirect",
47 module = request.get_module(),
48 view = request.get_view(),
49 id = param.get_id_cgi(),
50 params = param.get_all_cgi()
51 }
52 }
53 }
54 else
55 ui.link{
56 attr = { class = "action" },
57 text = _"Publish",
58 module = "contact",
59 action = "add_member",
60 id = record.other_member_id,
61 params = { public = true },
62 routing = {
63 default = {
64 mode = "redirect",
65 module = request.get_module(),
66 view = request.get_view(),
67 id = param.get_id_cgi(),
68 params = param.get_all_cgi()
69 }
70 }
71 }
72 end
73 end
74 },
75 {
76 content = function(record)
77 ui.link{
78 attr = { class = "action" },
79 text = _"Remove",
80 module = "contact",
81 action = "remove_member",
82 id = record.other_member_id,
83 routing = {
84 default = {
85 mode = "redirect",
86 module = request.get_module(),
87 view = request.get_view(),
88 id = param.get_id_cgi(),
89 params = param.get_all_cgi()
90 }
91 }
92 }
93 end
94 },
95 }
96 }
97 end
98 end
99 }

Impressum / About Us