aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/user.rb
diff options
context:
space:
mode:
authorFrancis Irving <francis@mysociety.org>2010-07-18 05:29:26 +0100
committerFrancis Irving <francis@mysociety.org>2010-07-18 05:29:26 +0100
commit3981460a8b2e5924e9b833ea214bc6ce0c3dfe33 (patch)
tree271457f63f61e97d6e906478300ec89e017c027f /app/models/user.rb
parent57aa8cc12e47efd6f79acd7349d4805cd4c986b9 (diff)
Editable about me text
Diffstat (limited to 'app/models/user.rb')
-rw-r--r--app/models/user.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index dcc92d5e3..8b99cb61e 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -109,6 +109,8 @@ class User < ActiveRecord::Base
end
# Don't display any leading/trailing spaces
+ # XXX we have strip_attributes! now, so perhaps this can be removed (might
+ # be still needed for existing cases)
def name
name = read_attribute(:name)
if not name.nil?
@@ -308,6 +310,16 @@ class User < ActiveRecord::Base
nil # so doesn't print all users on console
end
+ # Return about me text for display as HTML
+ def get_about_me_for_html_display
+ text = self.about_me.strip
+ text = CGI.escapeHTML(text)
+ text = MySociety::Format.make_clickable(text, :contract => 1)
+ text = text.gsub(/\n/, '<br>')
+ return text
+ end
+
+
private
def User.encrypted_password(password, salt)