liquid_feedback_frontend

diff app/main/member/settings_agent.lua @ 1309:32cc544d5a5b

Cumulative patch for upcoming frontend version 4
author bsw/jbe
date Sun Jul 15 14:07:29 2018 +0200 (2018-07-15)
parents
children 678c7146f27b
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/app/main/member/settings_agent.lua	Sun Jul 15 14:07:29 2018 +0200
     1.3 @@ -0,0 +1,118 @@
     1.4 +if not app.session.member.role then
     1.5 +  return
     1.6 +end
     1.7 +
     1.8 +ui.titleMember(_"Account access")
     1.9 +
    1.10 +ui.grid{ content = function()
    1.11 +
    1.12 +  ui.cell_main{ content = function()
    1.13 +    ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function()
    1.14 +      ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
    1.15 +        ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = _"Agents" }
    1.16 +      end }
    1.17 +      ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function()
    1.18 +      
    1.19 +        local agents = Agent:new_selector()
    1.20 +          :add_where{ "controlled_id = ?", app.session.member_id }
    1.21 +          :exec()
    1.22 +          
    1.23 +        if #(agents) > 0 then
    1.24 +          ui.list{
    1.25 +            records = agents,
    1.26 +            columns = {
    1.27 +              {
    1.28 +                label = _"Account access by member",
    1.29 +                content = function(record)
    1.30 +                  ui.tag{ content = record.controller.name }
    1.31 +                end
    1.32 +              },
    1.33 +              {
    1.34 +                label = _"Status",
    1.35 +                content = function(record)
    1.36 +                  local text
    1.37 +                  if record.accepted then
    1.38 +                    text = _"accepted"
    1.39 +                  elseif record.accepted == false then
    1.40 +                    text = _"rejected"
    1.41 +                  else
    1.42 +                    text = _"not decided yet"
    1.43 +                  end
    1.44 +                  ui.tag{ content = text }
    1.45 +                end
    1.46 +              },
    1.47 +              {
    1.48 +                content = function(record)
    1.49 +                  ui.link{ content = _"Revoke", module = "member", action = "update_agent", params = { delete = true, controller_id = record.controller_id } }
    1.50 +                end
    1.51 +              },
    1.52 +            }
    1.53 +          }
    1.54 +        else
    1.55 +          ui.container{ content = _"No other members are allowed to use this account." }
    1.56 +        end
    1.57 +      
    1.58 +      end }
    1.59 +      ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function()
    1.60 +
    1.61 +        ui.form{
    1.62 +          attr = { class = "wide" },
    1.63 +          module = "member",
    1.64 +          action = "update_agent",
    1.65 +          routing = {
    1.66 +            ok = {
    1.67 +              mode = "redirect",
    1.68 +              module = "member",
    1.69 +              view = "settings_agent"
    1.70 +            }
    1.71 +          },
    1.72 +          content = function()
    1.73 +          
    1.74 +            ui.container{ content = _"Add new account access privilege" }
    1.75 +          
    1.76 +            local contact_members = Member:build_selector{
    1.77 +              is_contact_of_member_id = app.session.member_id,
    1.78 +              active = true,
    1.79 +              order = "name"
    1.80 +            }:add_where("NOT member.role"):exec()
    1.81 +
    1.82 +            ui.field.select{
    1.83 +              name = "controller_id",
    1.84 +              foreign_records = contact_members,
    1.85 +              foreign_id = "id",
    1.86 +              foreign_name = "name"
    1.87 +            }            
    1.88 +            slot.put("<br />")
    1.89 +            
    1.90 +            ui.tag{
    1.91 +              tag = "input",
    1.92 +              attr = {
    1.93 +                type = "submit",
    1.94 +                class = "mdl-button mdl-js-button mdl-button--raised mdl-button--colored",
    1.95 +                value = _"Grant account access"
    1.96 +              },
    1.97 +              content = ""
    1.98 +            }
    1.99 +            slot.put(" &nbsp; ")
   1.100 +            ui.link {
   1.101 +              attr = { class = "mdl-button mdl-js-button mdl-button--raised" },
   1.102 +              module = "member", view = "show", id = app.session.member_id,
   1.103 +              content = _"Cancel"
   1.104 +            }
   1.105 +          end
   1.106 +        }
   1.107 +
   1.108 +      end }
   1.109 +    end }
   1.110 +  end }
   1.111 +
   1.112 +  ui.cell_sidebar{ content = function()
   1.113 +    execute.view {
   1.114 +      module = "member", view = "_sidebar_whatcanido", params = {
   1.115 +        member = app.session.member
   1.116 +      }
   1.117 +    }
   1.118 +  end }
   1.119 +  
   1.120 +end }
   1.121 +      

Impressum / About Us