liquid_feedback_frontend
view app/main/area/_sidebar_whatcanido.lua @ 1665:97dfef4eb2d7
Optionally show attachment previews in listings
| author | bsw | 
|---|---|
| date | Mon Feb 15 15:24:26 2021 +0100 (2021-02-15) | 
| parents | 52545dba4205 | 
| children | 58e1e8d6f596 | 
 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.tag{ content = _"You delegated this subject area" }
   110             end
   112             ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
   113               if area.delegation_info.own_delegation_scope == "unit" then
   114                 ui.tag { tag = "li", content = function ()
   115                   ui.link {
   116                     module = "delegation", view = "show", params = {
   117                       unit_id = area.unit_id,
   118                     },
   119                     content = _("change/revoke delegation of organizational unit")
   120                   }
   121                 end }
   122               end
   124               if area.delegation_info.own_delegation_scope == nil then
   125                 ui.tag { tag = "li", content = function ()
   126                   ui.link {
   127                     module = "delegation", view = "show", params = {
   128                       area_id = area.id
   129                     },
   130                     content = _"choose subject area delegatee" 
   131                   }
   132                 end }
   133               elseif area.delegation_info.own_delegation_scope == "area" then
   134                 ui.tag { tag = "li", content = function ()
   135                   ui.link {
   136                     module = "delegation", view = "show", params = {
   137                       area_id = area.id
   138                     },
   139                     content = _"change/revoke area delegation" 
   140                   }
   141                 end }
   142               else
   143                 ui.tag { tag = "li", content = function ()
   144                   ui.link {
   145                     module = "delegation", view = "show", params = {
   146                       area_id = area.id
   147                     },
   148                     content = _"change/revoke delegation only for this subject area" 
   149                   }
   150                 end }
   151               end
   152             end }
   153           end }
   154         end 
   156         if app.session.member:has_initiative_right_for_unit_id ( area.unit_id ) then
   157           ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function()
   158             ui.tag{
   159               content = _("I want to start a new initiative", {
   160                 area_name = area.name
   161               } ) 
   162             }
   163             ui.tag { tag = "ul", attr = { class = "ul" }, content = function ()
   164               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." }
   165               ui.tag { tag = "li", content = function ()
   166                 ui.tag { content = function ()
   167                   ui.tag { content = _"If you cannot find any appropriate existing issue, " }
   168                   ui.link {
   169                     module = "draft", view = "new",
   170                     params = { area_id = area.id },
   171                     text = _"start an initiative in a new issue"
   172                   }
   173                 end }
   174               end }
   175             end }
   176           end }
   177         end
   179       end
   180     else
   181       ui.container { attr = { class = "mdl-card__content mdl-card--border" }, content = function ()
   182         ui.tag{ content = _"You are not entitled to vote in this unit" }
   183         ui.tag{ tag = "ul", content = function()
   184           ui.tag{ tag = "li", content = function()
   185             ui.link{ module = "index", view = "login", content = _"Login" }
   186           end }
   187         end }
   188       end }
   189     end
   190   end }
   192 end }
