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