liquid_feedback_frontend

changeset 1630:86a45c381bd9

Reworked check delegations view
author bsw
date Mon Feb 08 14:24:28 2021 +0100 (2021-02-08)
parents c5c18a861b85
children d9ccd0d6ef8c
files app/main/index/check_delegations.lua
line diff
     1.1 --- a/app/main/index/check_delegations.lua	Mon Feb 08 01:39:43 2021 +0100
     1.2 +++ b/app/main/index/check_delegations.lua	Mon Feb 08 14:24:28 2021 +0100
     1.3 @@ -2,107 +2,181 @@
     1.4      
     1.5  ui.title(_"Current unit and area delegations need confirmation")
     1.6  
     1.7 -ui.actions(function()
     1.8 -  if not app.session.needs_delegation_check then
     1.9 -    ui.link{ module = "index", view = "index", text = _"Cancel" }
    1.10 -  end
    1.11 -end)
    1.12  
    1.13 -ui.form{
    1.14 -  module = "index", action = "check_delegations",
    1.15 -  routing = {
    1.16 -    default = { mode = "redirect", module = "index", view = "index" },
    1.17 -    error = { mode = "redirect", module = "index", view = "check_delegations" }
    1.18 -  },
    1.19 -  content = function()
    1.20 +ui.grid{ content = function()
    1.21    
    1.22 -    ui.tag{ tag = "table", attr = { class = "striped" }, content = function()
    1.23 +  ui.cell_main{ content = function()
    1.24  
    1.25 -      ui.tag{ tag = "tr", content = function()
    1.26 -          
    1.27 -        ui.tag{ tag = "th", content = _"unit / area" }
    1.28 -        ui.tag{ tag = "th", content = _"delegated to" }
    1.29 -        ui.tag{ tag = "th", content = _"action" }
    1.30 -        
    1.31 +    ui.container { attr = { class = "mdl-card mdl-shadow--2dp mdl-card__fullwidth" }, content = function()
    1.32 +      ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
    1.33 +        ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = _("Current unit and area delegations need confirmation") }
    1.34        end }
    1.35 -      
    1.36 -      for i, delegation in ipairs(delegations) do
    1.37 -          
    1.38 -        local unit = Unit:by_id(delegation.unit_id)
    1.39 -        local area = Area:by_id(delegation.area_id)
    1.40 -        local member = Member:by_id(delegation.trustee_id)
    1.41 -        local info
    1.42 -        if area then
    1.43 -          area:load_delegation_info_once_for_member_id(app.session.member_id)
    1.44 -          info = area.delegation_info
    1.45 -        else
    1.46 -          unit:load_delegation_info_once_for_member_id(app.session.member_id)
    1.47 -          info = unit.delegation_info
    1.48 -        end
    1.49 +      ui.container{ attr = { class = "mdl-card__content" }, content = function()
    1.50  
    1.51 -        ui.tag{ tag = "tr", content = function ()
    1.52 -        
    1.53 -          ui.tag { tag = "td", content = function()
    1.54 -            ui.tag{ tag = "span", attr = { class = "unit_link" }, content = delegation.unit_name }
    1.55 -            ui.tag{ tag = "span", attr = { class = "area_link" }, content = delegation.area_name }
    1.56 -          end }
    1.57 +        ui.form{
    1.58 +          module = "index", action = "check_delegations",
    1.59 +          routing = {
    1.60 +            default = { mode = "redirect", module = "index", view = "index" },
    1.61 +            error = { mode = "redirect", module = "index", view = "check_delegations" }
    1.62 +          },
    1.63 +          content = function()
    1.64            
    1.65 -          ui.tag { tag = "td", content = function()
    1.66 -            if (member) then
    1.67 -              local text = _"delegates to"
    1.68 -              ui.image{
    1.69 -                attr = { class = "delegation_arrow", alt = text, title = text },
    1.70 -                static = "delegation_arrow_24_horizontal.png"
    1.71 -              }
    1.72 -              execute.view{ module = "member_image", view = "_show", params = {
    1.73 -                member = member, class = "micro_avatar", popup_text = member.name,
    1.74 -                  image_type = "avatar", show_dummy = true,
    1.75 -                } }
    1.76 -              slot.put(" ")
    1.77 -              ui.tag { tag = "span", content = delegation.member_name }
    1.78 -            else
    1.79 -              ui.tag{ tag = "span", content = _"Abandon unit delegation" }
    1.80 -            end
    1.81 -          end }
    1.82 -          
    1.83 -          ui.tag { tag = "td", content = function()
    1.84 -            local checked = config.check_delegations_default
    1.85 -            ui.tag{ tag = "input", attr = {
    1.86 -              type = "radio",
    1.87 -              id = "delegation_" .. delegation.id .. "_confirm",
    1.88 -              name = "delegation_" .. delegation.id,
    1.89 -              value = "confirm",
    1.90 -              checked = checked == "confirm" and "checked" or nil
    1.91 -            } }
    1.92 -            ui.tag{ 
    1.93 -              tag = "label", 
    1.94 -              attr = { ["for"] = "delegation_" .. delegation.id .. "_confirm" }, 
    1.95 -              content = _"confirm"
    1.96 +            ui.tag{
    1.97 +              tag = "table", attr = {
    1.98 +                class = "mdl-data-table mdl-js-data-table mdl-shadow--2dp"
    1.99 +              }, 
   1.100 +              content = function()
   1.101 +                ui.tag{ tag = "tr", content = function()
   1.102 +                    
   1.103 +                  ui.tag{
   1.104 +                    tag = "th", attr = {
   1.105 +                     class = "mdl-data-table__cell--non-numeric"
   1.106 +                    },
   1.107 +                    content = _"unit"
   1.108 +                  }
   1.109 +                  ui.tag{
   1.110 +                    tag = "th", attr = {
   1.111 +                     class = "mdl-data-table__cell--non-numeric"
   1.112 +                    },
   1.113 +                    content = _"area"
   1.114 +                  }
   1.115 +                  ui.tag{
   1.116 +                    tag = "th", attr = {
   1.117 +                      class = "mdl-data-table__cell--non-numeric"
   1.118 +                    },
   1.119 +                    content = _"delegated to"
   1.120 +                  }
   1.121 +                  ui.tag{
   1.122 +                    tag = "th", attr = {
   1.123 +                      class = "mdl-data-table__cell--non-numeric"
   1.124 +                    },
   1.125 +                    content = _"action"
   1.126 +                  }
   1.127 +                end }
   1.128 +                
   1.129 +                for i, delegation in ipairs(delegations) do
   1.130 +                    
   1.131 +                  local unit = Unit:by_id(delegation.unit_id)
   1.132 +                  local area = Area:by_id(delegation.area_id)
   1.133 +                  local member = Member:by_id(delegation.trustee_id)
   1.134 +                  local info
   1.135 +                  if area then
   1.136 +                    area:load_delegation_info_once_for_member_id(app.session.member_id)
   1.137 +                    info = area.delegation_info
   1.138 +                  else
   1.139 +                    unit:load_delegation_info_once_for_member_id(app.session.member_id)
   1.140 +                    info = unit.delegation_info
   1.141 +                  end
   1.142 +
   1.143 +                  ui.tag{ tag = "tr", content = function ()
   1.144 +                  
   1.145 +                    ui.tag {
   1.146 +                      tag = "td",
   1.147 +                      attr = {
   1.148 +                        class = "mdl-data-table__cell--non-numeric"
   1.149 +                      },
   1.150 +                      content = delegation.unit_name
   1.151 +                    }
   1.152 +                    ui.tag {
   1.153 +                      tag = "td",
   1.154 +                      attr = {
   1.155 +                        class = "mdl-data-table__cell--non-numeric"
   1.156 +                      },
   1.157 +                      content = delegation.area_name
   1.158 +                    }
   1.159 +                    ui.tag {
   1.160 +                      tag = "td",
   1.161 +                      attr = {
   1.162 +                        class = "mdl-data-table__cell--non-numeric"
   1.163 +                      },
   1.164 +                      content = function()
   1.165 +                        if (member) then
   1.166 +                          local text = _"delegates to"
   1.167 +                          ui.image{
   1.168 +                            attr = { class = "delegation_arrow", alt = text, title = text },
   1.169 +                            static = "delegation_arrow_24_horizontal.png"
   1.170 +                          }
   1.171 +                          execute.view{ module = "member_image", view = "_show", params = {
   1.172 +                            member = member, class = "micro_avatar", popup_text = member.name,
   1.173 +                              image_type = "avatar", show_dummy = true,
   1.174 +                            } }
   1.175 +                          slot.put(" ")
   1.176 +                          ui.tag { tag = "span", content = delegation.member_name }
   1.177 +                        else
   1.178 +                          ui.tag{ tag = "span", content = _"Abandon unit delegation" }
   1.179 +                        end
   1.180 +                      end
   1.181 +                    }
   1.182 +                    
   1.183 +                    ui.tag {
   1.184 +                      tag = "td",
   1.185 +                      attr = {
   1.186 +                        class = "mdl-data-table__cell--non-numeric"
   1.187 +                      },
   1.188 +                      content = function()
   1.189 +                        local checked = config.check_delegations_default
   1.190 +                        ui.tag{ tag = "input", attr = {
   1.191 +                          type = "radio",
   1.192 +                          id = "delegation_" .. delegation.id .. "_confirm",
   1.193 +                          name = "delegation_" .. delegation.id,
   1.194 +                          value = "confirm",
   1.195 +                          checked = checked == "confirm" and "checked" or nil
   1.196 +                        } }
   1.197 +                        ui.tag{ 
   1.198 +                          tag = "label", 
   1.199 +                          attr = { ["for"] = "delegation_" .. delegation.id .. "_confirm" }, 
   1.200 +                          content = _"confirm"
   1.201 +                        }
   1.202 +                        ui.tag{ tag = "input", attr = {
   1.203 +                          type = "radio", 
   1.204 +                          id = "delegation_" .. delegation.id .. "_revoke",
   1.205 +                          name = "delegation_" .. delegation.id,
   1.206 +                          value = "revoke",
   1.207 +                          checked = checked == "revoke" and "checked" or nil 
   1.208 +                        } }
   1.209 +                        ui.tag{ 
   1.210 +                          tag = "label", 
   1.211 +                          attr = { ["for"] = "delegation_" .. delegation.id .. "_revoke" }, 
   1.212 +                          content = _"revoke"
   1.213 +                        }
   1.214 +                      end
   1.215 +                    }
   1.216 +
   1.217 +                  end }
   1.218 +                
   1.219 +                end
   1.220 +              
   1.221 +              end
   1.222              }
   1.223 -            ui.tag{ tag = "input", attr = {
   1.224 -              type = "radio", 
   1.225 -              id = "delegation_" .. delegation.id .. "_revoke",
   1.226 -              name = "delegation_" .. delegation.id,
   1.227 -              value = "revoke",
   1.228 -              checked = checked == "revoke" and "checked" or nil 
   1.229 -            } }
   1.230 -            ui.tag{ 
   1.231 -              tag = "label", 
   1.232 -              attr = { ["for"] = "delegation_" .. delegation.id .. "_revoke" }, 
   1.233 -              content = _"revoke"
   1.234 -            }
   1.235 -          end}
   1.236 -
   1.237 -        end }
   1.238 -        
   1.239 -      end
   1.240 -      
   1.241 -    end}
   1.242  
   1.243  
   1.244 -    slot.put("<br />")
   1.245 +            slot.put("<br />")
   1.246 +
   1.247 +            ui.submit{
   1.248 +              attr = { class = "mdl-button mdl-js-button mdl-button--raised mdl-button--colored" },
   1.249 +              text = _"Finish delegation check"
   1.250 +            }
   1.251 +            if not app.session.needs_delegation_check then
   1.252 +              slot.put(" &nbsp; ")
   1.253 +              ui.link{
   1.254 +                attr = { class = "mdl-button mdl-js-button" },
   1.255 +                module = "index", view = "index", text = _"Cancel"
   1.256 +              }
   1.257 +            end
   1.258  
   1.259 -    ui.submit{ text = _"Finish delegation check" }
   1.260 -  
   1.261 -  end
   1.262 -}
   1.263 +          
   1.264 +          end
   1.265 +        }
   1.266 +
   1.267 +
   1.268 +      end }
   1.269 +    end }
   1.270 +  end }
   1.271 +
   1.272 +end }
   1.273 +
   1.274 +
   1.275 +
   1.276 +
   1.277 +
   1.278 +

Impressum / About Us