X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/ec172871aea87ad57360c973b59c56a055d33eb3..160429e62d88810ec49ccc9c504edee675dca080:/app/helpers/application_helper.rb diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index c5df67675..2ed50216f 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,6 +1,10 @@ module ApplicationHelper require 'rexml/document' + def sanitize(text) + Sanitize.clean(text, Sanitize::Config::OSM) + end + def htmlize(text) return linkify(sanitize(simple_format(text))) end @@ -49,6 +53,26 @@ module ApplicationHelper end end + def user_image(user, options = {}) + options[:class] ||= "user_image" + + if user.image + image_tag url_for_file_column(user, "image"), options + else + image_tag "anon_large.png", options + end + end + + def user_thumbnail(user, options = {}) + options[:class] ||= "user_thumbnail" + + if user.image + image_tag url_for_file_column(user, "image"), options + else + image_tag "anon_small.png", options + end + end + private def javascript_strings_for_key(key)