liquid_feedback_frontend

view app/main/member/show.lua @ 813:ea2449916c12

Cleaned up public access levels
author bsw
date Fri Jul 06 13:58:20 2012 +0200 (2012-07-06)
parents 2ad52d0067eb
children 701a5cf6b067
line source
1 local member = Member:by_id(param.get_id())
3 if not member or not member.activated then
4 error("access denied")
5 end
7 app.html_title.title = member.name
8 app.html_title.subtitle = _("Member")
10 slot.select("head", function()
11 ui.container{
12 attr = { class = "title" },
13 content = _("Member '#{member}'", { member = member.name })
14 }
16 ui.container{ attr = { class = "actions" }, content = function()
18 if member.id == app.session.member_id then
19 ui.link{
20 content = function()
21 slot.put(encode.html(_"Edit profile"))
22 end,
23 module = "member",
24 view = "edit"
25 }
26 slot.put(" · ")
27 ui.link{
28 content = function()
29 slot.put(encode.html(_"Upload avatar/photo"))
30 end,
31 module = "member",
32 view = "edit_images"
33 }
34 slot.put(" · ")
35 end
36 ui.link{
37 content = function()
38 slot.put(encode.html(_"Show member history"))
39 end,
40 module = "member",
41 view = "history",
42 id = member.id
43 }
44 if not member.active then
45 slot.put(" · ")
46 ui.tag{
47 attr = { class = "interest deactivated_member_info" },
48 content = _"This member is inactive"
49 }
50 end
51 if member.locked then
52 slot.put(" · ")
53 ui.tag{
54 attr = { class = "interest deactivated_member_info" },
55 content = _"This member is locked"
56 }
57 end
58 if app.session.member_id and not (member.id == app.session.member.id) then
59 slot.put(" · ")
60 --TODO performance
61 local contact = Contact:by_pk(app.session.member.id, member.id)
62 if contact then
63 ui.link{
64 text = _"Remove from contacts",
65 module = "contact",
66 action = "remove_member",
67 id = contact.other_member_id,
68 routing = {
69 default = {
70 mode = "redirect",
71 module = request.get_module(),
72 view = request.get_view(),
73 id = param.get_id_cgi(),
74 params = param.get_all_cgi()
75 }
76 }
77 }
78 elseif member.activated then
79 ui.link{
80 text = _"Add to my contacts",
81 module = "contact",
82 action = "add_member",
83 id = member.id,
84 routing = {
85 default = {
86 mode = "redirect",
87 module = request.get_module(),
88 view = request.get_view(),
89 id = param.get_id_cgi(),
90 params = param.get_all_cgi()
91 }
92 }
93 }
94 end
95 end
96 if app.session.member_id then
97 local ignored_member = IgnoredMember:by_pk(app.session.member.id, member.id)
98 slot.put(" · ")
99 if ignored_member then
100 ui.tag{
101 attr = { class = "interest" },
102 content = _"You have ignored this member"
103 }
104 slot.put(" · ")
105 ui.link{
106 text = _"Stop ignoring member",
107 module = "member",
108 action = "update_ignore_member",
109 id = member.id,
110 params = { delete = true },
111 routing = {
112 default = {
113 mode = "redirect",
114 module = request.get_module(),
115 view = request.get_view(),
116 id = param.get_id_cgi(),
117 params = param.get_all_cgi()
118 }
119 }
120 }
121 elseif member.activated then
122 ui.link{
123 attr = { class = "interest" },
124 text = _"Ignore member",
125 module = "member",
126 action = "update_ignore_member",
127 id = member.id,
128 routing = {
129 default = {
130 mode = "redirect",
131 module = request.get_module(),
132 view = request.get_view(),
133 id = param.get_id_cgi(),
134 params = param.get_all_cgi()
135 }
136 }
137 }
138 end
139 end
140 end }
141 end)
143 util.help("member.show", _"Member page")
145 execute.view{
146 module = "member",
147 view = "_show",
148 params = { member = member }
149 }

Impressum / About Us