liquid_feedback_frontend

diff app/main/draft/_show.lua @ 134:de6b80867eb7

make user names clickable

simplify pseudonym code by having one place to generate ui.field.text
author Daniel Poelzleithner <poelzi@poelzi.org>
date Tue Oct 05 20:56:41 2010 +0200 (2010-10-05)
parents 134fce4bede3
children cc7650c7053f
line diff
     1.1 --- a/app/main/draft/_show.lua	Tue Oct 05 16:18:39 2010 +0200
     1.2 +++ b/app/main/draft/_show.lua	Tue Oct 05 20:56:41 2010 +0200
     1.3 @@ -7,15 +7,30 @@
     1.4    content = function()
     1.5  
     1.6      if app.session.member_id or config.public_access == "pseudonym" then
     1.7 -      ui.field.text{
     1.8 -        label = _"Last author",
     1.9 -        value = _(
    1.10 -          "#{author} at #{date}", {
    1.11 -            author = draft.author_name,
    1.12 -            date = format.timestamp(draft.created)
    1.13 -          }
    1.14 -        )
    1.15 -      }
    1.16 +      if draft.author then
    1.17 +        -- ugly workaround for getting html into a replaced string und to the user
    1.18 +        ui.container{label = _"Last author", label_attr={class="ui_field_label"}, content = function()
    1.19 +            local str = _("#{author} at #{date}",
    1.20 +                            {author = string.format('<a href="%s">%s</a>',
    1.21 +                                                    encode.url{
    1.22 +                                                      module    = "member",
    1.23 +                                                      view      = "show",
    1.24 +                                                      id        = draft.author.id,
    1.25 +                                                    },
    1.26 +                                                    encode.html(draft.author.name)),
    1.27 +                             date = encode.html(format.timestamp(draft.created))
    1.28 +                            }
    1.29 +                        )
    1.30 +            slot.put("<span>", str, "</span>")
    1.31 +          end
    1.32 +        }
    1.33 +      else
    1.34 +        text = _("#{author} at #{date}", {
    1.35 +          author = encode.html(draft.author_name),
    1.36 +          date = format.timestamp(draft.created)
    1.37 +        })
    1.38 +        ui.field.text{label = _"Last author", value = text }
    1.39 +      end
    1.40      else
    1.41        ui.field.text{
    1.42          label = _"Last author",

Impressum / About Us