liquid_feedback_frontend
view app/main/unit/_head.lua @ 820:944d1fe51ecd
Going to version 2.0.2
| author | bsw | 
|---|---|
| date | Fri Jul 06 22:58:49 2012 +0200 (2012-07-06) | 
| parents | b68880106e7e | 
| children | 701a5cf6b067 | 
 line source
     1 local unit = param.get("unit", "table")
     2 local member = param.get("member", "table")
     4 local show_content = param.get("show_content", atom.boolean)
     6 if app.session.member_id then
     7   unit:load_delegation_info_once_for_member_id(app.session.member_id)
     8 end
    10 ui.container{ attr = { class = "unit_head" }, content = function()
    12   execute.view{ module = "delegation", view = "_info", params = { unit = unit, member = member } }
    14   ui.container{ attr = { class = "title" }, content = function()
    15     if not config.single_unit_id then
    16       ui.link{ 
    17         module = "unit", view = "show", id = unit.id,
    18         attr = { class = "unit_name" }, content = unit.name
    19       }
    20     else
    21       ui.link{ 
    22         module = "unit", view = "show", id = unit.id,
    23         attr = { class = "unit_name" }, content = _"LiquidFeedback" .. " · " .. config.instance_name
    24       }
    25     end
    26   end }
    28   if show_content then
    29     ui.container{ attr = { class = "content" }, content = function()
    31       if member and member:has_voting_right_for_unit_id(unit.id) then
    32         if app.session.member_id == member.id then
    33           ui.tag{ content = _"You have voting privileges for this unit" }
    34           slot.put(" · ")
    35           if unit.delegation_info.first_trustee_id == nil then
    36             ui.link{ text = _"Delegate unit", module = "delegation", view = "show", params = { unit_id = unit.id } }
    37           else
    38             ui.link{ text = _"Change unit delegation", module = "delegation", view = "show", params = { unit_id = unit.id } }
    39           end
    40         else
    41           ui.tag{ content = _"Member has voting privileges for this unit" }
    42         end
    43       end
    44     end }
    45   else
    46     slot.put("<br />")
    47   end
    49 end }
