| rev | 
   line source | 
| 
bsw@1045
 | 
     1 local member = param.get ( "member", "table" ) or app.session.member
 | 
| 
bsw@1045
 | 
     2 
 | 
| 
bsw@1045
 | 
     3 local area = param.get ( "area", "table" )
 | 
| 
bsw@1045
 | 
     4 
 | 
| 
bsw@1045
 | 
     5 local participating_trustee_id
 | 
| 
bsw@1045
 | 
     6 local participating_trustee_name
 | 
| 
bsw@1045
 | 
     7 if member then
 | 
| 
bsw@1045
 | 
     8   if area.delegation_info.first_trustee_participation then
 | 
| 
bsw@1045
 | 
     9     participating_trustee_id = area.delegation_info.first_trustee_id
 | 
| 
bsw@1045
 | 
    10     participating_trustee_name = area.delegation_info.first_trustee_name
 | 
| 
bsw@1045
 | 
    11   elseif area.delegation_info.other_trustee_participation then
 | 
| 
bsw@1045
 | 
    12     participating_trustee_id = area.delegation_info.other_trustee_id
 | 
| 
bsw@1045
 | 
    13     participating_trustee_name = area.delegation_info.other_trustee_name
 | 
| 
bsw@1045
 | 
    14   end
 | 
| 
bsw@1045
 | 
    15 end
 | 
| 
bsw@1045
 | 
    16 
 | 
| 
bsw@1045
 | 
    17 ui.sidebar ( "tab-whatcanido", function ()
 | 
| 
bsw@1045
 | 
    18 
 | 
| 
bsw@1045
 | 
    19   ui.sidebarHeadWhatCanIDo()
 | 
| 
bsw@1045
 | 
    20   
 | 
| 
bsw@1045
 | 
    21   if member and not app.session.member:has_voting_right_for_unit_id(area.unit_id) then
 | 
| 
bsw@1045
 | 
    22     ui.sidebarSection( _"You are not entitled to vote in this unit" )
 | 
| 
bsw@1045
 | 
    23   end
 | 
| 
bsw@1045
 | 
    24   
 | 
| 
bsw@1045
 | 
    25   if member and app.session.member:has_voting_right_for_unit_id(area.unit_id) then
 | 
| 
bsw@1250
 | 
    26     
 | 
| 
bsw@1250
 | 
    27     if not app.session.member.disable_notifications then
 | 
| 
bsw@1250
 | 
    28       
 | 
| 
bsw@1250
 | 
    29       local ignored_area = IgnoredArea:by_pk(app.session.member_id, area.id)
 | 
| 
bsw@1250
 | 
    30 
 | 
| 
bsw@1250
 | 
    31       if not ignored_area then
 | 
| 
bsw@1250
 | 
    32         ui.sidebarSection ( function ()
 | 
| 
bsw@1250
 | 
    33         
 | 
| 
bsw@1250
 | 
    34           ui.heading {
 | 
| 
bsw@1250
 | 
    35             level = 3, 
 | 
| 
bsw@1250
 | 
    36             content = _"You are receiving updates by email for this subject area"
 | 
| 
bsw@1250
 | 
    37           }
 | 
| 
bsw@1250
 | 
    38           ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
 | 
| 
bsw@1250
 | 
    39             ui.tag { tag = "li", content = function ()
 | 
| 
bsw@1250
 | 
    40               ui.tag { content = function ()
 | 
| 
bsw@1250
 | 
    41                 ui.link {
 | 
| 
bsw@1250
 | 
    42                   module = "area", action = "update_ignore",
 | 
| 
bsw@1250
 | 
    43                   params = { area_id = area.id },
 | 
| 
bsw@1250
 | 
    44                   routing = { default = {
 | 
| 
bsw@1250
 | 
    45                     mode = "redirect", module = "area", view = "show", id = area.id
 | 
| 
bsw@1250
 | 
    46                   } },
 | 
| 
bsw@1250
 | 
    47                   text = _"unsubscribe from update emails about this area"
 | 
| 
bsw@1250
 | 
    48                 }
 | 
| 
bsw@1250
 | 
    49               end }
 | 
| 
bsw@1250
 | 
    50             end }
 | 
| 
bsw@1250
 | 
    51           end }
 | 
| 
bsw@1250
 | 
    52         end )
 | 
| 
bsw@1250
 | 
    53       end
 | 
| 
bsw@1250
 | 
    54       
 | 
| 
bsw@1250
 | 
    55       if ignored_area then
 | 
| 
bsw@1250
 | 
    56         ui.sidebarSection ( function ()
 | 
| 
bsw@1250
 | 
    57         
 | 
| 
bsw@1250
 | 
    58           ui.heading {
 | 
| 
bsw@1250
 | 
    59             level = 3, 
 | 
| 
bsw@1250
 | 
    60             content = _"I want to stay informed"
 | 
| 
bsw@1250
 | 
    61           }
 | 
| 
bsw@1250
 | 
    62           ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
 | 
| 
bsw@1250
 | 
    63             ui.tag { tag = "li", content = function ()
 | 
| 
bsw@1250
 | 
    64               ui.tag { content = function ()
 | 
| 
bsw@1250
 | 
    65                 ui.link {
 | 
| 
bsw@1250
 | 
    66                   module = "area", action = "update_ignore",
 | 
| 
bsw@1250
 | 
    67                   params = { area_id = area.id, delete = true },
 | 
| 
bsw@1250
 | 
    68                   routing = { default = {
 | 
| 
bsw@1250
 | 
    69                     mode = "redirect", module = "area", view = "show", id = area.id
 | 
| 
bsw@1250
 | 
    70                   } },
 | 
| 
bsw@1250
 | 
    71                   text = _"subscribe for update emails about this area"
 | 
| 
bsw@1250
 | 
    72                 }
 | 
| 
bsw@1250
 | 
    73               end }
 | 
| 
bsw@1250
 | 
    74             end }
 | 
| 
bsw@1250
 | 
    75           end }
 | 
| 
bsw@1250
 | 
    76         end )
 | 
| 
bsw@1250
 | 
    77       end
 | 
| 
bsw@1250
 | 
    78     
 | 
| 
bsw@1250
 | 
    79     else
 | 
| 
bsw@1250
 | 
    80       ui.sidebarSection ( function ()
 | 
| 
bsw@1250
 | 
    81       
 | 
| 
bsw@1250
 | 
    82         ui.heading {
 | 
| 
bsw@1250
 | 
    83           level = 3, 
 | 
| 
bsw@1250
 | 
    84           content = _"I want to stay informed about this subject area"
 | 
| 
bsw@1250
 | 
    85         }
 | 
| 
bsw@1250
 | 
    86         ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
 | 
| 
bsw@1250
 | 
    87           ui.tag { tag = "li", content = function ()
 | 
| 
bsw@1250
 | 
    88             ui.tag { content = function ()
 | 
| 
bsw@1250
 | 
    89               ui.tag{ content = _"Edit your global " }
 | 
| 
bsw@1250
 | 
    90               ui.link {
 | 
| 
bsw@1250
 | 
    91                 module = "member", view = "settings_notification",
 | 
| 
bsw@1250
 | 
    92                 params = { return_to = "area", return_to_area_id = area.id },
 | 
| 
bsw@1250
 | 
    93                 text = _"notification settings"
 | 
| 
bsw@1250
 | 
    94               }
 | 
| 
bsw@1250
 | 
    95               ui.tag{ content = _" to receive updates by email" }
 | 
| 
bsw@1250
 | 
    96             end }
 | 
| 
bsw@1250
 | 
    97           end }
 | 
| 
bsw@1250
 | 
    98         end }
 | 
| 
bsw@1250
 | 
    99       end )
 | 
| 
bsw@1250
 | 
   100     end
 | 
| 
bsw@1250
 | 
   101     
 | 
| 
bsw@1250
 | 
   102     if area.delegation_info.own_participation then
 | 
| 
bsw@1250
 | 
   103       ui.sidebarSection ( function ()
 | 
| 
bsw@1250
 | 
   104         ui.image{ attr = { class = "right" }, static = "icons/48/star.png" }
 | 
| 
bsw@1250
 | 
   105         ui.heading {
 | 
| 
bsw@1250
 | 
   106           level = 3, 
 | 
| 
bsw@1250
 | 
   107           content = _"You are subscribed for this subject area" 
 | 
| 
bsw@1250
 | 
   108         }
 | 
| 
bsw@1250
 | 
   109         ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
 | 
| 
bsw@1250
 | 
   110           ui.tag { tag = "li", content = function ()
 | 
| 
bsw@1250
 | 
   111             ui.tag { content = function ()
 | 
| 
bsw@1250
 | 
   112               ui.link {
 | 
| 
bsw@1250
 | 
   113                 module = "membership", action = "update",
 | 
| 
bsw@1250
 | 
   114                 routing = { default = {
 | 
| 
bsw@1250
 | 
   115                   mode = "redirect", module = "area", view = "show", id = area.id
 | 
| 
bsw@1250
 | 
   116                 } },
 | 
| 
bsw@1250
 | 
   117                 params = { area_id = area.id, delete = true },
 | 
| 
bsw@1250
 | 
   118                 text = _"unsubscribe"
 | 
| 
bsw@1250
 | 
   119               }
 | 
| 
bsw@1250
 | 
   120             end }
 | 
| 
bsw@1250
 | 
   121           end }
 | 
| 
bsw@1250
 | 
   122         end }
 | 
| 
bsw@1250
 | 
   123       end )
 | 
| 
bsw@1250
 | 
   124     end
 | 
| 
bsw@1250
 | 
   125 
 | 
| 
bsw@1045
 | 
   126     if not area.delegation_info.own_participation then
 | 
| 
bsw@1045
 | 
   127       ui.sidebarSection ( function ()
 | 
| 
bsw@1045
 | 
   128       
 | 
| 
bsw@1045
 | 
   129         ui.heading {
 | 
| 
bsw@1045
 | 
   130           level = 3, 
 | 
| 
bsw@1045
 | 
   131           content = _"I want to participate in this subject area"
 | 
| 
bsw@1045
 | 
   132         }
 | 
| 
bsw@1045
 | 
   133         ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
 | 
| 
bsw@1045
 | 
   134           ui.tag { tag = "li", content = function ()
 | 
| 
bsw@1045
 | 
   135             ui.tag { content = function ()
 | 
| 
bsw@1045
 | 
   136               ui.link {
 | 
| 
bsw@1045
 | 
   137                 module = "membership", action = "update",
 | 
| 
bsw@1045
 | 
   138                 routing = { default = {
 | 
| 
bsw@1045
 | 
   139                   mode = "redirect", module = "area", view = "show", id = area.id
 | 
| 
bsw@1045
 | 
   140                 } },
 | 
| 
bsw@1045
 | 
   141                 params = { area_id = area.id },
 | 
| 
bsw@1045
 | 
   142                 text = _"subscribe"
 | 
| 
bsw@1045
 | 
   143               }
 | 
| 
bsw@1045
 | 
   144             end }
 | 
| 
bsw@1045
 | 
   145           end }
 | 
| 
bsw@1045
 | 
   146         end }
 | 
| 
bsw@1045
 | 
   147       end )
 | 
| 
bsw@1045
 | 
   148     end
 | 
| 
bsw@1045
 | 
   149       
 | 
| 
bsw@1045
 | 
   150     
 | 
| 
bsw@1045
 | 
   151     
 | 
| 
bsw@1045
 | 
   152     ui.sidebarSection ( function ()
 | 
| 
bsw@1045
 | 
   153     
 | 
| 
bsw@1045
 | 
   154 
 | 
| 
bsw@1045
 | 
   155       if not area.delegation_info.first_trustee_id then
 | 
| 
bsw@1045
 | 
   156         ui.heading{ level = 3, content = _"I want to delegate this subject area" }
 | 
| 
bsw@1045
 | 
   157       else
 | 
| 
bsw@1045
 | 
   158         ui.container { attr = { class = "right" }, content = function()
 | 
| 
bsw@1045
 | 
   159           local member = Member:by_id(area.delegation_info.first_trustee_id)
 | 
| 
bsw@1045
 | 
   160           execute.view{
 | 
| 
bsw@1045
 | 
   161             module = "member_image",
 | 
| 
bsw@1045
 | 
   162             view = "_show",
 | 
| 
bsw@1045
 | 
   163             params = {
 | 
| 
bsw@1045
 | 
   164               member = member,
 | 
| 
bsw@1045
 | 
   165               image_type = "avatar",
 | 
| 
bsw@1045
 | 
   166               show_dummy = true
 | 
| 
bsw@1045
 | 
   167             }
 | 
| 
bsw@1045
 | 
   168           }
 | 
| 
bsw@1045
 | 
   169         end }
 | 
| 
bsw@1045
 | 
   170         ui.heading{ level = 3, content = _"You delegated this subject area" }
 | 
| 
bsw@1045
 | 
   171       end
 | 
| 
bsw@1045
 | 
   172 
 | 
| 
bsw@1045
 | 
   173       ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
 | 
| 
bsw@1045
 | 
   174         if area.delegation_info.own_delegation_scope == "unit" then
 | 
| 
bsw@1045
 | 
   175           ui.tag { tag = "li", content = function ()
 | 
| 
bsw@1045
 | 
   176             ui.link {
 | 
| 
bsw@1045
 | 
   177               module = "delegation", view = "show", params = {
 | 
| 
bsw@1045
 | 
   178                 unit_id = area.unit_id,
 | 
| 
bsw@1045
 | 
   179               },
 | 
| 
bsw@1045
 | 
   180               content = _("change/revoke delegation of organizational unit")
 | 
| 
bsw@1045
 | 
   181             }
 | 
| 
bsw@1045
 | 
   182           end }
 | 
| 
bsw@1045
 | 
   183         end
 | 
| 
bsw@1045
 | 
   184         
 | 
| 
bsw@1045
 | 
   185         if area.delegation_info.own_delegation_scope == nil then
 | 
| 
bsw@1045
 | 
   186           ui.tag { tag = "li", content = function ()
 | 
| 
bsw@1045
 | 
   187             ui.link {
 | 
| 
bsw@1045
 | 
   188               module = "delegation", view = "show", params = {
 | 
| 
bsw@1045
 | 
   189                 area_id = area.id
 | 
| 
bsw@1045
 | 
   190               },
 | 
| 
bsw@1045
 | 
   191               content = _"choose subject area delegatee" 
 | 
| 
bsw@1045
 | 
   192             }
 | 
| 
bsw@1045
 | 
   193           end }
 | 
| 
bsw@1045
 | 
   194         elseif area.delegation_info.own_delegation_scope == "area" then
 | 
| 
bsw@1045
 | 
   195           ui.tag { tag = "li", content = function ()
 | 
| 
bsw@1045
 | 
   196             ui.link {
 | 
| 
bsw@1045
 | 
   197               module = "delegation", view = "show", params = {
 | 
| 
bsw@1045
 | 
   198                 area_id = area.id
 | 
| 
bsw@1045
 | 
   199               },
 | 
| 
bsw@1045
 | 
   200               content = _"change/revoke area delegation" 
 | 
| 
bsw@1045
 | 
   201             }
 | 
| 
bsw@1045
 | 
   202           end }
 | 
| 
bsw@1045
 | 
   203         else
 | 
| 
bsw@1045
 | 
   204           ui.tag { tag = "li", content = function ()
 | 
| 
bsw@1045
 | 
   205             ui.link {
 | 
| 
bsw@1045
 | 
   206               module = "delegation", view = "show", params = {
 | 
| 
bsw@1045
 | 
   207                 area_id = area.id
 | 
| 
bsw@1045
 | 
   208               },
 | 
| 
bsw@1045
 | 
   209               content = _"change/revoke delegation only for this subject area" 
 | 
| 
bsw@1045
 | 
   210             }
 | 
| 
bsw@1045
 | 
   211           end }
 | 
| 
bsw@1045
 | 
   212         end
 | 
| 
bsw@1045
 | 
   213       end }
 | 
| 
bsw@1045
 | 
   214     end )
 | 
| 
bsw@1045
 | 
   215 
 | 
| 
bsw@1045
 | 
   216 
 | 
| 
bsw@1045
 | 
   217       
 | 
| 
bsw@1045
 | 
   218       
 | 
| 
bsw@1045
 | 
   219     if app.session.member:has_voting_right_for_unit_id ( area.unit_id ) then
 | 
| 
bsw@1045
 | 
   220       ui.sidebarSection ( function ()
 | 
| 
bsw@1045
 | 
   221         ui.heading {
 | 
| 
bsw@1045
 | 
   222           level = 3, 
 | 
| 
bsw@1045
 | 
   223           content = _("I want to start a new initiative", {
 | 
| 
bsw@1045
 | 
   224             area_name = area.name
 | 
| 
bsw@1045
 | 
   225           } ) 
 | 
| 
bsw@1045
 | 
   226         }
 | 
| 
bsw@1045
 | 
   227         ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
 | 
| 
bsw@1045
 | 
   228           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@1045
 | 
   229           ui.tag { tag = "li", content = function ()
 | 
| 
bsw@1045
 | 
   230             ui.tag { content = function ()
 | 
| 
bsw@1045
 | 
   231               ui.tag { content = _"If you cannot find any appropriate existing issue, " }
 | 
| 
bsw@1045
 | 
   232               ui.link {
 | 
| 
bsw@1045
 | 
   233                 module = "initiative", view = "new",
 | 
| 
bsw@1045
 | 
   234                 params = { area_id = area.id },
 | 
| 
bsw@1045
 | 
   235                 text = _"start an initiative in a new issue"
 | 
| 
bsw@1045
 | 
   236               }
 | 
| 
bsw@1045
 | 
   237             end }
 | 
| 
bsw@1045
 | 
   238           end }
 | 
| 
bsw@1045
 | 
   239         end }
 | 
| 
bsw@1045
 | 
   240       end )
 | 
| 
bsw@1045
 | 
   241     end
 | 
| 
bsw@1045
 | 
   242   else
 | 
| 
bsw@1045
 | 
   243   end
 | 
| 
bsw@1045
 | 
   244   
 | 
| 
bsw@1045
 | 
   245 end ) |