diff options
author | Louise Crow <louise.crow@gmail.com> | 2013-02-14 16:48:08 +0000 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2013-02-14 16:48:08 +0000 |
commit | d48bfd58f6ff26b2a34aa8d71d9d691f9fbc10e2 (patch) | |
tree | c026e8e6639f7f9ceed92b75fb8ed657c566d788 /app/helpers | |
parent | f8cf582f8c7461bfd680aac9c87cb5377c39c30c (diff) | |
parent | 0747a2d66f65fd22d8ea275d9df29a7981a46d07 (diff) |
Merge branch 'release/0.7' into wdtk
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/application_helper.rb | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 6411cf27e..42f9d30f1 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -35,15 +35,15 @@ module ApplicationHelper end end - error_messages = [] + error_messages = "".html_safe for object in objects object.errors.each do |attr, message| - error_messages << content_tag(:li, message) + error_messages << content_tag(:li, h(message)) end end content_tag(:div, - content_tag(:ul, error_messages.join), + content_tag(:ul, error_messages), html ) else @@ -54,15 +54,12 @@ module ApplicationHelper # Highlight words, also escapes HTML (other than spans that we add) def highlight_words(t, words, html = true) if html - t = h(t) - end - if html - t = highlight(t, words, '<span class="highlight">\1</span>') + highlight(h(t), words, '<span class="highlight">\1</span>').html_safe else - t = highlight(t, words, '*\1*') + highlight(t, words, '*\1*') end - return t end + def highlight_and_excerpt(t, words, excount, html = true) newt = excerpt(t, words[0], excount) if not newt |