| rev | 
   line source | 
| 
bsw@1700
 | 
     1 local unit_id = config.single_unit_id or request.get_param{ name = "unit" } or app.single_unit_id
 | 
| 
bsw@1598
 | 
     2 local area_id = config.single_area_id or request.get_param{ name = "area" }
 | 
| 
bsw@1602
 | 
     3 
 | 
| 
bsw@1602
 | 
     4 local initiative = param.get("initiative", "table")
 | 
| 
bsw@1602
 | 
     5 local issue = param.get("issue", "table")
 | 
| 
bsw@1602
 | 
     6 if issue then
 | 
| 
bsw@1602
 | 
     7   area_id = issue.area_id
 | 
| 
bsw@1602
 | 
     8   unit_id = issue.area.unit_id
 | 
| 
bsw@1602
 | 
     9 end
 | 
| 
bsw@1602
 | 
    10 
 | 
| 
bsw/jbe@1309
 | 
    11 if unit_id == "all" then
 | 
| 
bsw/jbe@1309
 | 
    12   unit_id = nil 
 | 
| 
bsw@1598
 | 
    13   area_id = nil
 | 
| 
bsw/jbe@1309
 | 
    14 end
 | 
| 
bsw/jbe@1309
 | 
    15 local unit
 | 
| 
bsw/jbe@1309
 | 
    16 if unit_id then
 | 
| 
bsw/jbe@1309
 | 
    17   unit = Unit:by_id(unit_id)
 | 
| 
bsw/jbe@1309
 | 
    18 end
 | 
| 
bsw/jbe@1309
 | 
    19 if area_id == "all" then
 | 
| 
bsw/jbe@1309
 | 
    20   area_id = nil
 | 
| 
bsw/jbe@1309
 | 
    21 end
 | 
| 
bsw/jbe@1309
 | 
    22 local area
 | 
| 
bsw/jbe@1309
 | 
    23 if area_id then
 | 
| 
bsw/jbe@1309
 | 
    24   area = Area:by_id(area_id)
 | 
| 
bsw/jbe@1309
 | 
    25 end
 | 
| 
bsw@1598
 | 
    26 
 | 
| 
bsw@1598
 | 
    27 if unit then
 | 
| 
bsw@1598
 | 
    28   ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function()
 | 
| 
bsw@1598
 | 
    29     ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
 | 
| 
bsw@1598
 | 
    30       ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = unit.name }
 | 
| 
bsw@1598
 | 
    31       if unit.description and #(unit.description) > 0 then
 | 
| 
bsw@1598
 | 
    32         ui.container{ attr = { class = "mdl-card__subtitle-text" }, content = unit.description }
 | 
| 
bsw@1598
 | 
    33       end
 | 
| 
bsw@1598
 | 
    34       if config.render_external_reference_unit then
 | 
| 
bsw@1598
 | 
    35         config.render_external_reference_unit(unit)
 | 
| 
bsw@1598
 | 
    36       end
 | 
| 
bsw@1598
 | 
    37     end }
 | 
| 
bsw@1598
 | 
    38 
 | 
| 
bsw@1598
 | 
    39 
 | 
| 
bsw@1623
 | 
    40     if not (config.voting_only and config.disable_delegations) and app.session.member_id and (
 | 
| 
bsw@1623
 | 
    41       app.session.member:has_voting_right_for_unit_id(unit.id) 
 | 
| 
bsw@1623
 | 
    42       or app.session.member:has_initiative_right_for_unit_id(unit.id) 
 | 
| 
bsw@1623
 | 
    43     ) then
 | 
| 
bsw@1598
 | 
    44       ui.container{ attr = { class = "mdl-card__actions" }, content = function()
 | 
| 
bsw@1598
 | 
    45           
 | 
| 
bsw@1598
 | 
    46         unit:load_delegation_info_once_for_member_id(app.session.member_id)
 | 
| 
bsw@1598
 | 
    47         
 | 
| 
bsw@1598
 | 
    48         local text
 | 
| 
bsw@1598
 | 
    49         if unit.delegation_info.own_delegation_scope == "unit" then
 | 
| 
bsw@1598
 | 
    50           local member = Member:by_id(unit.delegation_info.first_trustee_id)
 | 
| 
bsw@1598
 | 
    51           ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "forward" }
 | 
| 
bsw@1598
 | 
    52           execute.view{
 | 
| 
bsw@1598
 | 
    53             module = "member",
 | 
| 
bsw@1598
 | 
    54             view = "_show_thumb",
 | 
| 
bsw@1598
 | 
    55             params = {
 | 
| 
bsw@1598
 | 
    56               member = member
 | 
| 
bsw@1598
 | 
    57             }
 | 
| 
bsw@1598
 | 
    58           }
 | 
| 
bsw@1598
 | 
    59           text = _"change delegation..."
 | 
| 
bsw@1598
 | 
    60         else
 | 
| 
bsw@1598
 | 
    61           text = _"delegate..."
 | 
| 
bsw@1598
 | 
    62         end
 | 
| 
bsw@1598
 | 
    63         
 | 
| 
bsw@1598
 | 
    64         ui.link {
 | 
| 
bsw@1598
 | 
    65           attr = { class = "mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--underlined" },
 | 
| 
bsw@1598
 | 
    66           module = "delegation", view = "show", params = {
 | 
| 
bsw@1598
 | 
    67             unit_id = unit.id,
 | 
| 
bsw@1598
 | 
    68           },
 | 
| 
bsw@1598
 | 
    69           content = text
 | 
| 
bsw@1598
 | 
    70         }
 | 
| 
bsw@1598
 | 
    71 
 | 
| 
bsw@1598
 | 
    72       end }
 | 
| 
bsw@1598
 | 
    73     end
 | 
| 
bsw@1598
 | 
    74   end }
 | 
| 
bsw@1598
 | 
    75 end
 | 
| 
bsw@1598
 | 
    76 
 | 
| 
bsw@1596
 | 
    77 if area then
 | 
| 
bsw/jbe@1309
 | 
    78 
 | 
| 
bsw/jbe@1309
 | 
    79   ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function()
 | 
| 
bsw/jbe@1309
 | 
    80     if unit then
 | 
| 
bsw/jbe@1309
 | 
    81       ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
 | 
| 
bsw@1598
 | 
    82         ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = area.name }
 | 
| 
bsw@1598
 | 
    83         if area.description and #(area.description) > 0 then
 | 
| 
bsw@1598
 | 
    84           ui.container{ attr = { class = "mdl-card__subtitle-text" }, content = area.description }
 | 
| 
bsw/jbe@1309
 | 
    85         end
 | 
| 
bsw/jbe@1309
 | 
    86       end }
 | 
| 
bsw/jbe@1309
 | 
    87     end
 | 
| 
bsw@1623
 | 
    88     if not (config.voting_only and config.disable_delegations) and app.session.member_id and (
 | 
| 
bsw@1623
 | 
    89       app.session.member:has_voting_right_for_unit_id(area.unit_id) 
 | 
| 
bsw@1623
 | 
    90       or app.session.member:has_initiative_right_for_unit_id(area.unit_id) 
 | 
| 
bsw@1623
 | 
    91     ) then
 | 
| 
bsw/jbe@1309
 | 
    92       ui.container{ attr = { class = "mdl-card__actions" }, content = function()
 | 
| 
bsw/jbe@1309
 | 
    93           
 | 
| 
bsw@1598
 | 
    94         area:load_delegation_info_once_for_member_id(app.session.member_id)
 | 
| 
bsw@1596
 | 
    95 
 | 
| 
bsw@1598
 | 
    96         local text
 | 
| 
bsw@1598
 | 
    97         if area.delegation_info.own_delegation_scope == "area" then
 | 
| 
bsw@1598
 | 
    98           local member = Member:by_id(area.delegation_info.first_trustee_id)
 | 
| 
bsw@1623
 | 
    99           if member then
 | 
| 
bsw@1623
 | 
   100             ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "forward" }
 | 
| 
bsw@1623
 | 
   101             execute.view{
 | 
| 
bsw@1623
 | 
   102               module = "member",
 | 
| 
bsw@1623
 | 
   103               view = "_show_thumb",
 | 
| 
bsw@1623
 | 
   104               params = {
 | 
| 
bsw@1623
 | 
   105                 member = member
 | 
| 
bsw@1623
 | 
   106               }
 | 
| 
bsw@1598
 | 
   107             }
 | 
| 
bsw@1623
 | 
   108           else
 | 
| 
bsw@1623
 | 
   109             ui.tag{ content = _"Delegation abandoned" }
 | 
| 
bsw@1623
 | 
   110           end
 | 
| 
bsw@1598
 | 
   111           text = _"change delegation..."
 | 
| 
bsw@1598
 | 
   112         else
 | 
| 
bsw@1598
 | 
   113           text = _"delegate..."  
 | 
| 
bsw/jbe@1309
 | 
   114         end
 | 
| 
bsw@1598
 | 
   115         
 | 
| 
bsw@1598
 | 
   116         ui.link {
 | 
| 
bsw@1598
 | 
   117           attr = { class = "mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--underlined" },
 | 
| 
bsw@1598
 | 
   118           module = "delegation", view = "show", params = {
 | 
| 
bsw@1598
 | 
   119             area_id = area.id,
 | 
| 
bsw@1598
 | 
   120           },
 | 
| 
bsw@1598
 | 
   121           content = text
 | 
| 
bsw@1598
 | 
   122         }
 | 
| 
bsw@1598
 | 
   123                         
 | 
| 
bsw/jbe@1309
 | 
   124         if not config.voting_only and app.session.member_id and app.session.member:has_initiative_right_for_unit_id ( area.unit_id ) then
 | 
| 
bsw/jbe@1309
 | 
   125           ui.link {
 | 
| 
bsw/jbe@1309
 | 
   126             attr = { class = "mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--underlined" },
 | 
| 
bsw@1496
 | 
   127             module = "draft", view = "new",
 | 
| 
bsw/jbe@1309
 | 
   128             params = { area_id = area.id },
 | 
| 
bsw/jbe@1309
 | 
   129             content = function()
 | 
| 
bsw/jbe@1309
 | 
   130               ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "add" }
 | 
| 
bsw/jbe@1309
 | 
   131               ui.tag{ content = _"new issue" }
 | 
| 
bsw/jbe@1309
 | 
   132             end
 | 
| 
bsw/jbe@1309
 | 
   133           }
 | 
| 
bsw/jbe@1309
 | 
   134         end
 | 
| 
bsw/jbe@1309
 | 
   135       end }
 | 
| 
bsw/jbe@1309
 | 
   136     end
 | 
| 
bsw/jbe@1309
 | 
   137   end }
 | 
| 
bsw/jbe@1309
 | 
   138 end
 | 
| 
bsw@1598
 | 
   139 
 | 
| 
bsw@1598
 | 
   140 
 |