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