diff options
author | Louise Crow <louise.crow@gmail.com> | 2014-01-24 10:36:38 +0000 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2014-01-24 10:36:38 +0000 |
commit | 1445541f487fe22ec44b71607be3300319338d0a (patch) | |
tree | 5c9ed659c968f092317de6bab59a712e2584ca66 /app/helpers/application_helper.rb | |
parent | 4eb8432dedc8b521086cdf163ebe5d373396d39a (diff) | |
parent | b0a939a4d44077b4602176042ff4432b790561ad (diff) |
Merge branch 'release/0.16'0.16
Diffstat (limited to 'app/helpers/application_helper.rb')
-rw-r--r-- | app/helpers/application_helper.rb | 15 |
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 |