From 77ce9b795c62d8241b22878cf60ca688fa4b44a1 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Tue, 3 Jun 2014 11:35:55 +0100 Subject: Move date helpers to DateTimeHelper --- app/helpers/application_helper.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'app/helpers/application_helper.rb') diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 33525cb3d..45b042354 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -13,6 +13,9 @@ module ApplicationHelper # all of all. include LinkToHelper + # Some extra date and time formatters + include DateTimeHelper + # Site-wide access to configuration settings include ConfigHelper -- cgit v1.2.3 From e5a73815f580d296572e11b71b5f3ed320bbe912 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Fri, 30 May 2014 12:42:48 +0100 Subject: Add helper to highlight and excerpt by regex Backport of https://github.com/rails/rails/pull/11793/ Contains integration tests to check that it works as expected with ActsAsXapian. --- app/helpers/application_helper.rb | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) (limited to 'app/helpers/application_helper.rb') diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 45b042354..49ce94951 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -22,6 +22,9 @@ module ApplicationHelper # Useful for sending emails include MailerHelper + # Extra highlight helpers + include HighlightHelper + # Copied from error_messages_for in active_record_helper.rb def foi_error_messages_for(*params) options = params.last.is_a?(Hash) ? params.pop.symbolize_keys : {} @@ -54,25 +57,6 @@ module ApplicationHelper end end - # Highlight words, also escapes HTML (other than spans that we add) - def highlight_words(t, words, html = true) - if html - highlight(h(t), words, :highlighter => '\1').html_safe - else - highlight(t, words, :highlighter => '*\1*') - end - end - - def highlight_and_excerpt(t, words, excount, html = true) - newt = excerpt(t, words[0], :radius => excount) - if not newt - newt = excerpt(t, '', :radius => excount) - end - t = newt - t = highlight_words(t, words, html) - return t - end - def locale_name(locale) return LanguageNames::get_language_name(locale) end -- cgit v1.2.3