liquid_feedback_frontend
view app/main/issue/_show_head.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 | bde068b37608 |
children | b77e6a17ca77 |
line source
1 local issue = param.get("issue", "table")
2 local initiative = param.get("initiative", "table")
4 local direct_voter
6 if app.session.member_id then
7 direct_voter = DirectVoter:by_pk(issue.id, app.session.member.id)
8 end
10 if config.feature_rss_enabled then
11 util.html_rss_head{ title = _"Initiatives in this issue (last created first)", module = "initiative", view = "list_rss", params = { issue_id = issue.id } }
12 util.html_rss_head{ title = _"Initiatives in this issue (last updated first)", module = "initiative", view = "list_rss", params = { issue_id = issue.id, order = "last_updated" } }
13 end
15 slot.select("title", function()
16 ui.link{
17 content = _("Issue ##{id}", { id = issue.id }),
18 module = "issue",
19 view = "show",
20 id = issue.id
21 }
22 slot.put(" · ")
23 ui.link{
24 content = issue.area.name,
25 module = "area",
26 view = "show",
27 id = issue.area.id
28 }
29 if not config.single_unit_id then
30 slot.put(" · ")
31 ui.link{
32 content = issue.area.unit.name,
33 module = "area",
34 view = "list",
35 params = { unit_id = issue.area.unit_id }
36 }
37 end
38 end)
41 slot.select("title2", function()
42 ui.tag{
43 tag = "div",
44 content = function()
46 ui.link{
47 text = issue.policy.name,
48 module = "policy",
49 view = "show",
50 id = issue.policy.id
51 }
53 slot.put(" · ")
54 ui.tag{ content = issue.state_name }
56 if issue.state_time_left then
57 slot.put(" · ")
58 ui.tag{ content = _("#{time_left} left", { time_left = issue.state_time_left }) }
59 end
61 end
62 }
65 end)
67 slot.select("actions", function()
69 if app.session.member_id then
71 if issue.state == 'voting' then
72 local text
73 if not direct_voter then
74 text = _"Vote now"
75 else
76 text = _"Change vote"
77 end
78 ui.link{
79 content = function()
80 ui.image{ static = "icons/16/email_open.png" }
81 slot.put(text)
82 end,
83 module = "vote",
84 view = "list",
85 params = { issue_id = issue.id }
86 }
87 end
89 execute.view{
90 module = "interest",
91 view = "_show_box",
92 params = { issue = issue }
93 }
95 if not issue.closed then
96 execute.view{
97 module = "delegation",
98 view = "_show_box",
99 params = { issue_id = issue.id,
100 initiative_id = initiative and initiative.id or nil}
101 }
102 end
104 end
106 if config.issue_discussion_url_func then
107 local url = config.issue_discussion_url_func(issue)
108 ui.link{
109 attr = { target = "_blank" },
110 external = url,
111 content = function()
112 ui.image{ static = "icons/16/comments.png" }
113 slot.put(_"Discussion on issue")
114 end,
115 }
116 end
117 end)
119 if app.session.member_id then
120 slot.select("actions", function()
121 if not issue.fully_frozen and not issue.closed then
122 ui.link{
123 image = { static = "icons/16/script_add.png" },
124 attr = { class = "action" },
125 text = _"Create alternative initiative",
126 module = "initiative",
127 view = "new",
128 params = { issue_id = issue.id }
129 }
130 end
131 end)
132 end
134 local issue = param.get("issue", "table")
136 if config.public_access_issue_head and not app.session.member_id then
137 config.public_access_issue_head(issue)
138 end
140 if app.session.member_id and issue.state == 'voting' and not direct_voter then
141 ui.container{
142 attr = { class = "voting_active_info" },
143 content = function()
144 slot.put(_"Voting for this issue is currently running!")
145 slot.put(" ")
146 if app.session.member_id then
147 ui.link{
148 content = function()
149 slot.put(_"Vote now")
150 end,
151 module = "vote",
152 view = "list",
153 params = { issue_id = issue.id }
154 }
155 end
156 end
157 }
158 slot.put("<br />")
159 end