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.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index df89a372c..df016a249 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -17,6 +17,9 @@ module ApplicationHelper
# Site-wide access to configuration settings
include ConfigHelper
+ # Useful for sending emails
+ include MailerHelper
+
# 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 : {}
@@ -113,5 +116,19 @@ module ApplicationHelper
end
end
+ def admin_value(v)
+ if v.nil?
+ nil
+ elsif v.instance_of?(Time)
+ admin_date(v)
+ else
+ h(v)
+ end
+ end
+
+ def admin_date(date)
+ "#{I18n.l(date, :format => "%e %B %Y %H:%M:%S")} (#{_('{{length_of_time}} ago', :length_of_time => time_ago_in_words(date))})"
+ end
+
end