liquid_feedback_frontend
view app/main/interest/_show_box.lua @ 149:d87097d3b6ec
small hint to show the number of alternative initiatives
| author | Daniel Poelzleithner <poelzi@poelzi.org> | 
|---|---|
| date | Fri Oct 08 03:25:59 2010 +0200 (2010-10-08) | 
| parents | 00d1004545f1 | 
| children | ca006681befc | 
 line source
     2 local issue = param.get("issue", "table")
     4 local interest = Interest:by_pk(issue.id, app.session.member.id)
     6 if interest then
     7   slot.select("actions", function()
     9   ui.container{
    10     attr = { class = "interest vote_info"},
    11     content = function()
    12         ui.container{
    13           attr = { 
    14             class = "head head_active" .. (interest.autoreject and " head_autoreject" or ""),
    15             onclick = "document.getElementById('interest_content').style.display = 'block';"
    16           },
    17           content = function()
    18             ui.image{
    19               static = "icons/16/eye.png"
    20             }
    21             slot.put(_"Your are interested")
    23             if interest.autoreject then
    24               ui.image{
    25                 static = "icons/16/thumb_down_red.png"
    26               }
    27             end
    29             ui.image{
    30               static = "icons/16/dropdown.png"
    31             }
    32           end
    33         }
    35         ui.container{
    36           attr = { class = "content", id = "interest_content" },
    37           content = function()
    38             ui.container{
    39               attr = {
    40                 class = "close",
    41                 style = "cursor: pointer;",
    42                 onclick = "document.getElementById('interest_content').style.display = 'none';"
    43               },
    44               content = function()
    45                 ui.image{ static = "icons/16/cross.png" }
    46               end
    47             }
    48             if issue.state ~= "finished" and issue.state ~= "cancelled" and issue.state ~= "voting" then
    49               ui.link{
    50                 text    = _"Remove my interest",
    51                 module  = "interest",
    52                 action  = "update",
    53                 params  = { issue_id = issue.id, delete = true },
    54                 routing = { default = { mode = "redirect", module = "issue", view = "show", id = issue.id } }
    55               }
    56               slot.put("<br />")
    57               slot.put("<br />")
    58             end
    59             if interest.autoreject then
    60               ui.field.text{ value = _"Autoreject is on." }
    61               if issue.state ~= "finished" and issue.state ~= "cancelled" then
    62                 ui.link{
    63                   text    = _"Remove autoreject",
    64                   module  = "interest",
    65                   action  = "update",
    66                   params  = { issue_id = issue.id, autoreject = false },
    67                   routing = { default = { mode = "redirect", module = "issue", view = "show", id = issue.id } }
    68                 }
    69               end
    70             else
    71               ui.field.text{ value = _"Autoreject is off." }
    72               if issue.state ~= "finished" and issue.state ~= "cancelled" then
    73                 ui.link{
    74                   text    = _"Set autoreject",
    75                   module  = "interest",
    76                   action  = "update",
    77                   params  = { issue_id = issue.id, autoreject = true },
    78                   routing = { default = { mode = "redirect", module = "issue", view = "show", id = issue.id } }
    79                 }
    80               end
    81             end
    82           end
    83         }
    84       end
    85     }
    86   end)
    87 else
    88   if not issue.closed and not issue.fully_frozen then
    89     ui.link{
    90       image   = { static = "icons/16/user_add.png" },
    91       text    = _"Add my interest",
    92       module  = "interest",
    93       action  = "update",
    94       params  = { issue_id = issue.id },
    95       routing = { default = { mode = "redirect", module = "issue", view = "show", id = issue.id } }
    96     }
    97   end
    98 end
