liquid_feedback_frontend
view app/main/area/_sidebar_whatcanido.lua @ 1846:d257418700bf
Incremented css version
| author | bsw | 
|---|---|
| date | Thu Feb 03 16:04:33 2022 +0100 (2022-02-03) | 
| parents | 4edec387855f | 
| children | 
 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                 local text = _"Edit your global <link>notification settings</link> to receive updates by email."
    75                 local text_pre, text_link, text_post = string.match(text, "([^<]*)<link>([^<]+)</link>([^<]*)")
    76                 ui.tag{ content = text_pre }
    77                 ui.link {
    78                   module = "member", view = "settings_notification",
    79                   params = { return_to = "area", return_to_area_id = area.id },
    80                   text = text_link
    81                 }
    82                 ui.tag{ content = text_post }
    83               end }
    84             end }
    85           end }
    86         end }
    87       end
    89       if app.session.member and app.session.member:has_voting_right_for_unit_id(area.unit_id) then
    91         if not config.disable_delegations then
    93           ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function()
    95             if not area.delegation_info.first_trustee_id then
    96               ui.tag{ content = _"I want to delegate this subject area" }
    97             else
    98               ui.tag{ content = _"You delegated this subject area" }
    99             end
   101             ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
   102               if area.delegation_info.own_delegation_scope == "unit" then
   103                 ui.tag { tag = "li", content = function ()
   104                   ui.link {
   105                     module = "delegation", view = "show", params = {
   106                       unit_id = area.unit_id,
   107                     },
   108                     content = _("change/revoke delegation of organizational unit")
   109                   }
   110                 end }
   111               end
   113               if area.delegation_info.own_delegation_scope == nil then
   114                 ui.tag { tag = "li", content = function ()
   115                   ui.link {
   116                     module = "delegation", view = "show", params = {
   117                       area_id = area.id
   118                     },
   119                     content = _"choose subject area delegatee" 
   120                   }
   121                 end }
   122               elseif area.delegation_info.own_delegation_scope == "area" then
   123                 ui.tag { tag = "li", content = function ()
   124                   ui.link {
   125                     module = "delegation", view = "show", params = {
   126                       area_id = area.id
   127                     },
   128                     content = _"change/revoke area delegation" 
   129                   }
   130                 end }
   131               else
   132                 ui.tag { tag = "li", content = function ()
   133                   ui.link {
   134                     module = "delegation", view = "show", params = {
   135                       area_id = area.id
   136                     },
   137                     content = _"change/revoke delegation only for this subject area" 
   138                   }
   139                 end }
   140               end
   141             end }
   142           end }
   143         end 
   145         if app.session.member:has_initiative_right_for_unit_id ( area.unit_id ) then
   146           ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function()
   147             ui.tag{
   148               content = _("I want to start a new initiative", {
   149                 area_name = area.name
   150               } ) 
   151             }
   152             ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
   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." }
   154               ui.tag { tag = "li", content = function ()
   155                 ui.tag { content = function ()
   156                   ui.tag { content = _"If you cannot find any appropriate existing issue, " }
   157                   ui.link {
   158                     module = "draft", view = "new",
   159                     params = { area_id = area.id },
   160                     text = _"start an initiative in a new issue"
   161                   }
   162                 end }
   163               end }
   164             end }
   165           end }
   166         end
   167       end
   168       if app.session.member:has_voting_right_for_unit_id ( area.unit_id ) then
   169         ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function()
   170           ui.tag{ content = _"I want to vote" }
   171           ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
   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." }
   173           end }
   174         end }
   175       end
   176     else
   177       ui.container { attr = { class = "mdl-card__content mdl-card--border" }, content = function ()
   178         if not app.session.member_id then
   179           ui.tag{ content = _"Login to participate" }
   180           ui.tag{ tag = "ul", content = function()
   181             ui.tag{ tag = "li", content = function()
   182               ui.link{ module = "index", view = "login", content = _"Login [button]" }
   183             end }
   184           end }
   185         else
   186           ui.tag{ content = _"You are not entitled to vote in this unit" }
   187         end
   188       end }
   189     end
   190   end }
   192 end }
