aboutsummaryrefslogtreecommitdiffstats
path: root/app/helpers/application_helper.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/helpers/application_helper.rb')
-rw-r--r--app/helpers/application_helper.rb15
1 files changed, 11 insertions, 4 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index e3b1e57ac..4b603b064 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -54,16 +54,16 @@ module ApplicationHelper
# Highlight words, also escapes HTML (other than spans that we add)
def highlight_words(t, words, html = true)
if html
- highlight(h(t), words, '<span class="highlight">\1</span>').html_safe
+ highlight(h(t), words, :highlighter => '<span class="highlight">\1</span>').html_safe
else
- highlight(t, words, '*\1*')
+ highlight(t, words, :highlighter => '*\1*')
end
end
def highlight_and_excerpt(t, words, excount, html = true)
- newt = excerpt(t, words[0], excount)
+ newt = excerpt(t, words[0], :radius => excount)
if not newt
- newt = excerpt(t, '', excount)
+ newt = excerpt(t, '', :radius => excount)
end
t = newt
t = highlight_words(t, words, html)
@@ -116,5 +116,12 @@ module ApplicationHelper
return !session[:using_admin].nil? || (!@user.nil? && @user.super?)
end
+ def cache_if_caching_fragments(*args, &block)
+ if AlaveteliConfiguration::cache_fragments
+ cache(*args) { yield }
+ else
+ yield
+ end
+ end
end