| 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@1725
 | 
    31     end }
 | 
| 
bsw@1725
 | 
    32     if unit.description and #(unit.description) > 0 then
 | 
| 
bsw@1725
 | 
    33       ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function()
 | 
| 
bsw@1725
 | 
    34         slot.put(format.text_with_links(unit.description))
 | 
| 
bsw@1725
 | 
    35       end }
 | 
| 
bsw@1725
 | 
    36     end
 | 
| 
bsw@1725
 | 
    37     if config.render_external_reference_unit then
 | 
| 
bsw@1725
 | 
    38       ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function()
 | 
| 
bsw@1598
 | 
    39         config.render_external_reference_unit(unit)
 | 
| 
bsw@1725
 | 
    40       end }
 | 
| 
bsw@1725
 | 
    41     end
 | 
| 
bsw@1598
 | 
    42 
 | 
| 
bsw@1598
 | 
    43 
 | 
| 
bsw@1623
 | 
    44     if not (config.voting_only and config.disable_delegations) and app.session.member_id and (
 | 
| 
bsw@1623
 | 
    45       app.session.member:has_voting_right_for_unit_id(unit.id) 
 | 
| 
bsw@1623
 | 
    46       or app.session.member:has_initiative_right_for_unit_id(unit.id) 
 | 
| 
bsw@1623
 | 
    47     ) then
 | 
| 
bsw@1598
 | 
    48       ui.container{ attr = { class = "mdl-card__actions" }, content = function()
 | 
| 
bsw@1598
 | 
    49           
 | 
| 
bsw@1598
 | 
    50         unit:load_delegation_info_once_for_member_id(app.session.member_id)
 | 
| 
bsw@1598
 | 
    51         
 | 
| 
bsw@1598
 | 
    52         local text
 | 
| 
bsw@1598
 | 
    53         if unit.delegation_info.own_delegation_scope == "unit" then
 | 
| 
bsw@1598
 | 
    54           local member = Member:by_id(unit.delegation_info.first_trustee_id)
 | 
| 
bsw@1598
 | 
    55           ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "forward" }
 | 
| 
bsw@1598
 | 
    56           execute.view{
 | 
| 
bsw@1598
 | 
    57             module = "member",
 | 
| 
bsw@1598
 | 
    58             view = "_show_thumb",
 | 
| 
bsw@1598
 | 
    59             params = {
 | 
| 
bsw@1598
 | 
    60               member = member
 | 
| 
bsw@1598
 | 
    61             }
 | 
| 
bsw@1598
 | 
    62           }
 | 
| 
bsw@1598
 | 
    63           text = _"change delegation..."
 | 
| 
bsw@1598
 | 
    64         else
 | 
| 
bsw@1598
 | 
    65           text = _"delegate..."
 | 
| 
bsw@1598
 | 
    66         end
 | 
| 
bsw@1598
 | 
    67         
 | 
| 
bsw@1598
 | 
    68         ui.link {
 | 
| 
bsw@1598
 | 
    69           attr = { class = "mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--underlined" },
 | 
| 
bsw@1598
 | 
    70           module = "delegation", view = "show", params = {
 | 
| 
bsw@1598
 | 
    71             unit_id = unit.id,
 | 
| 
bsw@1598
 | 
    72           },
 | 
| 
bsw@1598
 | 
    73           content = text
 | 
| 
bsw@1598
 | 
    74         }
 | 
| 
bsw@1598
 | 
    75 
 | 
| 
bsw@1598
 | 
    76       end }
 | 
| 
bsw@1598
 | 
    77     end
 | 
| 
bsw@1598
 | 
    78   end }
 | 
| 
bsw@1598
 | 
    79 end
 | 
| 
bsw@1598
 | 
    80 
 | 
| 
bsw@1596
 | 
    81 if area then
 | 
| 
bsw/jbe@1309
 | 
    82 
 | 
| 
bsw/jbe@1309
 | 
    83   ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function()
 | 
| 
bsw/jbe@1309
 | 
    84     if unit then
 | 
| 
bsw/jbe@1309
 | 
    85       ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
 | 
| 
bsw@1598
 | 
    86         ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = area.name }
 | 
| 
bsw/jbe@1309
 | 
    87       end }
 | 
| 
bsw@1725
 | 
    88       if area.description and #(area.description) > 0 then
 | 
| 
bsw@1725
 | 
    89         ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function()
 | 
| 
bsw@1725
 | 
    90           slot.put(format.text_with_links(area.description))
 | 
| 
bsw@1725
 | 
    91         end }
 | 
| 
bsw@1725
 | 
    92       end
 | 
| 
bsw/jbe@1309
 | 
    93     end
 | 
| 
bsw@1623
 | 
    94     if not (config.voting_only and config.disable_delegations) and app.session.member_id and (
 | 
| 
bsw@1623
 | 
    95       app.session.member:has_voting_right_for_unit_id(area.unit_id) 
 | 
| 
bsw@1623
 | 
    96       or app.session.member:has_initiative_right_for_unit_id(area.unit_id) 
 | 
| 
bsw@1623
 | 
    97     ) then
 | 
| 
bsw/jbe@1309
 | 
    98       ui.container{ attr = { class = "mdl-card__actions" }, content = function()
 | 
| 
bsw/jbe@1309
 | 
    99           
 | 
| 
bsw@1598
 | 
   100         area:load_delegation_info_once_for_member_id(app.session.member_id)
 | 
| 
bsw@1596
 | 
   101 
 | 
| 
bsw@1598
 | 
   102         local text
 | 
| 
bsw@1598
 | 
   103         if area.delegation_info.own_delegation_scope == "area" then
 | 
| 
bsw@1598
 | 
   104           local member = Member:by_id(area.delegation_info.first_trustee_id)
 | 
| 
bsw@1623
 | 
   105           if member then
 | 
| 
bsw@1623
 | 
   106             ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "forward" }
 | 
| 
bsw@1623
 | 
   107             execute.view{
 | 
| 
bsw@1623
 | 
   108               module = "member",
 | 
| 
bsw@1623
 | 
   109               view = "_show_thumb",
 | 
| 
bsw@1623
 | 
   110               params = {
 | 
| 
bsw@1623
 | 
   111                 member = member
 | 
| 
bsw@1623
 | 
   112               }
 | 
| 
bsw@1598
 | 
   113             }
 | 
| 
bsw@1623
 | 
   114           else
 | 
| 
bsw@1623
 | 
   115             ui.tag{ content = _"Delegation abandoned" }
 | 
| 
bsw@1623
 | 
   116           end
 | 
| 
bsw@1598
 | 
   117           text = _"change delegation..."
 | 
| 
bsw@1598
 | 
   118         else
 | 
| 
bsw@1598
 | 
   119           text = _"delegate..."  
 | 
| 
bsw/jbe@1309
 | 
   120         end
 | 
| 
bsw@1598
 | 
   121         
 | 
| 
bsw@1598
 | 
   122         ui.link {
 | 
| 
bsw@1598
 | 
   123           attr = { class = "mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--underlined" },
 | 
| 
bsw@1598
 | 
   124           module = "delegation", view = "show", params = {
 | 
| 
bsw@1598
 | 
   125             area_id = area.id,
 | 
| 
bsw@1598
 | 
   126           },
 | 
| 
bsw@1598
 | 
   127           content = text
 | 
| 
bsw@1598
 | 
   128         }
 | 
| 
bsw@1598
 | 
   129                         
 | 
| 
bsw/jbe@1309
 | 
   130         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
 | 
   131           ui.link {
 | 
| 
bsw/jbe@1309
 | 
   132             attr = { class = "mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--underlined" },
 | 
| 
bsw@1496
 | 
   133             module = "draft", view = "new",
 | 
| 
bsw/jbe@1309
 | 
   134             params = { area_id = area.id },
 | 
| 
bsw/jbe@1309
 | 
   135             content = function()
 | 
| 
bsw/jbe@1309
 | 
   136               ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "add" }
 | 
| 
bsw/jbe@1309
 | 
   137               ui.tag{ content = _"new issue" }
 | 
| 
bsw/jbe@1309
 | 
   138             end
 | 
| 
bsw/jbe@1309
 | 
   139           }
 | 
| 
bsw/jbe@1309
 | 
   140         end
 | 
| 
bsw/jbe@1309
 | 
   141       end }
 | 
| 
bsw/jbe@1309
 | 
   142     end
 | 
| 
bsw/jbe@1309
 | 
   143   end }
 | 
| 
bsw/jbe@1309
 | 
   144 end
 | 
| 
bsw@1598
 | 
   145 
 | 
| 
bsw@1598
 | 
   146 
 |