annotate app/main/interest/_show_box.lua @ 356:7ee7ec1b10fc
Fix link to area list in navigation (single unit mode)
 | author | 
 bsw | 
 | date | 
 Wed Feb 29 20:31:21 2012 +0100 (2012-02-29) | 
 | parents | 
 f8481330f4c2  | 
 | children | 
 63d6549cc00b  | 
 
 | 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@277
 | 
     8 slot.select("interest", function()
 | 
| 
bsw@277
 | 
     9   if interest then
 | 
| 
bsw/jbe@0
 | 
    10 
 | 
| 
bsw/jbe@0
 | 
    11   ui.container{
 | 
| 
bsw/jbe@0
 | 
    12     content = function()
 | 
| 
bsw/jbe@4
 | 
    13         ui.container{
 | 
| 
bsw/jbe@4
 | 
    14           attr = { 
 | 
| 
bsw@243
 | 
    15             class = "head head_active",
 | 
| 
bsw/jbe@4
 | 
    16           },
 | 
| 
bsw/jbe@4
 | 
    17           content = function()
 | 
| 
bsw/jbe@5
 | 
    18             ui.image{
 | 
| 
bsw/jbe@5
 | 
    19               static = "icons/16/eye.png"
 | 
| 
bsw/jbe@5
 | 
    20             }
 | 
| 
bsw/jbe@4
 | 
    21             slot.put(_"Your are interested")
 | 
| 
bsw/jbe@19
 | 
    22 
 | 
| 
bsw/jbe@4
 | 
    23           end
 | 
| 
bsw/jbe@0
 | 
    24         }
 | 
| 
bsw@277
 | 
    25 
 | 
| 
bsw@277
 | 
    26         if issue.state ~= "finished" and issue.state ~= "cancelled" and issue.state ~= "voting" then
 | 
| 
bsw@277
 | 
    27           ui.link{
 | 
| 
bsw@277
 | 
    28             image   = { static = "icons/16/cross.png" },
 | 
| 
bsw@277
 | 
    29             text    = _"Withdraw interest",
 | 
| 
bsw@277
 | 
    30             module  = "interest",
 | 
| 
bsw@277
 | 
    31             action  = "update",
 | 
| 
bsw@277
 | 
    32             params  = { issue_id = issue.id, delete = true },
 | 
| 
bsw@339
 | 
    33             routing = { default = { mode = "redirect", module = initiative and "initiative" or "issue", view = "show", id = initiative and initiative.id or issue.id } }
 | 
| 
bsw@277
 | 
    34           }
 | 
| 
bsw@277
 | 
    35         end
 | 
| 
bsw/jbe@0
 | 
    36       end
 | 
| 
bsw/jbe@4
 | 
    37     }
 | 
| 
bsw@281
 | 
    38   elseif app.session.member:has_voting_right_for_unit_id(issue.area.unit_id) then
 | 
| 
bsw@277
 | 
    39     if not issue.closed and not issue.fully_frozen then
 | 
| 
bsw@277
 | 
    40       ui.link{
 | 
| 
bsw@277
 | 
    41         image   = { static = "icons/16/user_add.png" },
 | 
| 
bsw@277
 | 
    42         text    = _"Add my interest",
 | 
| 
bsw@277
 | 
    43         module  = "interest",
 | 
| 
bsw@277
 | 
    44         action  = "update",
 | 
| 
bsw@277
 | 
    45         params  = { issue_id = issue.id },
 | 
| 
bsw@339
 | 
    46         routing = { default = { mode = "redirect", module = initiative and "initiative" or "issue", view = "show", id = initiative and initiative.id or issue.id } }
 | 
| 
bsw@277
 | 
    47       }
 | 
| 
bsw@277
 | 
    48     end
 | 
| 
bsw@16
 | 
    49   end
 | 
| 
bsw@277
 | 
    50 end)
 |