liquid_feedback_frontend
view app/main/draft/new.lua @ 154:6b6c82f9ca9f
speedup member image loading when non set
we can add the location of the default file directy instead of going through another slow request
we can add the location of the default file directy instead of going through another slow request
author | Daniel Poelzleithner <poelzi@poelzi.org> |
---|---|
date | Fri Oct 08 15:25:10 2010 +0200 (2010-10-08) |
parents | fa55c8ded9fd |
children | 6e13a7da16b5 |
line source
1 slot.put_into("title", _"Edit draft")
3 local initiative = Initiative:by_id(param.get("initiative_id"))
5 slot.select("actions", function()
6 ui.link{
7 content = function()
8 ui.image{ static = "icons/16/cancel.png" }
9 slot.put(_"Cancel")
10 end,
11 module = "initiative",
12 view = "show",
13 id = initiative.id
14 }
15 end)
19 ui.form{
20 record = initiative.current_draft,
21 attr = { class = "vertical" },
22 module = "draft",
23 action = "add",
24 params = { initiative_id = initiative.id },
25 routing = {
26 ok = {
27 mode = "redirect",
28 module = "initiative",
29 view = "show",
30 id = initiative.id
31 }
32 },
33 content = function()
35 ui.field.text{ label = _"Author", value = app.session.member.name, readonly = true }
37 if param.get("preview") then
38 ui.container{
39 attr = { class = "draft_content wiki" },
40 content = function()
41 slot.put(format.wiki_text(param.get("content"), param.get("formatting_engine")))
42 end
43 }
44 slot.put("<br />")
45 ui.submit{ text = _"Save" }
46 slot.put("<br />")
47 slot.put("<br />")
48 end
49 slot.put("<br />")
52 ui.field.select{
53 label = _"Wiki engine",
54 name = "formatting_engine",
55 foreign_records = {
56 { id = "rocketwiki", name = "RocketWiki" },
57 { id = "compat", name = _"Traditional wiki syntax" }
58 },
59 attr = {id = "formatting_engine"},
60 foreign_id = "id",
61 foreign_name = "name"
62 }
63 ui.tag{
64 tag = "div",
65 content = function()
66 ui.tag{
67 tag = "label",
68 attr = { class = "ui_field_label" },
69 content = function() slot.put(" ") end,
70 }
71 ui.tag{
72 content = function()
73 ui.link{
74 text = _"Syntax help",
75 module = "help",
76 view = "show",
77 id = "wikisyntax",
78 attr = {onClick="this.href=this.href.replace(/wikisyntax[^.]*/g, 'wikisyntax_'+getElementById('formatting_engine').value)"}
79 }
80 slot.put(" ")
81 ui.link{
82 text = _"(new window)",
83 module = "help",
84 view = "show",
85 id = "wikisyntax",
86 attr = {target = "_blank", onClick="this.href=this.href.replace(/wikisyntax[^.]*/g, 'wikisyntax_'+getElementById('formatting_engine').value)"}
87 }
88 end
89 }
90 end
91 }
92 ui.field.text{
93 label = _"Content",
94 name = "content",
95 multiline = true,
96 attr = { style = "height: 50ex;" },
97 value = param.get("content")
98 }
100 ui.submit{ name = "preview", text = _"Preview" }
101 ui.submit{ text = _"Save" }
102 end
103 }