liquid_feedback_frontend
view app/main/agent/show.lua @ 1807:dd966ebdfa04
Fixed layout of checkbox label in survey
| author | bsw | 
|---|---|
| date | Thu Nov 18 14:54:49 2021 +0100 (2021-11-18) | 
| parents | 32cc544d5a5b | 
| children | 
 line source
     1 local controlled_id = param.get("controlled_id")
     4 ui.titleMember(_"Account access")
     6 ui.grid{ content = function()
     8   ui.cell_main{ content = function()
     9     ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function()
    10       ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
    11         ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = _"Account access" }
    12       end }
    13       ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function()
    15         local agent = Agent:new_selector()
    16           :add_where{ "controller_id = ?", app.session.member_id }
    17           :add_where{ "controlled_id = ?", controlled_id }
    18           :optional_object_mode()
    19           :exec()
    21         if agent then
    23           if agent.accepted == nil then
    24             ui.container{ content = _"You have been granted access privileges for the following account:" }
    25           elseif agent.accepted == true then
    26             ui.container{ content = _"You have accepted access privileges for the following account:" }
    27           elseif agent.accepted == false then
    28             ui.container{ content = _"You have rejected access privileges for the following account:" }
    29           end
    31           slot.put("<br>")
    32           ui.link{
    33             content = agent.controllee.display_name,
    34             module = "member", view = "show", id = agent.controlled_id
    35           }
    36           slot.put("<br><br>")
    38           ui.form{
    39             attr = { class = "wide" },
    40             module = "agent",
    41             action = "accept",
    42             params = { controlled_id = controlled_id },
    43             routing = {
    44               ok = {
    45                 mode = "redirect",
    46                 module = "agent",
    47                 view = "show",
    48                 params = { controlled_id = controlled_id },
    49               }
    50             },
    51             content = function()
    53               if agent.accepted == nil then
    54                 ui.tag{
    55                   tag = "input",
    56                   attr = {
    57                     type = "submit",
    58                     class = "mdl-button mdl-js-button mdl-button--raised mdl-button--colored",
    59                     value = _"Accept access privilege",
    60                     name = "accepted"
    61                   },
    62                   content = ""
    63                 }
    64                 slot.put("   ")
    65                 ui.tag{
    66                   tag = "input",
    67                   attr = {
    68                     type = "submit",
    69                     class = "mdl-button mdl-js-button mdl-button--raised",
    70                     value = _"Reject access privilege",
    71                     name = "rejected"
    72                   },
    73                   content = ""
    74                 }
    75               end
    76               slot.put("   ")
    77               ui.link {
    78                 attr = { class = "mdl-button mdl-js-button" },
    79                 module = "index", view = "index",
    80                 content = _"Cancel"
    81               }
    82             end
    83           }
    85         end
    87       end }
    88     end }
    89   end }
    91   ui.cell_sidebar{ content = function()
    92     execute.view {
    93       module = "member", view = "_sidebar_whatcanido", params = {
    94         member = app.session.member
    95       }
    96     }
    97   end }
    99 end }
