annotate app/main/draft/_show.lua @ 149:d87097d3b6ec
small hint to show the number of alternative initiatives
 | author | 
 Daniel Poelzleithner <poelzi@poelzi.org> | 
 | date | 
 Fri Oct 08 03:25:59 2010 +0200 (2010-10-08) | 
 | parents | 
 de6b80867eb7  | 
 | children | 
 cc7650c7053f  | 
 
 | rev | 
   line source | 
| 
bsw/jbe@0
 | 
     1 local draft = param.get("draft", "table")
 | 
| 
bsw/jbe@0
 | 
     2 
 | 
| 
bsw/jbe@0
 | 
     3 ui.form{
 | 
| 
bsw/jbe@0
 | 
     4   attr = { class = "vertical" },
 | 
| 
bsw/jbe@0
 | 
     5   record = draft,
 | 
| 
bsw/jbe@0
 | 
     6   readonly = true,
 | 
| 
bsw/jbe@0
 | 
     7   content = function()
 | 
| 
bsw/jbe@0
 | 
     8 
 | 
| 
bsw@51
 | 
     9     if app.session.member_id or config.public_access == "pseudonym" then
 | 
| 
poelzi@134
 | 
    10       if draft.author then
 | 
| 
poelzi@134
 | 
    11         -- ugly workaround for getting html into a replaced string und to the user
 | 
| 
poelzi@134
 | 
    12         ui.container{label = _"Last author", label_attr={class="ui_field_label"}, content = function()
 | 
| 
poelzi@134
 | 
    13             local str = _("#{author} at #{date}",
 | 
| 
poelzi@134
 | 
    14                             {author = string.format('<a href="%s">%s</a>',
 | 
| 
poelzi@134
 | 
    15                                                     encode.url{
 | 
| 
poelzi@134
 | 
    16                                                       module    = "member",
 | 
| 
poelzi@134
 | 
    17                                                       view      = "show",
 | 
| 
poelzi@134
 | 
    18                                                       id        = draft.author.id,
 | 
| 
poelzi@134
 | 
    19                                                     },
 | 
| 
poelzi@134
 | 
    20                                                     encode.html(draft.author.name)),
 | 
| 
poelzi@134
 | 
    21                              date = encode.html(format.timestamp(draft.created))
 | 
| 
poelzi@134
 | 
    22                             }
 | 
| 
poelzi@134
 | 
    23                         )
 | 
| 
poelzi@134
 | 
    24             slot.put("<span>", str, "</span>")
 | 
| 
poelzi@134
 | 
    25           end
 | 
| 
poelzi@134
 | 
    26         }
 | 
| 
poelzi@134
 | 
    27       else
 | 
| 
poelzi@134
 | 
    28         text = _("#{author} at #{date}", {
 | 
| 
poelzi@134
 | 
    29           author = encode.html(draft.author_name),
 | 
| 
poelzi@134
 | 
    30           date = format.timestamp(draft.created)
 | 
| 
poelzi@134
 | 
    31         })
 | 
| 
poelzi@134
 | 
    32         ui.field.text{label = _"Last author", value = text }
 | 
| 
poelzi@134
 | 
    33       end
 | 
| 
bsw@51
 | 
    34     else
 | 
| 
bsw@51
 | 
    35       ui.field.text{
 | 
| 
bsw@51
 | 
    36         label = _"Last author",
 | 
| 
bsw@51
 | 
    37         value = _(
 | 
| 
bsw@51
 | 
    38           "#{author} at #{date}", {
 | 
| 
bsw@65
 | 
    39             author = _"[not displayed public]",
 | 
| 
bsw@51
 | 
    40             date = format.timestamp(draft.created)
 | 
| 
bsw@51
 | 
    41           }
 | 
| 
bsw@51
 | 
    42         )
 | 
| 
bsw@51
 | 
    43       }
 | 
| 
bsw@51
 | 
    44     end
 | 
| 
bsw@51
 | 
    45 
 | 
| 
bsw@2
 | 
    46     ui.container{
 | 
| 
bsw/jbe@4
 | 
    47       attr = { class = "draft_content wiki" },
 | 
| 
bsw@2
 | 
    48       content = function()
 | 
| 
bsw@81
 | 
    49         slot.put(draft:get_content("html"))
 | 
| 
bsw@2
 | 
    50       end
 | 
| 
bsw@2
 | 
    51     }
 | 
| 
bsw/jbe@0
 | 
    52   end
 | 
| 
bsw/jbe@0
 | 
    53 }
 |