liquid_feedback_frontend
view app/main/initiative/_sidebar_support.lua @ 1083:6639b4188d7d
Fixed initiative link in testing config
| author | bsw | 
|---|---|
| date | Wed Jul 23 23:08:53 2014 +0200 (2014-07-23) | 
| parents | 701a5cf6b067 | 
| children | 
 line source
     1 if not app.session.member then
     2   return
     3 end
     5 local initiative = param.get("initiative", "table")
     7 local initiative_info = initiative.member_info
     8 local issue_info = initiative.issue.member_info
    10 local active_trustee_id
    11 if not issue_info.own_participation then
    12   if issue_info.first_trustee_participation then
    13     active_trustee_id = issue_info.first_trustee_id
    14   elseif issue_info.other_trustee_participation then
    15     active_trustee_id = issue_info.other_trustee_id
    16   end
    17 end
    20 slot.select ( "sidebar", function ()
    22   if 
    23     not initiative.issue.fully_frozen
    24     and not initiative.issue.closed
    25     and (issue_info.own_participation or active_trustee_id)
    26   then
    27     ui.container {
    28       attr = { class = "tab-whatcanido sidebarSection" },
    29       content = function ()
    32         if initiative_info.supported then
    33           ui.heading { level = 1, content = function ()
    34             ui.tag { content = _"I'm supporting this initiative" }
    35             if issue_info.weight then
    36               slot.put ( " " )
    37               ui.link {
    38                 module = "delegation", view = "show_incoming", params = {
    39                   issue_id = initiative.issue_id,
    40                   member_id = app.session.member_id
    41                 },
    42                 content = "+" .. issue_info.weight
    43               }
    44             end
    45           end }
    47         else
    48           ui.heading { level = 1, content = function ()
    49             ui.tag { content = _"I'm interested in this issue" }
    50             if issue_info.weight then
    51               slot.put ( " " )
    52               ui.link {
    53                 module = "delegation", view = "show_incoming", params = {
    54                   issue_id = initiative.issue_id,
    55                   member_id = app.session.member_id
    56                 },
    57                 content = "+" .. issue_info.weight
    58               }
    59             end
    60           end }
    61         end
    63         if active_trustee_id then
    64           ui.tag { content = _"via delegation" }
    65         elseif issue_info.first_trustee_id then
    66           ui.tag { content = _"delegation suspended during discussion" }
    67         end
    68       end
    69     }
    70   end
    72   if 
    73     initiative.issue.fully_frozen and
    74     (issue_info.direct_voted or active_trustee_id)
    75   then
    76     ui.container {
    77       attr = { class = "tab-whatcanido sidebarSection" },
    78       content = function ()
    80         if issue_info.direct_voted then
    81           ui.heading { level = 1, content = _"You have been voted" }
    82           ui.link {
    83             content = _"Show my voting ballot",
    84             module = "vote", view = "list", params = {
    85               issue_id = initiative.issue.id
    86             }
    87           }
    88         else
    91           if active_trustee_id then
    92             ui.heading { level = 1, content = _"You have been voted" }
    93             ui.container { 
    94               content = _"via delegation"
    95             }
    96             ui.link {
    97               content = _"Show voting ballot",
    98               module = "vote", view = "list", params = {
    99                 issue_id = initiative.issue.id, member_id = active_trustee_id
   100               }
   101             }
   102           end
   103         end
   104       end
   105     }
   106   end
   107 end )
