annotate app/main/admin/policy_list.lua @ 1508:64b0e610fe8e
Fixed search by role to member API endpoint
 | author | 
 bsw | 
 | date | 
 Fri Jul 31 12:38:37 2020 +0200 (2020-07-31) | 
 | parents | 
 6929d3ced007  | 
 | children | 
  | 
 
 | rev | 
   line source | 
| 
bsw@194
 | 
     1 local show_not_in_use = param.get("show_not_in_use", atom.boolean) or false
 | 
| 
bsw@194
 | 
     2 
 | 
| 
bsw@194
 | 
     3 local policies = Policy:build_selector{ active = not show_not_in_use }:exec()
 | 
| 
bsw@194
 | 
     4 
 | 
| 
bsw@194
 | 
     5 
 | 
| 
bsw@1045
 | 
     6 ui.titleAdmin(_"Policy list")
 | 
| 
bsw@194
 | 
     7 
 | 
| 
bsw@1462
 | 
     8 ui.grid{ content = function()
 | 
| 
bsw@194
 | 
     9 
 | 
| 
bsw@1462
 | 
    10   ui.cell_main{ content = function()
 | 
| 
bsw@1462
 | 
    11     ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function()
 | 
| 
bsw@1462
 | 
    12       ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
 | 
| 
bsw@1462
 | 
    13         ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = _"Policy list" }
 | 
| 
bsw@1462
 | 
    14       end }
 | 
| 
bsw@1462
 | 
    15       ui.container{ attr = { class = "mdl-card__content" }, content = function()
 | 
| 
bsw@1462
 | 
    16 
 | 
| 
bsw@1462
 | 
    17         if show_not_in_use then
 | 
| 
bsw@1462
 | 
    18           ui.link{
 | 
| 
bsw@1462
 | 
    19             text = _"Show policies in use",
 | 
| 
bsw@1462
 | 
    20             module = "admin",
 | 
| 
bsw@1462
 | 
    21             view = "policy_list"
 | 
| 
bsw@1462
 | 
    22           }
 | 
| 
bsw@194
 | 
    23 
 | 
| 
bsw@1462
 | 
    24         else
 | 
| 
bsw@1462
 | 
    25           ui.link{
 | 
| 
bsw@1462
 | 
    26             text = _"Create new policy",
 | 
| 
bsw@1462
 | 
    27             module = "admin",
 | 
| 
bsw@1462
 | 
    28             view = "policy_show"
 | 
| 
bsw@1462
 | 
    29           }
 | 
| 
bsw@1462
 | 
    30           slot.put(" · ")
 | 
| 
bsw@1462
 | 
    31           ui.link{
 | 
| 
bsw@1462
 | 
    32             text = _"Show policies not in use",
 | 
| 
bsw@1462
 | 
    33             module = "admin",
 | 
| 
bsw@1462
 | 
    34             view = "policy_list",
 | 
| 
bsw@1462
 | 
    35             params = { show_not_in_use = true }
 | 
| 
bsw@1462
 | 
    36           }
 | 
| 
bsw@1045
 | 
    37 
 | 
| 
bsw@1462
 | 
    38         end
 | 
| 
bsw@1045
 | 
    39 
 | 
| 
bsw@1462
 | 
    40         ui.list{
 | 
| 
bsw@1462
 | 
    41           records = policies,
 | 
| 
bsw@1462
 | 
    42           columns = {
 | 
| 
bsw@1045
 | 
    43 
 | 
| 
bsw@1462
 | 
    44             { content = function(record)
 | 
| 
bsw@1462
 | 
    45                 ui.link{
 | 
| 
bsw@1462
 | 
    46                   text = record.name,
 | 
| 
bsw@1462
 | 
    47                   module = "admin",
 | 
| 
bsw@1462
 | 
    48                   view = "policy_show",
 | 
| 
bsw@1462
 | 
    49                   id = record.id
 | 
| 
bsw@1462
 | 
    50                 }
 | 
| 
bsw@1462
 | 
    51               end
 | 
| 
bsw@1045
 | 
    52             }
 | 
| 
bsw@1462
 | 
    53 
 | 
| 
bsw@1462
 | 
    54           }
 | 
| 
bsw@1045
 | 
    55         }
 | 
| 
bsw@1462
 | 
    56       end }
 | 
| 
bsw@1462
 | 
    57     end }
 | 
| 
bsw@1462
 | 
    58   end }
 | 
| 
bsw@1462
 | 
    59 end }
 |