liquid_feedback_frontend
view app/main/area/_sidebar_whatcanido.lua @ 1425:e7131a564895
Fixed type
| author | bsw | 
|---|---|
| date | Fri Oct 05 18:55:47 2018 +0200 (2018-10-05) | 
| parents | 32cc544d5a5b | 
| children | 473d372c6ec7 | 
 line source
     1 local area = param.get ( "area", "table" )
     2 area:load_delegation_info_once_for_member_id(app.session.member_id)
     4 local participating_trustee_id
     5 local participating_trustee_name
     6 if app.session.member then
     7   if area.delegation_info.first_trustee_participation then
     8     participating_trustee_id = area.delegation_info.first_trustee_id
     9     participating_trustee_name = area.delegation_info.first_trustee_name
    10   elseif area.delegation_info.other_trustee_participation then
    11     participating_trustee_id = area.delegation_info.other_trustee_id
    12     participating_trustee_name = area.delegation_info.other_trustee_name
    13   end
    14 end
    16 ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function()
    17   ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
    18     ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = _"What can I do here?" }
    19   end }
    20   ui.container{ attr = { class = "what-can-i-do-here" }, content = function()
    22     if app.session.member and app.session.member:has_voting_right_for_unit_id(area.unit_id) then
    24       if not app.session.member.disable_notifications then
    26         local ignored_area = IgnoredArea:by_pk(app.session.member_id, area.id)
    28         if not ignored_area then
    29           ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function()
    30             ui.tag{ content = _"You are receiving updates by email for this subject area" }
    31             ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
    32               ui.tag { tag = "li", content = function ()
    33                 ui.tag { content = function ()
    34                   ui.link {
    35                     module = "area", action = "update_ignore",
    36                     params = { area_id = area.id },
    37                     routing = { default = {
    38                       mode = "redirect", module = "index", view = "index", params = { unit = area.unit_id, area = area.id }
    39                     } },
    40                     text = _"unsubscribe from update emails about this area"
    41                   }
    42                 end }
    43               end }
    44             end }
    45           end }
    46         end
    48         if ignored_area then
    49           ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function()
    50             ui.tag{ content = _"I want to stay informed" }
    51             ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
    52               ui.tag { tag = "li", content = function ()
    53                 ui.tag { content = function ()
    54                   ui.link {
    55                     module = "area", action = "update_ignore",
    56                     params = { area_id = area.id, delete = true },
    57                     routing = { default = {
    58                       mode = "redirect", module = "index", view = "index", params = { unit = area.unit_id, area = area.id }
    59                     } },
    60                     text = _"subscribe for update emails about this area"
    61                   }
    62                 end }
    63               end }
    64             end }
    65           end }
    66         end
    68       else
    69         ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function()
    70           ui.tag{ content = _"I want to stay informed about this subject area" }
    71           ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
    72             ui.tag { tag = "li", content = function ()
    73               ui.tag { content = function ()
    74                 ui.tag{ content = _"Edit your global " }
    75                 ui.link {
    76                   module = "member", view = "settings_notification",
    77                   params = { return_to = "area", return_to_area_id = area.id },
    78                   text = _"notification settings"
    79                 }
    80                 ui.tag{ content = _" to receive updates by email" }
    81               end }
    82             end }
    83           end }
    84         end }
    85       end
    87       if app.session.member:has_voting_right_for_unit_id ( area.unit_id ) then
    88         ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function()
    89           ui.tag{ content = _"I want to vote" }
    90           ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
    91             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." }
    92           end }
    93         end }
    94       end
    96       if app.session.member and not app.session.member:has_voting_right_for_unit_id(area.unit_id) then
    97         ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = _"You are not entitled to vote in this unit" }
    98       end
   100       if app.session.member and app.session.member:has_voting_right_for_unit_id(area.unit_id) then
   102         if not config.disable_delegations then
   104           ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function()
   106             if not area.delegation_info.first_trustee_id then
   107               ui.tag{ content = _"I want to delegate this subject area" }
   108             else
   109               ui.container { attr = { class = "right" }, content = function()
   110                 local member = Member:by_id(area.delegation_info.first_trustee_id)
   111                 execute.view{
   112                   module = "member_image",
   113                   view = "_show",
   114                   params = {
   115                     member = member,
   116                     image_type = "avatar",
   117                     show_dummy = true
   118                   }
   119                 }
   120               end }
   121               ui.tag{ content = _"You delegated this subject area" }
   122             end
   124             ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
   125               if area.delegation_info.own_delegation_scope == "unit" then
   126                 ui.tag { tag = "li", content = function ()
   127                   ui.link {
   128                     module = "delegation", view = "show", params = {
   129                       unit_id = area.unit_id,
   130                     },
   131                     content = _("change/revoke delegation of organizational unit")
   132                   }
   133                 end }
   134               end
   136               if area.delegation_info.own_delegation_scope == nil then
   137                 ui.tag { tag = "li", content = function ()
   138                   ui.link {
   139                     module = "delegation", view = "show", params = {
   140                       area_id = area.id
   141                     },
   142                     content = _"choose subject area delegatee" 
   143                   }
   144                 end }
   145               elseif area.delegation_info.own_delegation_scope == "area" then
   146                 ui.tag { tag = "li", content = function ()
   147                   ui.link {
   148                     module = "delegation", view = "show", params = {
   149                       area_id = area.id
   150                     },
   151                     content = _"change/revoke area delegation" 
   152                   }
   153                 end }
   154               else
   155                 ui.tag { tag = "li", content = function ()
   156                   ui.link {
   157                     module = "delegation", view = "show", params = {
   158                       area_id = area.id
   159                     },
   160                     content = _"change/revoke delegation only for this subject area" 
   161                   }
   162                 end }
   163               end
   164             end }
   165           end }
   166         end 
   168         if app.session.member:has_initiative_right_for_unit_id ( area.unit_id ) then
   169           ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function()
   170             ui.tag{
   171               content = _("I want to start a new initiative", {
   172                 area_name = area.name
   173               } ) 
   174             }
   175             ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
   176               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." }
   177               ui.tag { tag = "li", content = function ()
   178                 ui.tag { content = function ()
   179                   ui.tag { content = _"If you cannot find any appropriate existing issue, " }
   180                   ui.link {
   181                     module = "initiative", view = "new",
   182                     params = { area_id = area.id },
   183                     text = _"start an initiative in a new issue"
   184                   }
   185                 end }
   186               end }
   187             end }
   188           end }
   189         end
   191       end
   192     else
   193       ui.container { attr = { class = "mdl-card__content mdl-card--border" }, content = function ()
   194         ui.tag{ content = _"You are not entitled to vote in this unit" }
   195         ui.tag{ tag = "ul", content = function()
   196           ui.tag{ tag = "li", content = function()
   197             ui.link{ module = "index", view = "login", content = _"Login" }
   198           end }
   199         end }
   200       end }
   201     end
   202   end }
   204 end }
