webmcp

diff demo-app/app/main/medium/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 diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/demo-app/app/main/medium/index.lua	Sun Oct 25 12:00:00 2009 +0100
     1.3 @@ -0,0 +1,50 @@
     1.4 +slot.put_into("title", encode.html(_"Media"))
     1.5 +
     1.6 +slot.select("actions", function()
     1.7 +  if app.session.user.write_priv then
     1.8 +    ui.link{
     1.9 +      content = _"Create new medium",
    1.10 +      module = "medium",
    1.11 +      view = "show"
    1.12 +    }
    1.13 +  end
    1.14 +end)
    1.15 +
    1.16 +
    1.17 +local selector = Medium:new_selector():add_order_by('"name", "id"')
    1.18 +
    1.19 +slot.select("main", function()
    1.20 +  ui.paginate{
    1.21 +    selector = selector,
    1.22 +    content = function()
    1.23 +      ui.list{
    1.24 +        records = selector:exec(),
    1.25 +        columns = {
    1.26 +          {
    1.27 +            field_attr = { style = "float: right;" },
    1.28 +            label = _"Id",
    1.29 +            name = "id"
    1.30 +          },
    1.31 +          {
    1.32 +            label = _"Name",
    1.33 +            name = "name"
    1.34 +          },
    1.35 +          {
    1.36 +            label = _"Copy protected",
    1.37 +            name = "copyprotected"
    1.38 +          },
    1.39 +          {
    1.40 +            content = function(record)
    1.41 +              ui.link{
    1.42 +                content = _"Show",
    1.43 +                module  = "medium",
    1.44 +                view    = "show",
    1.45 +                id      = record.id
    1.46 +              }
    1.47 +            end
    1.48 +          },
    1.49 +        }
    1.50 +      }
    1.51 +    end
    1.52 +  }
    1.53 +end)
    1.54 \ No newline at end of file

Impressum / About Us