annotate app/main/interest/_show_box.lua @ 525:63d6549cc00b
Delegation chain preview improved, better visualisation of current context, code cleanup
| author |
bsw |
| date |
Fri May 18 19:07:07 2012 +0200 (2012-05-18) |
| parents |
f8481330f4c2 |
| children |
305329da1c75 |
| 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@525
|
10 ui.tag{ content = _"Your are interested" }
|
|
bsw@525
|
11 slot.put(" ")
|
|
bsw@277
|
12
|
|
bsw@525
|
13 if issue.state ~= "finished" and issue.state ~= "cancelled" and issue.state ~= "voting" then
|
|
bsw@525
|
14 slot.put("(")
|
|
bsw@525
|
15 ui.link{
|
|
bsw@525
|
16 text = _"Withdraw",
|
|
bsw@525
|
17 module = "interest",
|
|
bsw@525
|
18 action = "update",
|
|
bsw@525
|
19 params = { issue_id = issue.id, delete = true },
|
|
bsw@525
|
20 routing = { default = { mode = "redirect", module = initiative and "initiative" or "issue", view = "show", id = initiative and initiative.id or issue.id } }
|
|
bsw/jbe@4
|
21 }
|
|
bsw@525
|
22 slot.put(") ")
|
|
bsw@16
|
23 end
|
|
bsw@525
|
24 elseif app.session.member:has_voting_right_for_unit_id(issue.area.unit_id) then
|
|
bsw@525
|
25 if not issue.closed and not issue.fully_frozen then
|
|
bsw@525
|
26 ui.link{
|
|
bsw@525
|
27 text = _"Add my interest",
|
|
bsw@525
|
28 module = "interest",
|
|
bsw@525
|
29 action = "update",
|
|
bsw@525
|
30 params = { issue_id = issue.id },
|
|
bsw@525
|
31 routing = { default = { mode = "redirect", module = initiative and "initiative" or "issue", view = "show", id = initiative and initiative.id or issue.id } }
|
|
bsw@525
|
32 }
|
|
bsw@525
|
33 slot.put(" ")
|
|
bsw@525
|
34 end
|
|
bsw@525
|
35 end
|