webmcp
view demo-app/app/main/user/index.lua @ 0:9fdfb27f8e67
Version 1.0.0
| author | jbe/bsw | 
|---|---|
| date | Sun Oct 25 12:00:00 2009 +0100 (2009-10-25) | 
| parents | |
| children | 
 line source
     1 slot.put_into("title", encode.html(_"Users"))
     3 slot.select("actions", function()
     4   ui.link{
     5     content = _"Create new user",
     6     module = "user",
     7     view = "show"
     8   }
     9 end)
    12 local selector = User:new_selector():add_order_by('"ident", "id"')
    14 slot.select("main", function()
    15   ui.paginate{
    16     selector = selector,
    17     content = function()
    18       ui.list{
    19         records = selector:exec(),
    20         columns = {
    21           {
    22             field_attr = { style = "float: right;" },
    23             label = _"Id",
    24             name = "id"
    25           },
    26           {
    27             label = _"Ident",
    28             name = "ident"
    29           },
    30           {
    31             label = _"Name",
    32             name = "name"
    33           },
    34           {
    35             label = _"w",
    36             name = "write_priv"
    37           },
    38           {
    39             label = _"Admin",
    40             name = "admin"
    41           },
    42           {
    43             content = function(record)
    44               ui.link{
    45                 content = _"Show",
    46                 module  = "user",
    47                 view    = "show",
    48                 id      = record.id
    49               }
    50             end
    51           },
    52         }
    53       }
    54     end
    55   }
    56 end)
