webmcp
diff demo-app/app/main/genre/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/genre/index.lua Sun Oct 25 12:00:00 2009 +0100 1.3 @@ -0,0 +1,46 @@ 1.4 +slot.put_into("title", encode.html(_"Genres")) 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 genre", 1.10 + module = "genre", 1.11 + view = "show" 1.12 + } 1.13 + end 1.14 +end) 1.15 + 1.16 + 1.17 +local selector = Genre: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 + content = function(record) 1.37 + ui.link{ 1.38 + content = _"Show", 1.39 + module = "genre", 1.40 + view = "show", 1.41 + id = record.id 1.42 + } 1.43 + end 1.44 + }, 1.45 + } 1.46 + } 1.47 + end 1.48 + } 1.49 +end)