liquid_feedback_frontend
diff model/member.lua @ 134:de6b80867eb7
make user names clickable
simplify pseudonym code by having one place to generate ui.field.text
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 | 26c8177ef348 |
| children | 7c3e8a1678fc |
line diff
1.1 --- a/model/member.lua Tue Oct 05 16:18:39 2010 +0200 1.2 +++ b/model/member.lua Tue Oct 05 20:56:41 2010 +0200 1.3 @@ -367,4 +367,23 @@ 1.4 :add_where("notify_email_lock_expiry > now()") 1.5 :count() == 1 1.6 ) 1.7 -end 1.8 \ No newline at end of file 1.9 +end 1.10 + 1.11 +function Member.object:ui_field_text(args) 1.12 + args = args or {} 1.13 + if app.session.member_id or config.public_access == "pseudonym" then 1.14 + -- ugly workaround for getting html into a replaced string and to the user 1.15 + ui.container{label = args.label, label_attr={class="ui_field_label"}, content = function() 1.16 + slot.put(string.format('<span><a href="%s">%s</a></span>', 1.17 + encode.url{ 1.18 + module = "member", 1.19 + view = "show", 1.20 + id = self.id, 1.21 + }, 1.22 + encode.html(self.name))) 1.23 + end 1.24 + } 1.25 + else 1.26 + ui.field.text{ label = args.label, value = _"[not displayed public]" } 1.27 + end 1.28 +end