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.rb26
1 files changed, 7 insertions, 19 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