liquid_feedback_frontend

view app/main/supporter/_show_box.lua @ 278:fecd4c13054a

Code/css clean up and minor enhancements
author bsw
date Mon Feb 13 01:53:41 2012 +0100 (2012-02-13)
parents 1783a0c61734
children 808269b7f41c
line source
1 local initiative = param.get("initiative", "table") or Initiative:by_id(param.get_id())
3 -- TODO performance
4 local initiator = Initiator:by_pk(initiative.id, app.session.member.id)
6 ui.partial{
7 module = "initiative",
8 view = "show_support",
9 id = initiative.id,
10 target = "initiative_" .. tostring(initiative.id) .. "_support",
11 content = function()
13 ui.container{
14 attr = { class = "actions" },
15 content = function()
17 local initiative = param.get("initiative", "table")
18 local supporter = Supporter:by_pk(initiative.id, app.session.member.id)
20 local partial = {
21 routing = {
22 default = {
23 mode = "redirect",
24 module = "initiative",
25 view = "show_support",
26 id = initiative.id
27 }
28 }
29 }
31 local routing = {
32 default = {
33 mode = "redirect",
34 module = request.get_module(),
35 view = request.get_view(),
36 id = param.get_id_cgi(),
37 params = param.get_all_cgi()
38 }
39 }
41 if not initiative.issue.fully_frozen and not initiative.issue.closed then
42 if supporter then
43 if not supporter:has_critical_opinion() then
44 ui.container{ attr = { class = "supporter" }, content = function()
45 ui.image{
46 static = "icons/16/thumb_up_green.png"
47 }
48 slot.put(_"Your are supporter")
49 end }
50 else
51 ui.tag{ attr = { class = "potential_supporter" }, content = function()
52 ui.image{
53 static = "icons/16/thumb_up.png"
54 }
55 slot.put(_"Your are potential supporter")
56 end }
57 end
58 ui.link{
59 image = { static = "icons/16/cross.png" },
60 text = _"Withdraw support",
61 module = "initiative",
62 action = "remove_support",
63 id = initiative.id,
64 routing = routing,
65 partial = partial
66 }
67 else
69 if not initiative.revoked then
70 local params = param.get_all_cgi()
71 params.dyn = nil
72 ui.link{
73 image = { static = "icons/16/thumb_up_green.png" },
74 text = _"Support this initiative",
75 module = "initiative",
76 action = "add_support",
77 id = initiative.id,
78 routing = routing,
79 partial = partial
80 }
81 end
82 end
83 end
86 if (initiative.discussion_url and #initiative.discussion_url > 0) then
87 if initiative.discussion_url:find("^https?://") then
88 if initiative.discussion_url and #initiative.discussion_url > 0 then
89 ui.link{
90 attr = {
91 target = "_blank",
92 title = _"Discussion with initiators"
93 },
94 image = { static = "icons/16/comments.png" },
95 text = _"Discuss with initiators",
96 external = initiative.discussion_url
97 }
98 end
99 else
100 slot.put(encode.html(initiative.discussion_url))
101 end
102 end
103 if initiator and initiator.accepted and not initiative.issue.half_frozen and not initiative.issue.closed and not initiative.revoked then
104 ui.link{
105 image = { static = "icons/16/comments.png" },
106 text = _"change discussion URL",
107 module = "initiative",
108 view = "edit",
109 id = initiative.id
110 }
111 end
112 end
113 }
114 slot.put("<div style='clear: left;'></div>")
115 end
116 }

Impressum / About Us