liquid_feedback_frontend
annotate app/main/draft/_show.lua @ 172:165f4bd02cf3
don't show the first draft of a new initiative as a new draft event in the timeline
new draft should only show changes of drafts drafts of new initiatives as they are handled by the new initiative event
new draft should only show changes of drafts drafts of new initiatives as they are handled by the new initiative event
author | Daniel Poelzleithner <poelzi@poelzi.org> |
---|---|
date | Sun Oct 10 19:40:32 2010 +0200 (2010-10-10) |
parents | cc7650c7053f |
children | aec9df5b4cd3 |
rev | line source |
---|---|
bsw/jbe@0 | 1 local draft = param.get("draft", "table") |
poelzi@160 | 2 local source = param.get("source", atom.boolean) |
bsw/jbe@0 | 3 |
bsw/jbe@0 | 4 ui.form{ |
bsw/jbe@0 | 5 attr = { class = "vertical" }, |
bsw/jbe@0 | 6 record = draft, |
bsw/jbe@0 | 7 readonly = true, |
bsw/jbe@0 | 8 content = function() |
bsw/jbe@0 | 9 |
bsw@51 | 10 if app.session.member_id or config.public_access == "pseudonym" then |
poelzi@134 | 11 if draft.author then |
poelzi@134 | 12 -- ugly workaround for getting html into a replaced string und to the user |
poelzi@134 | 13 ui.container{label = _"Last author", label_attr={class="ui_field_label"}, content = function() |
poelzi@134 | 14 local str = _("#{author} at #{date}", |
poelzi@134 | 15 {author = string.format('<a href="%s">%s</a>', |
poelzi@134 | 16 encode.url{ |
poelzi@134 | 17 module = "member", |
poelzi@134 | 18 view = "show", |
poelzi@134 | 19 id = draft.author.id, |
poelzi@134 | 20 }, |
poelzi@134 | 21 encode.html(draft.author.name)), |
poelzi@134 | 22 date = encode.html(format.timestamp(draft.created)) |
poelzi@134 | 23 } |
poelzi@134 | 24 ) |
poelzi@134 | 25 slot.put("<span>", str, "</span>") |
poelzi@134 | 26 end |
poelzi@134 | 27 } |
poelzi@134 | 28 else |
poelzi@134 | 29 text = _("#{author} at #{date}", { |
poelzi@134 | 30 author = encode.html(draft.author_name), |
poelzi@134 | 31 date = format.timestamp(draft.created) |
poelzi@134 | 32 }) |
poelzi@134 | 33 ui.field.text{label = _"Last author", value = text } |
poelzi@134 | 34 end |
bsw@51 | 35 else |
bsw@51 | 36 ui.field.text{ |
bsw@51 | 37 label = _"Last author", |
bsw@51 | 38 value = _( |
bsw@51 | 39 "#{author} at #{date}", { |
bsw@65 | 40 author = _"[not displayed public]", |
bsw@51 | 41 date = format.timestamp(draft.created) |
bsw@51 | 42 } |
bsw@51 | 43 ) |
bsw@51 | 44 } |
bsw@51 | 45 end |
bsw@51 | 46 |
bsw@2 | 47 ui.container{ |
bsw/jbe@4 | 48 attr = { class = "draft_content wiki" }, |
bsw@2 | 49 content = function() |
poelzi@160 | 50 if source then |
poelzi@160 | 51 ui.tag{ |
poelzi@160 | 52 tag = "pre", |
poelzi@160 | 53 content = draft.content |
poelzi@160 | 54 } |
poelzi@160 | 55 else |
poelzi@160 | 56 slot.put(draft:get_content("html")) |
poelzi@160 | 57 end |
bsw@2 | 58 end |
bsw@2 | 59 } |
bsw/jbe@0 | 60 end |
bsw/jbe@0 | 61 } |