liquid_feedback_frontend
view app/main/area/_sidebar_whatcanido.lua @ 1790:20c1c8cc28ba
Splitted different meanings of rejected, specified context of accepted and invited
| author | bsw | 
|---|---|
| date | Wed Oct 20 15:48:51 2021 +0200 (2021-10-20) | 
| parents | b27b327be05e | 
| children | 4edec387855f | 
 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 and app.session.member:has_voting_right_for_unit_id(area.unit_id) then
    89         if not config.disable_delegations then
    91           ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function()
    93             if not area.delegation_info.first_trustee_id then
    94               ui.tag{ content = _"I want to delegate this subject area" }
    95             else
    96               ui.tag{ content = _"You delegated this subject area" }
    97             end
    99             ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
   100               if area.delegation_info.own_delegation_scope == "unit" then
   101                 ui.tag { tag = "li", content = function ()
   102                   ui.link {
   103                     module = "delegation", view = "show", params = {
   104                       unit_id = area.unit_id,
   105                     },
   106                     content = _("change/revoke delegation of organizational unit")
   107                   }
   108                 end }
   109               end
   111               if area.delegation_info.own_delegation_scope == nil then
   112                 ui.tag { tag = "li", content = function ()
   113                   ui.link {
   114                     module = "delegation", view = "show", params = {
   115                       area_id = area.id
   116                     },
   117                     content = _"choose subject area delegatee" 
   118                   }
   119                 end }
   120               elseif area.delegation_info.own_delegation_scope == "area" then
   121                 ui.tag { tag = "li", content = function ()
   122                   ui.link {
   123                     module = "delegation", view = "show", params = {
   124                       area_id = area.id
   125                     },
   126                     content = _"change/revoke area delegation" 
   127                   }
   128                 end }
   129               else
   130                 ui.tag { tag = "li", content = function ()
   131                   ui.link {
   132                     module = "delegation", view = "show", params = {
   133                       area_id = area.id
   134                     },
   135                     content = _"change/revoke delegation only for this subject area" 
   136                   }
   137                 end }
   138               end
   139             end }
   140           end }
   141         end 
   143         if app.session.member:has_initiative_right_for_unit_id ( area.unit_id ) then
   144           ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function()
   145             ui.tag{
   146               content = _("I want to start a new initiative", {
   147                 area_name = area.name
   148               } ) 
   149             }
   150             ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
   151               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." }
   152               ui.tag { tag = "li", content = function ()
   153                 ui.tag { content = function ()
   154                   ui.tag { content = _"If you cannot find any appropriate existing issue, " }
   155                   ui.link {
   156                     module = "draft", view = "new",
   157                     params = { area_id = area.id },
   158                     text = _"start an initiative in a new issue"
   159                   }
   160                 end }
   161               end }
   162             end }
   163           end }
   164         end
   165       end
   166       if app.session.member:has_voting_right_for_unit_id ( area.unit_id ) then
   167         ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function()
   168           ui.tag{ content = _"I want to vote" }
   169           ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
   170             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." }
   171           end }
   172         end }
   173       end
   174     else
   175       ui.container { attr = { class = "mdl-card__content mdl-card--border" }, content = function ()
   176         if not app.session.member_id then
   177           ui.tag{ content = _"Login to participate" }
   178           ui.tag{ tag = "ul", content = function()
   179             ui.tag{ tag = "li", content = function()
   180               ui.link{ module = "index", view = "login", content = _"Login [button]" }
   181             end }
   182           end }
   183         else
   184           ui.tag{ content = _"You are not entitled to vote in this unit" }
   185         end
   186       end }
   187     end
   188   end }
   190 end }
