liquid_feedback_frontend
view app/main/issue/_sidebar.lua @ 1717:f41f5c5f8fa2
User cannot be not entitled to vote in root level
| author | bsw | 
|---|---|
| date | Mon Sep 27 12:44:07 2021 +0200 (2021-09-27) | 
| parents | 2f9e1e882de6 | 
| children | 
 line source
     1 local issue = param.get("issue", "table")
     2 local initiative = param.get("initiative", "table")
     4 local member = param.get ( "member", "table" )
     6 ui.container{ attr = { class = "mdl-card mdl-shadow--2dp mdl-card__fullwidth" }, content = function()
     8   ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
     9     ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = issue.name }
    10   end }
    12   if issue.admin_notice then
    13     ui.container{ attr = { class = "mdl-card__content mdl-card--border phases" }, content = function()
    14       slot.put(encode.html_newlines(issue.admin_notice)) 
    15     end }
    16   end
    18   ui.container{ attr = { class = "mdl-card__content mdl-card--border phases" }, content = function()
    19     execute.view{ module = "issue", view = "_sidebar_state", params = {
    20       issue = issue
    21     } }
    22   end }
    24   if app.session.member then
    25     if issue.fully_frozen then
    26       if issue.member_info.direct_voted then
    27         ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function()
    28           ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "mail_outline" }
    29           slot.put(" ")
    30           ui.tag { content = _"You have voted" }
    31         end }
    32       elseif active_trustee_id then
    33         ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function()
    34           ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "mail_outline" }
    35           slot.put(" ")
    36           ui.tag { content = _"You have voted via delegation" }
    37         end }
    38       end
    39     elseif not issue.closed then
    40       if issue.member_info.own_participation then
    41         ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function()
    42           ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "star" }
    43           slot.put(" ")
    44           ui.tag{ content = _"You are interested in this issue" }
    45         end }
    46       end
    47     end
    49     if not issue.closed then
    50       ui.container{ attr = { class = "mdl-card__actions" }, content = function()
    51         if issue.fully_frozen then
    52           if issue.member_info.direct_voted then
    53             if not issue.closed then
    54               ui.link {
    55                 attr = { class = "mdl-button mdl-js-button" },
    56                 module = "vote", view = "list", 
    57                 params = { issue_id = issue.id },
    58                 text = _"change vote"
    59               }
    60             else
    61               ui.link {
    62                 attr = { class = "mdl-button mdl-js-button" },
    63                 module = "vote", view = "list", 
    64                 params = { issue_id = issue.id },
    65                 text = _"show vote"
    66               }
    67             end
    68           elseif active_trustee_id then
    69             ui.link {
    70               attr = { class = "mdl-button mdl-js-button" },
    71               content = _"Show voting ballot",
    72               module = "vote", view = "list", params = {
    73                 issue_id = issue.id, member_id = active_trustee_id
    74               }
    75             }
    76           elseif not issue.closed then
    77             ui.link {
    78               attr = { class = "mdl-button mdl-js-button" },
    79               module = "vote", view = "list", 
    80               params = { issue_id = issue.id },
    81               text = _"vote now"
    82             }
    83           end
    84         elseif not issue.closed then
    85           if issue.member_info.own_participation then
    86             ui.link {
    87               attr = { class = "mdl-button mdl-js-button" },
    88               module = "interest", action = "update", 
    89               params = { issue_id = issue.id, interested = false },
    90               routing = { default = {
    91                 mode = "redirect", module = initiative and "initiative" or "issue", view = "show", id = initiative and initiative.id or issue.id
    92               } },
    93               text = _"remove my interest"
    94             }
    95           else
    96             ui.link {
    97               attr = { class = "mdl-button mdl-js-button" },
    98               module = "interest", action = "update", 
    99               params = { issue_id = issue.id, interested = true },
   100               routing = { default = {
   101                 mode = "redirect", module = initiative and "initiative" or "issue", view = "show", id = initiative and initiative.id or issue.id
   102               } },
   103               content = function()
   104                 ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "star" }
   105                 slot.put(" ")
   106                 ui.tag{ content = _"add my interest" }
   107               end 
   108             }
   109           end
   110         end
   111       end }
   112     end
   113   end
   115 end }
   117 if initiative then
   119   ui.container{ attr = { class = "mdl-card mdl-shadow--2dp mdl-card__fullwidth" }, content = function()
   120     ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
   121       ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = _"Competing initiatives" }
   122     end }
   124     execute.view { 
   125       module = "issue", view = "_sidebar_issue", 
   126       params = {
   127         issue = issue,
   128         ommit_initiative_id = initiative.id
   129       }
   130     }
   132   end }
   133 end
