| rev | 
   line source | 
| 
bsw@215
 | 
     1 slot.set_layout("lf2")
 | 
| 
bsw@215
 | 
     2 
 | 
| 
bsw@216
 | 
     3 slot.put_into("leftright_pre", '<div class="sidebar_right">')
 | 
| 
bsw@216
 | 
     4 slot.put_into("leftright_post", '</div>')
 | 
| 
bsw@215
 | 
     5 
 | 
| 
bsw@216
 | 
     6 local issue = Issue:by_id(param.get("issue_id", atom.integer))
 | 
| 
bsw@216
 | 
     7 local member = Member:by_id(param.get("member_id", atom.integer))
 | 
| 
bsw@215
 | 
     8 
 | 
| 
bsw@215
 | 
     9 local area = issue.area
 | 
| 
bsw@215
 | 
    10 
 | 
| 
bsw@215
 | 
    11 -- TODO broken
 | 
| 
bsw@215
 | 
    12 --issue:load("interested_members_snapshot", {}, "interested_members")
 | 
| 
bsw@216
 | 
    13 issue:load("delegating_interest_snapshot_for_member", { member_id = member.id }, "delegating_interest")
 | 
| 
bsw@216
 | 
    14 issue:load("interest_for_member", { member_id = member.id }, "interest")
 | 
| 
bsw@216
 | 
    15 issue:load("outgoing_delegations_for_member", { member_id = member.id }, "outgoing_delegations")
 | 
| 
bsw@216
 | 
    16 issue:load("trusters_for_member", { member_id = member.id }, "trusters")
 | 
| 
bsw@215
 | 
    17 
 | 
| 
bsw@215
 | 
    18 local initiatives = issue.initiatives
 | 
| 
bsw@215
 | 
    19 
 | 
| 
bsw@216
 | 
    20 local supported_initiatives = Initiative:new_selector()
 | 
| 
bsw@216
 | 
    21   :add_where{ "initiative.issue_id = ?", issue.id }
 | 
| 
bsw@216
 | 
    22   :join("supporter", nil, { "supporter.initiative_id = initiative.id AND supporter.member_id = ?", member.id })
 | 
| 
bsw@216
 | 
    23   :exec()
 | 
| 
bsw@216
 | 
    24 
 | 
| 
bsw@215
 | 
    25 
 | 
| 
bsw@215
 | 
    26 local interest = issue.interest
 | 
| 
bsw@215
 | 
    27 
 | 
| 
bsw@215
 | 
    28 local delegations = issue.delegations
 | 
| 
bsw@215
 | 
    29 
 | 
| 
bsw@215
 | 
    30 local trustees = Member:new_selector()
 | 
| 
bsw@215
 | 
    31   :add_field("delegation_chain.*")
 | 
| 
bsw@223
 | 
    32   :join({ "delegation_chain(?, null, ?, ?)", member.id, issue.area_id, issue_id }, "delegation_chain", "member.id = delegation_chain.member_id")
 | 
| 
bsw@215
 | 
    33   :add_order_by("index")
 | 
| 
bsw@215
 | 
    34   :exec()
 | 
| 
bsw@215
 | 
    35         
 | 
| 
bsw@215
 | 
    36 local global_delegation
 | 
| 
bsw@215
 | 
    37 local area_delegation
 | 
| 
bsw@215
 | 
    38 local issue_delegation
 | 
| 
bsw@215
 | 
    39 
 | 
| 
bsw@215
 | 
    40 for i, delegation in ipairs(issue.delegations) do
 | 
| 
bsw@215
 | 
    41   if delegation.scope == "global" then global_delegation = delegation
 | 
| 
bsw@215
 | 
    42   elseif delegation.scope == "area" then area_delegation = delegation
 | 
| 
bsw@215
 | 
    43   elseif delegation.scope == "issue" then issue_delegation = delegation
 | 
| 
bsw@215
 | 
    44   end
 | 
| 
bsw@215
 | 
    45 end
 | 
| 
bsw@215
 | 
    46 
 | 
| 
bsw@215
 | 
    47 local delegation = issue_delegation or area_delegation or global_delegation
 | 
| 
bsw@215
 | 
    48 
 | 
| 
bsw@215
 | 
    49 local delegating_interest = issue.delegating_interest
 | 
| 
bsw@215
 | 
    50 
 | 
| 
bsw@215
 | 
    51 app.topnav_phase = issue.phase
 | 
| 
bsw@215
 | 
    52 app.topnav_area_id = issue.area_id
 | 
| 
bsw@215
 | 
    53 
 | 
| 
bsw@215
 | 
    54 slot.select("sidebar", function()
 | 
| 
bsw@216
 | 
    55   execute.view{ module = "lf2", view = "_sidebar_issue", params = { issue = issue, alternative_initiatives = initiatives } }
 | 
| 
bsw@216
 | 
    56 
 | 
| 
bsw@215
 | 
    57 end)
 | 
| 
bsw@215
 | 
    58 
 | 
| 
bsw@216
 | 
    59 ui.box{ content = function()
 | 
| 
bsw@216
 | 
    60   ui.box_row{ class = "head", content = function() ui.box_col{ class = "head", content = function()
 | 
| 
bsw@216
 | 
    61     ui.link{ module = "lf2", view = "member", id = member.id, content = function()
 | 
| 
bsw@216
 | 
    62       ui.avatar(member)
 | 
| 
bsw@216
 | 
    63       slot.put(" ")
 | 
| 
bsw@216
 | 
    64       ui.tag{ content = member.name }
 | 
| 
bsw@216
 | 
    65     end }
 | 
| 
bsw@216
 | 
    66   end } end }
 | 
| 
bsw@216
 | 
    67   if not member.active then
 | 
| 
bsw@216
 | 
    68     ui.box_row{ class = "head", content = function() ui.box_col{ class = "head", content = function()
 | 
| 
bsw@216
 | 
    69       ui.tag{ content = _"Member is deactivated" }
 | 
| 
bsw@216
 | 
    70     end } end }
 | 
| 
bsw@216
 | 
    71   end
 | 
| 
bsw@216
 | 
    72   ui.box_row{ content = function() ui.box_col{ content = function()
 | 
| 
bsw@216
 | 
    73     if interest then
 | 
| 
bsw@216
 | 
    74       ui.image{ static = "lf2/icon_star.png" }
 | 
| 
bsw@216
 | 
    75       slot.put(" ")
 | 
| 
bsw@216
 | 
    76       ui.tag{ content = _"Member is interested in this issue" }
 | 
| 
bsw@216
 | 
    77     elseif delegating_interest then
 | 
| 
bsw@216
 | 
    78       ui.image{ static = "lf2/icon_delegated_star.png" }
 | 
| 
bsw@216
 | 
    79       slot.put(" ")
 | 
| 
bsw@216
 | 
    80       ui.tag{ content = _"Someone in members delegation chain is interested" }
 | 
| 
bsw@216
 | 
    81     else
 | 
| 
bsw@216
 | 
    82       ui.image{ static = "lf2/icon_star_grey.png" }
 | 
| 
bsw@216
 | 
    83       slot.put(" ")
 | 
| 
bsw@216
 | 
    84       ui.tag{ content = _"Member is not interested" }
 | 
| 
bsw@216
 | 
    85     end
 | 
| 
bsw@216
 | 
    86   end } end }
 | 
| 
bsw@216
 | 
    87   if #trustees > 1 then
 | 
| 
bsw@216
 | 
    88     ui.box_row{ content = function() ui.box_col{ content = function()
 | 
| 
bsw@216
 | 
    89       execute.view{ module = "lf2", view = "_avatars", params = { members = trustees, arrows = true, size = "small", issue_id = issue.id } }
 | 
| 
bsw@216
 | 
    90     end } end }
 | 
| 
bsw@216
 | 
    91   end
 | 
| 
bsw@215
 | 
    92 
 | 
| 
bsw@217
 | 
    93   if statement then
 | 
| 
bsw@217
 | 
    94     ui.box_row{ class = "subhead", content = function() ui.box_col{ class = "head", content = _"Statement about issue" } end }  
 | 
| 
bsw@217
 | 
    95   end
 | 
| 
bsw@217
 | 
    96   
 | 
| 
bsw@217
 | 
    97   if #supported_initiatives > 0 then
 | 
| 
bsw@217
 | 
    98     ui.box_row{ class = "subhead", content = function() ui.box_col{ class = "head", content = _"Supported initiatives" } end }
 | 
| 
bsw@217
 | 
    99     execute.view{ module = "lf2", view = "_initiatives", params = { initiatives = supported_initiatives } }
 | 
| 
bsw@217
 | 
   100   end
 | 
| 
bsw@217
 | 
   101   
 | 
| 
bsw@217
 | 
   102   if #(issue.trusters) > 0 then
 | 
| 
bsw@217
 | 
   103     ui.box_row{ class = "subhead", content = function() ui.box_col{ class = "head", content = _"Incoming delegations" } end }
 | 
| 
bsw@217
 | 
   104     ui.box_row{ content = function() ui.box_col{ content = function()
 | 
| 
bsw@217
 | 
   105       execute.view{ module = "lf2", view = "_avatars", params = { members = issue.trusters, size = "small", issue_id = issue.id } }
 | 
| 
bsw@217
 | 
   106     end } end }
 | 
| 
bsw@217
 | 
   107   end
 | 
| 
bsw@216
 | 
   108 
 | 
| 
bsw@216
 | 
   109 end }
 | 
| 
bsw@216
 | 
   110 
 |