diff options
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/application_helper.rb | 26 | ||||
-rwxr-xr-x | app/helpers/link_to_helper.rb | 4 |
2 files changed, 10 insertions, 20 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index ab953cb25..6411cf27e 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -77,25 +77,6 @@ module ApplicationHelper return LanguageNames::get_language_name(locale) end - # Use our own algorithm for finding path of cache - def foi_cache(name = {}, options = nil, &block) - if @controller.perform_caching - key = name.merge(:only_path => true) - key_path = @controller.foi_fragment_cache_path(key) - - if @controller.foi_fragment_cache_exists?(key_path) - cached = @controller.foi_fragment_cache_read(key_path) - output_buffer.concat(cached) - return - end - - pos = output_buffer.length - content = block.call - @controller.foi_fragment_cache_write(key_path, output_buffer[pos..-1]) - else - block.call - end - end # (unfortunately) ugly way of getting id of generated form element # ids # see http://chrisblunt.com/2009/10/12/rails-getting-the-id-of-form-fields-inside-a-fields_for-block/ @@ -131,5 +112,12 @@ module ApplicationHelper return "#{exact_date} (#{ago_text})" end + # Note that if the admin interface is proxied via another server, we can't + # rely on a sesssion being shared between the front end and admin interface, + # so need to check the status of the user. + def is_admin? + return !session[:using_admin].nil? || (!@user.nil? && @user.super?) + end + end diff --git a/app/helpers/link_to_helper.rb b/app/helpers/link_to_helper.rb index 994da0e87..030fab20b 100755 --- a/app/helpers/link_to_helper.rb +++ b/app/helpers/link_to_helper.rb @@ -255,9 +255,11 @@ module LinkToHelper # Basic date format def simple_date(date) + date = date.in_time_zone.to_date unless date.is_a? Date + date_format = _("simple_date_format") date_format = :long if date_format == "simple_date_format" - return I18n.l(date.to_date, :format => date_format) + return I18n.l(date, :format => date_format) end def simple_time(date) |