webmcp

view demo-app/app/main/media_type/show.lua @ 567:5e3ebe9fd0ce

Added tag v2.2.1 for changeset 3b71fdb3a00d
author jbe
date Wed Apr 28 13:07:52 2021 +0200 (7 months ago)
parents 9fdfb27f8e67
children
line source
1 local media_type
2 local id = param.get_id()
3 if id then
4 media_type = MediaType:by_id(id)
5 end
7 if media_type then
8 slot.put_into("title", encode.html(_"Media type"))
9 else
10 slot.put_into("title", encode.html(_"New media type"))
11 end
13 slot.select("actions", function()
14 ui.link{
15 content = _"Back",
16 module = "media_type"
17 }
18 if media_type and app.session.user.write_priv then
19 ui.link{
20 content = _"Delete",
21 form_attr = {
22 onsubmit = "return confirm('" .. _'Are you sure?' .. "');"
23 },
24 module = "media_type",
25 action = "update",
26 id = media_type.id,
27 params = { delete = true },
28 routing = {
29 default = {
30 mode = "redirect",
31 module = "media_type",
32 view = "index"
33 }
34 }
35 }
36 end
37 end)
39 slot.select("main", function()
40 ui.form{
41 attr = { class = "vertical" },
42 record = media_type,
43 readonly = not app.session.user.write_priv,
44 module = "media_type",
45 action = "update",
46 id = id,
47 routing = {
48 default = {
49 mode = "redirect",
50 module = "media_type",
51 view = "index"
52 }
53 },
54 content = function()
55 if id then
56 ui.field.integer{ label = _"Id", name = "id", readonly = true }
57 end
58 ui.field.text{ label = _"Name", name = "name" }
59 ui.field.text{ label = _"Description", name = "description", multiline = true }
60 ui.submit{ text = _"Save" }
61 end
62 }
63 end)

Impressum / About Us