liquid_feedback_frontend

diff app/main/initiative/_suggestions.lua @ 1658:c08690678b2d

Do not show authors as avatar, improved suggestion rating info
author bsw
date Sun Feb 14 13:27:21 2021 +0100 (2021-02-14)
parents 4188405c2425
children c33916811ca7
line diff
     1.1 --- a/app/main/initiative/_suggestions.lua	Sun Feb 14 13:12:08 2021 +0100
     1.2 +++ b/app/main/initiative/_suggestions.lua	Sun Feb 14 13:27:21 2021 +0100
     1.3 @@ -176,7 +176,12 @@
     1.4                content = function ()
     1.5                
     1.6                  if app.session:has_access("authors_pseudonymous") then
     1.7 -                  util.micro_avatar ( suggestion.author )
     1.8 +                  ui.tag{ content = _"by" }
     1.9 +                  slot.put(" ")
    1.10 +                  ui.link{
    1.11 +                    module = "member", view = "show", id = suggestion.author_id,
    1.12 +                    content = suggestion.author.name
    1.13 +                  }
    1.14                  end
    1.15                  
    1.16                  execute.view{
    1.17 @@ -230,77 +235,79 @@
    1.18  
    1.19            ui.container { attr = { class = "mdl-card__actions mdl-card--border" }, content = function()
    1.20  
    1.21 -            ui.container{ attr = { class = "float-right" }, content = function()
    1.22 -              ui.tag{ attr = { id = "s" .. suggestion.id .. "_rating_text" }, content = function()
    1.23 -                local text = ""
    1.24 -                if opinion then
    1.25 -                  if opinion.degree == 2 then
    1.26 -                    text = _"must"
    1.27 -                  elseif opinion.degree == 1 then
    1.28 -                    text = _"should"
    1.29 -                  elseif opinion.degree == 0 then
    1.30 -                    text = _"neutral"
    1.31 -                  elseif opinion.degree == -1 then
    1.32 -                    text = _"should not"
    1.33 -                  elseif opinion.degree == -2 then
    1.34 -                    text = _"must not"
    1.35 +            if direct_supporter then
    1.36 +              ui.container{ attr = { class = "suggestion_rating_info" }, content = function()
    1.37 +                ui.tag{ attr = { id = "s" .. suggestion.id .. "_rating_text" }, content = function()
    1.38 +                  local text = ""
    1.39 +                  if opinion then
    1.40 +                    if opinion.degree == 2 then
    1.41 +                      text = _"must"
    1.42 +                    elseif opinion.degree == 1 then
    1.43 +                      text = _"should"
    1.44 +                    elseif opinion.degree == 0 then
    1.45 +                      text = _"neutral"
    1.46 +                    elseif opinion.degree == -1 then
    1.47 +                      text = _"should not"
    1.48 +                    elseif opinion.degree == -2 then
    1.49 +                      text = _"must not"
    1.50 +                    end
    1.51 +                    ui.tag { content = text }
    1.52 +                    slot.put ( " " )
    1.53 +                    if 
    1.54 +                      (opinion.degree > 0 and not opinion.fulfilled)
    1.55 +                      or (opinion.degree < 0 and opinion.fulfilled)
    1.56 +                    then
    1.57 +                      ui.tag{ content = _"but" }
    1.58 +                    else
    1.59 +                      ui.tag{ content = _"and" }
    1.60 +                    end
    1.61 +                    slot.put ( " " )
    1.62 +                    local text = ""
    1.63 +                    if opinion.fulfilled then
    1.64 +                      text = _"is implemented"
    1.65 +                    else
    1.66 +                      text = _"is not implemented"
    1.67 +                    end
    1.68 +                    ui.tag { content = text }
    1.69                    end
    1.70 -                  ui.tag { content = text }
    1.71 -                  slot.put ( " " )
    1.72 -                  if 
    1.73 +                end }
    1.74 +                local id = "s" .. suggestion.id .. "_rating_icon"
    1.75 +                if opinion and (
    1.76                      (opinion.degree > 0 and not opinion.fulfilled)
    1.77                      or (opinion.degree < 0 and opinion.fulfilled)
    1.78 -                  then
    1.79 -                    ui.tag{ content = _"but" }
    1.80 +                  )
    1.81 +                then
    1.82 +                  slot.put(" ")
    1.83 +                  if math.abs(opinion.degree) > 1 then
    1.84 +                    ui.icon("warning", "red", id)
    1.85                    else
    1.86 -                    ui.tag{ content = _"and" }
    1.87 +                    ui.icon("warning", nil, id)
    1.88                    end
    1.89 -                  slot.put ( " " )
    1.90 -                  local text = ""
    1.91 -                  if opinion.fulfilled then
    1.92 -                    text = _"is implemented"
    1.93 -                  else
    1.94 -                    text = _"is not implemented"
    1.95 -                  end
    1.96 -                  ui.tag { content = text }
    1.97 +                elseif opinion then
    1.98 +                  slot.put(" ")
    1.99 +                  ui.icon("done", nil, id)
   1.100 +                else
   1.101 +                  slot.put(" ")
   1.102 +                  ui.icon("blank", nil, id)
   1.103                  end
   1.104                end }
   1.105 -              local id = "s" .. suggestion.id .. "_rating_icon"
   1.106 -              if opinion and (
   1.107 -                  (opinion.degree > 0 and not opinion.fulfilled)
   1.108 -                  or (opinion.degree < 0 and opinion.fulfilled)
   1.109 -                )
   1.110 -              then
   1.111 -                slot.put(" ")
   1.112 -                if math.abs(opinion.degree) > 1 then
   1.113 -                  ui.icon("warning", "red", id)
   1.114 -                else
   1.115 -                  ui.icon("warning", nil, id)
   1.116 +              
   1.117 +              ui.link{
   1.118 +                attr = {
   1.119 +                  id = "s" .. suggestion.id .. "_rate_button",
   1.120 +                  class = "mdl-button",
   1.121 +                  onclick = "rateSuggestion(" .. suggestion.id .. ", " .. (opinion and opinion.degree or 0) .. ", " .. (opinion and (opinion.fulfilled and "true" or "false") or "null") .. ");return false;"
   1.122 +                },
   1.123 +                content = function()
   1.124 +                  if opinion then
   1.125 +                    ui.tag { content = _"update rating" }
   1.126 +                  else
   1.127 +                    ui.tag { content = _"rate suggestion" }
   1.128 +                  end
   1.129                  end
   1.130 -              elseif opinion then
   1.131 -                slot.put(" ")
   1.132 -                ui.icon("done", nil, id)
   1.133 -              else
   1.134 -                slot.put(" ")
   1.135 -                ui.icon("blank", nil, id)
   1.136 -              end
   1.137 -            end }
   1.138 -            
   1.139 -            ui.link{
   1.140 -              attr = {
   1.141 -                id = "s" .. suggestion.id .. "_rate_button",
   1.142 -                class = "mdl-button",
   1.143 -                onclick = "rateSuggestion(" .. suggestion.id .. ", " .. (opinion and opinion.degree or 0) .. ", " .. (opinion and (opinion.fulfilled and "true" or "false") or "null") .. ");return false;"
   1.144 -              },
   1.145 -              content = function()
   1.146 -                if opinion then
   1.147 -                  ui.tag { content = _"update rating" }
   1.148 -                else
   1.149 -                  ui.tag { content = _"rate suggestion" }
   1.150 -                end
   1.151 -              end
   1.152 -            }
   1.153 -          
   1.154 +              }
   1.155 +            end
   1.156 +                      
   1.157              ui.link{
   1.158                attr = { class = "mdl-button" },
   1.159                content = _"Details",

Impressum / About Us