webmcp
annotate demo-app/app/main/media_type/show.lua @ 2:72860d232f32
Version 1.0.2
Fixed bug with explicit garbage collection (requests > 256kB caused an error)
Views prefixed with an underscore can't be called externally
ui.paginate now displays the last page, if the selected page number is too high.
Fixed bug with explicit garbage collection (requests > 256kB caused an error)
Views prefixed with an underscore can't be called externally
ui.paginate now displays the last page, if the selected page number is too high.
author | jbe/bsw |
---|---|
date | Thu Dec 10 12:00:00 2009 +0100 (2009-12-10) |
parents | 9fdfb27f8e67 |
children |
rev | line source |
---|---|
jbe/bsw@0 | 1 local media_type |
jbe/bsw@0 | 2 local id = param.get_id() |
jbe/bsw@0 | 3 if id then |
jbe/bsw@0 | 4 media_type = MediaType:by_id(id) |
jbe/bsw@0 | 5 end |
jbe/bsw@0 | 6 |
jbe/bsw@0 | 7 if media_type then |
jbe/bsw@0 | 8 slot.put_into("title", encode.html(_"Media type")) |
jbe/bsw@0 | 9 else |
jbe/bsw@0 | 10 slot.put_into("title", encode.html(_"New media type")) |
jbe/bsw@0 | 11 end |
jbe/bsw@0 | 12 |
jbe/bsw@0 | 13 slot.select("actions", function() |
jbe/bsw@0 | 14 ui.link{ |
jbe/bsw@0 | 15 content = _"Back", |
jbe/bsw@0 | 16 module = "media_type" |
jbe/bsw@0 | 17 } |
jbe/bsw@0 | 18 if media_type and app.session.user.write_priv then |
jbe/bsw@0 | 19 ui.link{ |
jbe/bsw@0 | 20 content = _"Delete", |
jbe/bsw@0 | 21 form_attr = { |
jbe/bsw@0 | 22 onsubmit = "return confirm('" .. _'Are you sure?' .. "');" |
jbe/bsw@0 | 23 }, |
jbe/bsw@0 | 24 module = "media_type", |
jbe/bsw@0 | 25 action = "update", |
jbe/bsw@0 | 26 id = media_type.id, |
jbe/bsw@0 | 27 params = { delete = true }, |
jbe/bsw@0 | 28 routing = { |
jbe/bsw@0 | 29 default = { |
jbe/bsw@0 | 30 mode = "redirect", |
jbe/bsw@0 | 31 module = "media_type", |
jbe/bsw@0 | 32 view = "index" |
jbe/bsw@0 | 33 } |
jbe/bsw@0 | 34 } |
jbe/bsw@0 | 35 } |
jbe/bsw@0 | 36 end |
jbe/bsw@0 | 37 end) |
jbe/bsw@0 | 38 |
jbe/bsw@0 | 39 slot.select("main", function() |
jbe/bsw@0 | 40 ui.form{ |
jbe/bsw@0 | 41 attr = { class = "vertical" }, |
jbe/bsw@0 | 42 record = media_type, |
jbe/bsw@0 | 43 readonly = not app.session.user.write_priv, |
jbe/bsw@0 | 44 module = "media_type", |
jbe/bsw@0 | 45 action = "update", |
jbe/bsw@0 | 46 id = id, |
jbe/bsw@0 | 47 routing = { |
jbe/bsw@0 | 48 default = { |
jbe/bsw@0 | 49 mode = "redirect", |
jbe/bsw@0 | 50 module = "media_type", |
jbe/bsw@0 | 51 view = "index" |
jbe/bsw@0 | 52 } |
jbe/bsw@0 | 53 }, |
jbe/bsw@0 | 54 content = function() |
jbe/bsw@0 | 55 if id then |
jbe/bsw@0 | 56 ui.field.integer{ label = _"Id", name = "id", readonly = true } |
jbe/bsw@0 | 57 end |
jbe/bsw@0 | 58 ui.field.text{ label = _"Name", name = "name" } |
jbe/bsw@0 | 59 ui.field.text{ label = _"Description", name = "description", multiline = true } |
jbe/bsw@0 | 60 ui.submit{ text = _"Save" } |
jbe/bsw@0 | 61 end |
jbe/bsw@0 | 62 } |
jbe/bsw@0 | 63 end) |