webmcp
view demo-app/app/main/genre/index.lua @ 11:d76a8857ba62
Added ui.partial and other functions, which allow partial content replacement using XMLHttpRequests; Image support for ui.link
Also includes following changes:
- Fix for rocketcgi library to accept POST data content-types, which contain additional charset information.
- Support arrays passed as params to encode.url (only for keys ending with "[]")
- Version information changed to "1.0.7"
Documentation for added functions is not yet complete.
Also includes following changes:
- Fix for rocketcgi library to accept POST data content-types, which contain additional charset information.
- Support arrays passed as params to encode.url (only for keys ending with "[]")
- Version information changed to "1.0.7"
Documentation for added functions is not yet complete.
| author | jbe/bsw | 
|---|---|
| date | Fri Feb 12 18:40:22 2010 +0100 (2010-02-12) | 
| parents | 9fdfb27f8e67 | 
| children | 
 line source
     1 slot.put_into("title", encode.html(_"Genres"))
     3 slot.select("actions", function()
     4   if app.session.user.write_priv then
     5     ui.link{
     6       content = _"Create new genre",
     7       module = "genre",
     8       view = "show"
     9     }
    10   end
    11 end)
    14 local selector = Genre:new_selector():add_order_by('"name", "id"')
    16 slot.select("main", function()
    17   ui.paginate{
    18     selector = selector,
    19     content = function()
    20       ui.list{
    21         records = selector:exec(),
    22         columns = {
    23           {
    24             field_attr = { style = "float: right;" },
    25             label = _"Id",
    26             name = "id"
    27           },
    28           {
    29             label = _"Name",
    30             name = "name"
    31           },
    32           {
    33             content = function(record)
    34               ui.link{
    35                 content = _"Show",
    36                 module  = "genre",
    37                 view    = "show",
    38                 id      = record.id
    39               }
    40             end
    41           },
    42         }
    43       }
    44     end
    45   }
    46 end)
