annotate app/main/delegation/_list.lua @ 178:bf799314a20f
Highlight the current member itself too
 | author | 
 bsw | 
 | date | 
 Sun Oct 31 20:12:20 2010 +0100 (2010-10-31) | 
 | parents | 
 5c601807d397  | 
 | children | 
 19fbc5c758b5  | 
 
 | rev | 
   line source | 
| 
bsw@2
 | 
     1 local delegations_selector = param.get("delegations_selector", "table")
 | 
| 
bsw@2
 | 
     2 local outgoing = param.get("outgoing", atom.boolean)
 | 
| 
bsw@2
 | 
     3 local incoming = param.get("incoming", atom.boolean)
 | 
| 
bsw@2
 | 
     4 
 | 
| 
bsw@2
 | 
     5 local function delegation_scope(delegation)
 | 
| 
bsw@2
 | 
     6   ui.container{
 | 
| 
bsw@2
 | 
     7     attr = { class = "delegation_scope" },
 | 
| 
bsw@2
 | 
     8     content = function()
 | 
| 
bsw@2
 | 
     9       local area
 | 
| 
bsw@2
 | 
    10       if delegation.issue then
 | 
| 
bsw@2
 | 
    11         area = delegation.issue.area
 | 
| 
bsw@2
 | 
    12       else
 | 
| 
bsw@2
 | 
    13         area = delegation.area
 | 
| 
bsw@2
 | 
    14       end
 | 
| 
bsw@2
 | 
    15       if not area then
 | 
| 
bsw@2
 | 
    16         ui.field.text{ value = _"Global delegation" }
 | 
| 
bsw@2
 | 
    17       end
 | 
| 
bsw@2
 | 
    18       if area then
 | 
| 
bsw@2
 | 
    19         ui.link{
 | 
| 
bsw@2
 | 
    20           content = _"Area '#{name}'":gsub("#{name}", area.name),
 | 
| 
bsw@2
 | 
    21           module = "area",
 | 
| 
bsw@2
 | 
    22           view = "show",
 | 
| 
bsw@2
 | 
    23           id = area.id
 | 
| 
bsw@2
 | 
    24         }
 | 
| 
bsw@2
 | 
    25       end
 | 
| 
bsw@2
 | 
    26       if delegation.issue then
 | 
| 
bsw@2
 | 
    27         ui.link{
 | 
| 
bsw@2
 | 
    28           content = _"Issue ##{id}":gsub("#{id}", delegation.issue.id),
 | 
| 
bsw@2
 | 
    29           module = "issue",
 | 
| 
bsw@2
 | 
    30           view = "show",
 | 
| 
bsw@2
 | 
    31           id = delegation.issue.id
 | 
| 
bsw@2
 | 
    32         }
 | 
| 
bsw@2
 | 
    33       end
 | 
| 
bsw@2
 | 
    34     end
 | 
| 
bsw@2
 | 
    35   }
 | 
| 
bsw@2
 | 
    36 end
 | 
| 
bsw@2
 | 
    37 
 | 
| 
bsw/jbe@0
 | 
    38 
 | 
| 
bsw/jbe@0
 | 
    39 ui.paginate{
 | 
| 
bsw@2
 | 
    40   selector = delegations_selector,
 | 
| 
bsw/jbe@0
 | 
    41   content = function()
 | 
| 
bsw@2
 | 
    42     for i, delegation in ipairs(delegations_selector:exec()) do
 | 
| 
bsw@2
 | 
    43       ui.container{
 | 
| 
bsw@2
 | 
    44         attr = { class = "delegation_list_entry" },
 | 
| 
bsw@2
 | 
    45         content = function()
 | 
| 
bsw@2
 | 
    46           if outgoing then
 | 
| 
bsw@2
 | 
    47             delegation_scope(delegation)
 | 
| 
bsw@2
 | 
    48           else
 | 
| 
bsw@2
 | 
    49             execute.view{
 | 
| 
bsw/jbe@0
 | 
    50               module = "member",
 | 
| 
bsw@2
 | 
    51               view = "_show_thumb",
 | 
| 
bsw@2
 | 
    52               params = { member = delegation.truster }
 | 
| 
bsw/jbe@0
 | 
    53             }
 | 
| 
bsw/jbe@0
 | 
    54           end
 | 
| 
bsw@2
 | 
    55           ui.image{
 | 
| 
bsw@2
 | 
    56             attr = { class = "delegation_arrow" },
 | 
| 
bsw@2
 | 
    57             static = "delegation_arrow.jpg"
 | 
| 
bsw@2
 | 
    58           }
 | 
| 
bsw@2
 | 
    59           if incoming then
 | 
| 
bsw@2
 | 
    60             delegation_scope(delegation)
 | 
| 
bsw@2
 | 
    61           else
 | 
| 
bsw@2
 | 
    62             execute.view{
 | 
| 
bsw/jbe@0
 | 
    63               module = "member",
 | 
| 
bsw@2
 | 
    64               view = "_show_thumb",
 | 
| 
bsw@2
 | 
    65               params = { member = delegation.trustee }
 | 
| 
bsw/jbe@0
 | 
    66             }
 | 
| 
bsw/jbe@0
 | 
    67           end
 | 
| 
bsw@2
 | 
    68         end
 | 
| 
bsw/jbe@0
 | 
    69       }
 | 
| 
bsw@2
 | 
    70     end
 | 
| 
bsw@2
 | 
    71     slot.put("<br style='clear: left;' />")
 | 
| 
bsw/jbe@0
 | 
    72   end
 | 
| 
bsw/jbe@0
 | 
    73 }
 |