| rev | 
   line source | 
| 
bsw@525
 | 
     1 local unit = param.get("unit", "table")
 | 
| 
bsw@774
 | 
     2 local member = param.get("member", "table")
 | 
| 
bsw@525
 | 
     3 
 | 
| 
bsw@529
 | 
     4 local show_content = param.get("show_content", atom.boolean)
 | 
| 
bsw@529
 | 
     5 
 | 
| 
bsw@814
 | 
     6 if app.session.member_id then
 | 
| 
bsw@814
 | 
     7   unit:load_delegation_info_once_for_member_id(app.session.member_id)
 | 
| 
bsw@814
 | 
     8 end
 | 
| 
bsw@529
 | 
     9 
 | 
| 
bsw@526
 | 
    10 ui.container{ attr = { class = "unit_head" }, content = function()
 | 
| 
bsw@525
 | 
    11 
 | 
| 
bsw@774
 | 
    12   execute.view{ module = "delegation", view = "_info", params = { unit = unit, member = member } }
 | 
| 
bsw@525
 | 
    13 
 | 
| 
bsw@526
 | 
    14   ui.container{ attr = { class = "title" }, content = function()
 | 
| 
bsw@526
 | 
    15     if not config.single_unit_id then
 | 
| 
bsw@526
 | 
    16       ui.link{ 
 | 
| 
bsw@526
 | 
    17         module = "unit", view = "show", id = unit.id,
 | 
| 
bsw@526
 | 
    18         attr = { class = "unit_name" }, content = unit.name
 | 
| 
bsw@526
 | 
    19       }
 | 
| 
bsw@526
 | 
    20     else
 | 
| 
bsw@526
 | 
    21       ui.link{ 
 | 
| 
bsw@526
 | 
    22         module = "unit", view = "show", id = unit.id,
 | 
| 
bsw@729
 | 
    23         attr = { class = "unit_name" }, content = _"LiquidFeedback" .. " · " .. config.instance_name
 | 
| 
bsw@526
 | 
    24       }
 | 
| 
bsw@526
 | 
    25     end
 | 
| 
bsw@525
 | 
    26   end }
 | 
| 
bsw@525
 | 
    27 
 | 
| 
bsw@529
 | 
    28   if show_content then
 | 
| 
bsw@529
 | 
    29     ui.container{ attr = { class = "content" }, content = function()
 | 
| 
bsw@526
 | 
    30 
 | 
| 
bsw@774
 | 
    31       if member and member:has_voting_right_for_unit_id(unit.id) then
 | 
| 
bsw@774
 | 
    32         if app.session.member_id == member.id then
 | 
| 
bsw@774
 | 
    33           ui.tag{ content = _"You have voting privileges for this unit" }
 | 
| 
bsw@774
 | 
    34           slot.put(" · ")
 | 
| 
bsw@774
 | 
    35           if unit.delegation_info.first_trustee_id == nil then
 | 
| 
bsw@774
 | 
    36             ui.link{ text = _"Delegate unit", module = "delegation", view = "show", params = { unit_id = unit.id } }
 | 
| 
bsw@774
 | 
    37           else
 | 
| 
bsw@774
 | 
    38             ui.link{ text = _"Change unit delegation", module = "delegation", view = "show", params = { unit_id = unit.id } }
 | 
| 
bsw@774
 | 
    39           end
 | 
| 
bsw@529
 | 
    40         else
 | 
| 
bsw@774
 | 
    41           ui.tag{ content = _"Member has voting privileges for this unit" }
 | 
| 
bsw@529
 | 
    42         end
 | 
| 
bsw@529
 | 
    43       end
 | 
| 
bsw@529
 | 
    44     end }
 | 
| 
bsw@529
 | 
    45   else
 | 
| 
bsw@529
 | 
    46     slot.put("<br />")
 | 
| 
bsw@529
 | 
    47   end
 | 
| 
bsw@529
 | 
    48     
 | 
| 
bsw@526
 | 
    49 end }
 |