annotate app/main/unit/_head.lua @ 582:09a91ebcbb8c
Correctly display discussion and pad links
 | author | 
 bsw | 
 | date | 
 Wed Jun 20 14:24:27 2012 +0200 (2012-06-20) | 
 | parents | 
 5ca9de94cb13  | 
 | children | 
 f52f918b38b8  | 
 
 | rev | 
   line source | 
| 
bsw@525
 | 
     1 local unit = param.get("unit", "table")
 | 
| 
bsw@525
 | 
     2 
 | 
| 
bsw@529
 | 
     3 local show_content = param.get("show_content", atom.boolean)
 | 
| 
bsw@529
 | 
     4 
 | 
| 
bsw@529
 | 
     5 unit:load_delegation_info_once_for_member_id(app.session.member_id)
 | 
| 
bsw@529
 | 
     6 
 | 
| 
bsw@526
 | 
     7 ui.container{ attr = { class = "unit_head" }, content = function()
 | 
| 
bsw@525
 | 
     8 
 | 
| 
bsw@526
 | 
     9   execute.view{ module = "delegation", view = "_info", params = { unit = unit } }
 | 
| 
bsw@525
 | 
    10 
 | 
| 
bsw@526
 | 
    11   ui.container{ attr = { class = "title" }, content = function()
 | 
| 
bsw@526
 | 
    12     if not config.single_unit_id then
 | 
| 
bsw@526
 | 
    13       ui.link{ 
 | 
| 
bsw@526
 | 
    14         module = "unit", view = "show", id = unit.id,
 | 
| 
bsw@526
 | 
    15         attr = { class = "unit_name" }, content = unit.name
 | 
| 
bsw@526
 | 
    16       }
 | 
| 
bsw@526
 | 
    17     else
 | 
| 
bsw@526
 | 
    18       ui.link{ 
 | 
| 
bsw@526
 | 
    19         module = "unit", view = "show", id = unit.id,
 | 
| 
bsw@526
 | 
    20         attr = { class = "unit_name" }, content = config.app_title
 | 
| 
bsw@526
 | 
    21       }
 | 
| 
bsw@526
 | 
    22     end
 | 
| 
bsw@525
 | 
    23   end }
 | 
| 
bsw@525
 | 
    24 
 | 
| 
bsw@529
 | 
    25   if show_content then
 | 
| 
bsw@529
 | 
    26     ui.container{ attr = { class = "content" }, content = function()
 | 
| 
bsw@526
 | 
    27 
 | 
| 
bsw@529
 | 
    28       if app.session.member_id and app.session.member:has_voting_right_for_unit_id(unit.id) then
 | 
| 
bsw@529
 | 
    29         ui.tag{ content = _"You have voting privileges for this unit" }
 | 
| 
bsw@529
 | 
    30         slot.put(" · ")
 | 
| 
bsw@529
 | 
    31         if unit.delegation_info.first_trustee_id == nil then
 | 
| 
bsw@529
 | 
    32           ui.link{ text = _"Delegate unit", module = "delegation", view = "show", params = { unit_id = unit.id } }
 | 
| 
bsw@529
 | 
    33         else
 | 
| 
bsw@529
 | 
    34           ui.link{ text = _"Change unit delegation", module = "delegation", view = "show", params = { unit_id = unit.id } }
 | 
| 
bsw@529
 | 
    35         end
 | 
| 
bsw@529
 | 
    36       end
 | 
| 
bsw@529
 | 
    37     end }
 | 
| 
bsw@529
 | 
    38   else
 | 
| 
bsw@529
 | 
    39     slot.put("<br />")
 | 
| 
bsw@529
 | 
    40   end
 | 
| 
bsw@529
 | 
    41     
 | 
| 
bsw@526
 | 
    42 end }
 |