annotate app/main/interest/_show_box.lua @ 548:8af806af86a0
Added issue related preloading to issue show and initiative view
author |
bsw |
date |
Tue May 29 20:45:58 2012 +0200 (2012-05-29) |
parents |
5ca9de94cb13 |
children |
c1dc3b14a4f3 |
rev |
line source |
bsw/jbe@0
|
1
|
bsw/jbe@0
|
2 local issue = param.get("issue", "table")
|
bsw@339
|
3 local initiative = param.get("initiative", "table")
|
bsw/jbe@0
|
4
|
bsw/jbe@4
|
5 local interest = Interest:by_pk(issue.id, app.session.member.id)
|
bsw@173
|
6 local membership = Membership:by_pk(issue.area_id, app.session.member_id)
|
bsw/jbe@0
|
7
|
bsw@525
|
8 if interest then
|
bsw/jbe@0
|
9
|
bsw@529
|
10 if issue.closed then
|
bsw@529
|
11 ui.tag{ content = _"You were interested" }
|
bsw@529
|
12 else
|
bsw@529
|
13 ui.tag{ content = _"You are interested" }
|
bsw@529
|
14 end
|
bsw@525
|
15 slot.put(" ")
|
bsw@277
|
16
|
bsw@525
|
17 if issue.state ~= "finished" and issue.state ~= "cancelled" and issue.state ~= "voting" then
|
bsw@525
|
18 slot.put("(")
|
bsw@525
|
19 ui.link{
|
bsw@525
|
20 text = _"Withdraw",
|
bsw@525
|
21 module = "interest",
|
bsw@525
|
22 action = "update",
|
bsw@525
|
23 params = { issue_id = issue.id, delete = true },
|
bsw@528
|
24 routing = {
|
bsw@528
|
25 default = {
|
bsw@528
|
26 mode = "redirect",
|
bsw@528
|
27 module = request.get_module(),
|
bsw@528
|
28 view = request.get_view(),
|
bsw@528
|
29 id = param.get_id_cgi(),
|
bsw@528
|
30 params = param.get_all_cgi()
|
bsw@528
|
31 }
|
bsw@528
|
32 }
|
bsw/jbe@4
|
33 }
|
bsw@525
|
34 slot.put(") ")
|
bsw@16
|
35 end
|
bsw@525
|
36 elseif app.session.member:has_voting_right_for_unit_id(issue.area.unit_id) then
|
bsw@525
|
37 if not issue.closed and not issue.fully_frozen then
|
bsw@525
|
38 ui.link{
|
bsw@525
|
39 text = _"Add my interest",
|
bsw@525
|
40 module = "interest",
|
bsw@525
|
41 action = "update",
|
bsw@525
|
42 params = { issue_id = issue.id },
|
bsw@528
|
43 routing = {
|
bsw@528
|
44 default = {
|
bsw@528
|
45 mode = "redirect",
|
bsw@528
|
46 module = request.get_module(),
|
bsw@528
|
47 view = request.get_view(),
|
bsw@528
|
48 id = param.get_id_cgi(),
|
bsw@528
|
49 params = param.get_all_cgi()
|
bsw@528
|
50 }
|
bsw@528
|
51 }
|
bsw@525
|
52 }
|
bsw@525
|
53 slot.put(" ")
|
bsw@525
|
54 end
|
bsw@525
|
55 end
|