annotate app/main/admin/policy_list.lua @ 389:d75ace4af616
Removed debug code
 | author | 
 bsw | 
 | date | 
 Mon Mar 05 17:44:59 2012 +0100 (2012-03-05) | 
 | parents | 
 c0292c3a70d8  | 
 | children | 
 b5684668ac4b  | 
 
 | 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@194
 | 
     6 slot.put_into("title", _"Policy list")
 | 
| 
bsw@194
 | 
     7 
 | 
| 
bsw@194
 | 
     8 
 | 
| 
bsw@194
 | 
     9 slot.select("actions", function()
 | 
| 
bsw@194
 | 
    10 
 | 
| 
bsw@194
 | 
    11   if show_not_in_use then
 | 
| 
bsw@194
 | 
    12     ui.link{
 | 
| 
bsw@194
 | 
    13       attr = { class = { "admin_only" } },
 | 
| 
bsw@194
 | 
    14       text = _"Show policies in use",
 | 
| 
bsw@194
 | 
    15       module = "admin",
 | 
| 
bsw@194
 | 
    16       view = "policy_list"
 | 
| 
bsw@194
 | 
    17     }
 | 
| 
bsw@194
 | 
    18 
 | 
| 
bsw@194
 | 
    19   else
 | 
| 
bsw@194
 | 
    20     ui.link{
 | 
| 
bsw@194
 | 
    21       attr = { class = { "admin_only" } },
 | 
| 
bsw@194
 | 
    22       text = _"Create new policy",
 | 
| 
bsw@194
 | 
    23       module = "admin",
 | 
| 
bsw@194
 | 
    24       view = "policy_show"
 | 
| 
bsw@194
 | 
    25     }
 | 
| 
bsw@194
 | 
    26     ui.link{
 | 
| 
bsw@194
 | 
    27       attr = { class = { "admin_only" } },
 | 
| 
bsw@194
 | 
    28       text = _"Show policies not in use",
 | 
| 
bsw@194
 | 
    29       module = "admin",
 | 
| 
bsw@194
 | 
    30       view = "policy_list",
 | 
| 
bsw@194
 | 
    31       params = { show_not_in_use = true }
 | 
| 
bsw@194
 | 
    32     }
 | 
| 
bsw@194
 | 
    33 
 | 
| 
bsw@194
 | 
    34   end
 | 
| 
bsw@194
 | 
    35 
 | 
| 
bsw@194
 | 
    36 end)
 | 
| 
bsw@194
 | 
    37 
 | 
| 
bsw@194
 | 
    38 
 | 
| 
bsw@194
 | 
    39 ui.list{
 | 
| 
bsw@194
 | 
    40   records = policies,
 | 
| 
bsw@194
 | 
    41   columns = {
 | 
| 
bsw@194
 | 
    42 
 | 
| 
bsw@194
 | 
    43     { label = _"Policy", name = "name" },
 | 
| 
bsw@194
 | 
    44 
 | 
| 
bsw@194
 | 
    45     { content = function(record)
 | 
| 
bsw@194
 | 
    46         ui.link{
 | 
| 
bsw@194
 | 
    47           attr = { class = { "action admin_only" } },
 | 
| 
bsw@194
 | 
    48           text = _"Edit",
 | 
| 
bsw@194
 | 
    49           module = "admin",
 | 
| 
bsw@194
 | 
    50           view = "policy_show",
 | 
| 
bsw@194
 | 
    51           id = record.id
 | 
| 
bsw@194
 | 
    52         }
 | 
| 
bsw@194
 | 
    53       end
 | 
| 
bsw@194
 | 
    54     }
 | 
| 
bsw@194
 | 
    55 
 | 
| 
bsw@194
 | 
    56   }
 | 
| 
bsw@194
 | 
    57 } |