| rev | 
   line source | 
| 
bsw@1045
 | 
     1 local area = param.get ( "area", "table" )
 | 
| 
bsw/jbe@1309
 | 
     2 area:load_delegation_info_once_for_member_id(app.session.member_id)
 | 
| 
bsw@1045
 | 
     3 
 | 
| 
bsw@1045
 | 
     4 local participating_trustee_id
 | 
| 
bsw@1045
 | 
     5 local participating_trustee_name
 | 
| 
bsw/jbe@1309
 | 
     6 if app.session.member then
 | 
| 
bsw@1045
 | 
     7   if area.delegation_info.first_trustee_participation then
 | 
| 
bsw@1045
 | 
     8     participating_trustee_id = area.delegation_info.first_trustee_id
 | 
| 
bsw@1045
 | 
     9     participating_trustee_name = area.delegation_info.first_trustee_name
 | 
| 
bsw@1045
 | 
    10   elseif area.delegation_info.other_trustee_participation then
 | 
| 
bsw@1045
 | 
    11     participating_trustee_id = area.delegation_info.other_trustee_id
 | 
| 
bsw@1045
 | 
    12     participating_trustee_name = area.delegation_info.other_trustee_name
 | 
| 
bsw@1045
 | 
    13   end
 | 
| 
bsw@1045
 | 
    14 end
 | 
| 
bsw@1045
 | 
    15 
 | 
| 
bsw/jbe@1309
 | 
    16 ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function()
 | 
| 
bsw/jbe@1309
 | 
    17   ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
 | 
| 
bsw/jbe@1309
 | 
    18     ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = _"What can I do here?" }
 | 
| 
bsw/jbe@1309
 | 
    19   end }
 | 
| 
bsw/jbe@1309
 | 
    20   ui.container{ attr = { class = "what-can-i-do-here" }, content = function()
 | 
| 
bsw@1045
 | 
    21 
 | 
| 
bsw/jbe@1309
 | 
    22     if app.session.member and app.session.member:has_voting_right_for_unit_id(area.unit_id) then
 | 
| 
bsw@1250
 | 
    23     
 | 
| 
bsw/jbe@1309
 | 
    24       if not app.session.member.disable_notifications then
 | 
| 
bsw/jbe@1309
 | 
    25         
 | 
| 
bsw/jbe@1309
 | 
    26         local ignored_area = IgnoredArea:by_pk(app.session.member_id, area.id)
 | 
| 
bsw@1250
 | 
    27 
 | 
| 
bsw/jbe@1309
 | 
    28         if not ignored_area then
 | 
| 
bsw/jbe@1309
 | 
    29           ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function()
 | 
| 
bsw/jbe@1309
 | 
    30             ui.tag{ content = _"You are receiving updates by email for this subject area" }
 | 
| 
bsw/jbe@1309
 | 
    31             ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
 | 
| 
bsw/jbe@1309
 | 
    32               ui.tag { tag = "li", content = function ()
 | 
| 
bsw/jbe@1309
 | 
    33                 ui.tag { content = function ()
 | 
| 
bsw/jbe@1309
 | 
    34                   ui.link {
 | 
| 
bsw/jbe@1309
 | 
    35                     module = "area", action = "update_ignore",
 | 
| 
bsw/jbe@1309
 | 
    36                     params = { area_id = area.id },
 | 
| 
bsw/jbe@1309
 | 
    37                     routing = { default = {
 | 
| 
bsw/jbe@1309
 | 
    38                       mode = "redirect", module = "index", view = "index", params = { unit = area.unit_id, area = area.id }
 | 
| 
bsw/jbe@1309
 | 
    39                     } },
 | 
| 
bsw/jbe@1309
 | 
    40                     text = _"unsubscribe from update emails about this area"
 | 
| 
bsw/jbe@1309
 | 
    41                   }
 | 
| 
bsw/jbe@1309
 | 
    42                 end }
 | 
| 
bsw@1250
 | 
    43               end }
 | 
| 
bsw@1250
 | 
    44             end }
 | 
| 
bsw@1250
 | 
    45           end }
 | 
| 
bsw/jbe@1309
 | 
    46         end
 | 
| 
bsw/jbe@1309
 | 
    47         
 | 
| 
bsw/jbe@1309
 | 
    48         if ignored_area then
 | 
| 
bsw/jbe@1309
 | 
    49           ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function()
 | 
| 
bsw/jbe@1309
 | 
    50             ui.tag{ content = _"I want to stay informed" }
 | 
| 
bsw/jbe@1309
 | 
    51             ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
 | 
| 
bsw/jbe@1309
 | 
    52               ui.tag { tag = "li", content = function ()
 | 
| 
bsw/jbe@1309
 | 
    53                 ui.tag { content = function ()
 | 
| 
bsw/jbe@1309
 | 
    54                   ui.link {
 | 
| 
bsw/jbe@1309
 | 
    55                     module = "area", action = "update_ignore",
 | 
| 
bsw/jbe@1309
 | 
    56                     params = { area_id = area.id, delete = true },
 | 
| 
bsw/jbe@1309
 | 
    57                     routing = { default = {
 | 
| 
bsw/jbe@1309
 | 
    58                       mode = "redirect", module = "index", view = "index", params = { unit = area.unit_id, area = area.id }
 | 
| 
bsw/jbe@1309
 | 
    59                     } },
 | 
| 
bsw/jbe@1309
 | 
    60                     text = _"subscribe for update emails about this area"
 | 
| 
bsw/jbe@1309
 | 
    61                   }
 | 
| 
bsw/jbe@1309
 | 
    62                 end }
 | 
| 
bsw/jbe@1309
 | 
    63               end }
 | 
| 
bsw/jbe@1309
 | 
    64             end }
 | 
| 
bsw/jbe@1309
 | 
    65           end }
 | 
| 
bsw/jbe@1309
 | 
    66         end
 | 
| 
bsw@1250
 | 
    67       
 | 
| 
bsw/jbe@1309
 | 
    68       else
 | 
| 
bsw/jbe@1309
 | 
    69         ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function()
 | 
| 
bsw/jbe@1309
 | 
    70           ui.tag{ content = _"I want to stay informed about this subject area" }
 | 
| 
bsw@1250
 | 
    71           ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
 | 
| 
bsw@1250
 | 
    72             ui.tag { tag = "li", content = function ()
 | 
| 
bsw@1250
 | 
    73               ui.tag { content = function ()
 | 
| 
bsw@1791
 | 
    74                 local text = _"Edit your global <link>notification settings</link> to receive updates by email."
 | 
| 
bsw@1791
 | 
    75                 local text_pre, text_link, text_post = string.match(text, "([^<]*)<link>([^<]+)</link>([^<]*)")
 | 
| 
bsw@1791
 | 
    76                 ui.tag{ content = text_pre }
 | 
| 
bsw@1250
 | 
    77                 ui.link {
 | 
| 
bsw/jbe@1309
 | 
    78                   module = "member", view = "settings_notification",
 | 
| 
bsw/jbe@1309
 | 
    79                   params = { return_to = "area", return_to_area_id = area.id },
 | 
| 
bsw@1791
 | 
    80                   text = text_link
 | 
| 
bsw@1250
 | 
    81                 }
 | 
| 
bsw@1791
 | 
    82                 ui.tag{ content = text_post }
 | 
| 
bsw@1250
 | 
    83               end }
 | 
| 
bsw@1250
 | 
    84             end }
 | 
| 
bsw@1250
 | 
    85           end }
 | 
| 
bsw@1250
 | 
    86         end }
 | 
| 
bsw/jbe@1309
 | 
    87       end
 | 
| 
bsw@1045
 | 
    88       
 | 
| 
bsw/jbe@1309
 | 
    89       if app.session.member and app.session.member:has_voting_right_for_unit_id(area.unit_id) then
 | 
| 
bsw/jbe@1309
 | 
    90 
 | 
| 
bsw/jbe@1309
 | 
    91         if not config.disable_delegations then
 | 
| 
bsw/jbe@1309
 | 
    92           
 | 
| 
bsw/jbe@1309
 | 
    93           ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function()
 | 
| 
bsw/jbe@1309
 | 
    94 
 | 
| 
bsw/jbe@1309
 | 
    95             if not area.delegation_info.first_trustee_id then
 | 
| 
bsw/jbe@1309
 | 
    96               ui.tag{ content = _"I want to delegate this subject area" }
 | 
| 
bsw/jbe@1309
 | 
    97             else
 | 
| 
bsw/jbe@1309
 | 
    98               ui.tag{ content = _"You delegated this subject area" }
 | 
| 
bsw/jbe@1309
 | 
    99             end
 | 
| 
bsw@1045
 | 
   100 
 | 
| 
bsw/jbe@1309
 | 
   101             ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
 | 
| 
bsw/jbe@1309
 | 
   102               if area.delegation_info.own_delegation_scope == "unit" then
 | 
| 
bsw/jbe@1309
 | 
   103                 ui.tag { tag = "li", content = function ()
 | 
| 
bsw/jbe@1309
 | 
   104                   ui.link {
 | 
| 
bsw/jbe@1309
 | 
   105                     module = "delegation", view = "show", params = {
 | 
| 
bsw/jbe@1309
 | 
   106                       unit_id = area.unit_id,
 | 
| 
bsw/jbe@1309
 | 
   107                     },
 | 
| 
bsw/jbe@1309
 | 
   108                     content = _("change/revoke delegation of organizational unit")
 | 
| 
bsw/jbe@1309
 | 
   109                   }
 | 
| 
bsw/jbe@1309
 | 
   110                 end }
 | 
| 
bsw/jbe@1309
 | 
   111               end
 | 
| 
bsw/jbe@1309
 | 
   112               
 | 
| 
bsw/jbe@1309
 | 
   113               if area.delegation_info.own_delegation_scope == nil then
 | 
| 
bsw/jbe@1309
 | 
   114                 ui.tag { tag = "li", content = function ()
 | 
| 
bsw/jbe@1309
 | 
   115                   ui.link {
 | 
| 
bsw/jbe@1309
 | 
   116                     module = "delegation", view = "show", params = {
 | 
| 
bsw/jbe@1309
 | 
   117                       area_id = area.id
 | 
| 
bsw/jbe@1309
 | 
   118                     },
 | 
| 
bsw/jbe@1309
 | 
   119                     content = _"choose subject area delegatee" 
 | 
| 
bsw/jbe@1309
 | 
   120                   }
 | 
| 
bsw/jbe@1309
 | 
   121                 end }
 | 
| 
bsw/jbe@1309
 | 
   122               elseif area.delegation_info.own_delegation_scope == "area" then
 | 
| 
bsw/jbe@1309
 | 
   123                 ui.tag { tag = "li", content = function ()
 | 
| 
bsw/jbe@1309
 | 
   124                   ui.link {
 | 
| 
bsw/jbe@1309
 | 
   125                     module = "delegation", view = "show", params = {
 | 
| 
bsw/jbe@1309
 | 
   126                       area_id = area.id
 | 
| 
bsw/jbe@1309
 | 
   127                     },
 | 
| 
bsw/jbe@1309
 | 
   128                     content = _"change/revoke area delegation" 
 | 
| 
bsw/jbe@1309
 | 
   129                   }
 | 
| 
bsw/jbe@1309
 | 
   130                 end }
 | 
| 
bsw/jbe@1309
 | 
   131               else
 | 
| 
bsw/jbe@1309
 | 
   132                 ui.tag { tag = "li", content = function ()
 | 
| 
bsw/jbe@1309
 | 
   133                   ui.link {
 | 
| 
bsw/jbe@1309
 | 
   134                     module = "delegation", view = "show", params = {
 | 
| 
bsw/jbe@1309
 | 
   135                       area_id = area.id
 | 
| 
bsw/jbe@1309
 | 
   136                     },
 | 
| 
bsw/jbe@1309
 | 
   137                     content = _"change/revoke delegation only for this subject area" 
 | 
| 
bsw/jbe@1309
 | 
   138                   }
 | 
| 
bsw/jbe@1309
 | 
   139                 end }
 | 
| 
bsw/jbe@1309
 | 
   140               end
 | 
| 
bsw/jbe@1309
 | 
   141             end }
 | 
| 
bsw/jbe@1309
 | 
   142           end }
 | 
| 
bsw/jbe@1309
 | 
   143         end 
 | 
| 
bsw/jbe@1309
 | 
   144         
 | 
| 
bsw/jbe@1309
 | 
   145         if app.session.member:has_initiative_right_for_unit_id ( area.unit_id ) then
 | 
| 
bsw/jbe@1309
 | 
   146           ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function()
 | 
| 
bsw/jbe@1309
 | 
   147             ui.tag{
 | 
| 
bsw/jbe@1309
 | 
   148               content = _("I want to start a new initiative", {
 | 
| 
bsw/jbe@1309
 | 
   149                 area_name = area.name
 | 
| 
bsw/jbe@1309
 | 
   150               } ) 
 | 
| 
bsw@1045
 | 
   151             }
 | 
| 
bsw/jbe@1309
 | 
   152             ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
 | 
| 
bsw/jbe@1309
 | 
   153               ui.tag { tag = "li", content = _"Take a look through the existing issues. Maybe someone else started a debate on your topic (and you can join it) or the topic has been decided already in the past." }
 | 
| 
bsw/jbe@1309
 | 
   154               ui.tag { tag = "li", content = function ()
 | 
| 
bsw/jbe@1309
 | 
   155                 ui.tag { content = function ()
 | 
| 
bsw/jbe@1309
 | 
   156                   ui.tag { content = _"If you cannot find any appropriate existing issue, " }
 | 
| 
bsw/jbe@1309
 | 
   157                   ui.link {
 | 
| 
bsw@1568
 | 
   158                     module = "draft", view = "new",
 | 
| 
bsw/jbe@1309
 | 
   159                     params = { area_id = area.id },
 | 
| 
bsw/jbe@1309
 | 
   160                     text = _"start an initiative in a new issue"
 | 
| 
bsw/jbe@1309
 | 
   161                   }
 | 
| 
bsw/jbe@1309
 | 
   162                 end }
 | 
| 
bsw/jbe@1309
 | 
   163               end }
 | 
| 
bsw/jbe@1309
 | 
   164             end }
 | 
| 
bsw@1045
 | 
   165           end }
 | 
| 
bsw@1045
 | 
   166         end
 | 
| 
bsw@1713
 | 
   167       end
 | 
| 
bsw@1713
 | 
   168       if app.session.member:has_voting_right_for_unit_id ( area.unit_id ) then
 | 
| 
bsw@1713
 | 
   169         ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function()
 | 
| 
bsw@1713
 | 
   170           ui.tag{ content = _"I want to vote" }
 | 
| 
bsw@1713
 | 
   171           ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
 | 
| 
bsw@1713
 | 
   172             ui.tag { tag = "li", content = _"check the issues on the right, and click on 'Vote now' to vote on an issue which is in voting phase." }
 | 
| 
bsw@1713
 | 
   173           end }
 | 
| 
bsw@1713
 | 
   174         end }
 | 
| 
bsw/jbe@1309
 | 
   175       end
 | 
| 
bsw/jbe@1309
 | 
   176     else
 | 
| 
bsw/jbe@1309
 | 
   177       ui.container { attr = { class = "mdl-card__content mdl-card--border" }, content = function ()
 | 
| 
bsw@1716
 | 
   178         if not app.session.member_id then
 | 
| 
bsw@1716
 | 
   179           ui.tag{ content = _"Login to participate" }
 | 
| 
bsw@1716
 | 
   180           ui.tag{ tag = "ul", content = function()
 | 
| 
bsw@1716
 | 
   181             ui.tag{ tag = "li", content = function()
 | 
| 
bsw@1788
 | 
   182               ui.link{ module = "index", view = "login", content = _"Login [button]" }
 | 
| 
bsw@1716
 | 
   183             end }
 | 
| 
bsw@1045
 | 
   184           end }
 | 
| 
bsw@1716
 | 
   185         else
 | 
| 
bsw@1716
 | 
   186           ui.tag{ content = _"You are not entitled to vote in this unit" }
 | 
| 
bsw@1716
 | 
   187         end
 | 
| 
bsw/jbe@1309
 | 
   188       end }
 | 
| 
bsw@1045
 | 
   189     end
 | 
| 
bsw/jbe@1309
 | 
   190   end }
 | 
| 
bsw@1045
 | 
   191   
 | 
| 
bsw/jbe@1309
 | 
   192 end }
 |