Module: Spud::ApplicationHelper
- Included in:
- ApplicationController
- Defined in:
- app/helpers/spud/application_helper.rb
Instance Method Summary collapse
- #cache_key_for_spud_collection(collection, key: 'view', cache_params: [], for_user: false) ⇒ Object
- #current_site_name ⇒ Object
- #tb_page_title ⇒ Object
Instance Method Details
#cache_key_for_spud_collection(collection, key: 'view', cache_params: [], for_user: false) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'app/helpers/spud/application_helper.rb', line 18 def cache_key_for_spud_collection(collection, key:'view', cache_params:[], for_user:false) cache_keys = [controller_name, action_name, key] cache_keys << collection.collect(&:updated_at).max().try(:utc).try(:to_i) if for_user cache_keys << current_user_id end if cache_params.any? cache_keys += cache_params.collect{ |cache_param| params[cache_param] || 'nil' } end cache_keys += collection.collect(&:id) cache_key = cache_keys.join('/') if cache_key.length > 250 return Digest::SHA1.hexdigest(cache_key) else return cache_key end end |
#current_site_name ⇒ Object
14 15 16 |
# File 'app/helpers/spud/application_helper.rb', line 14 def current_site_name return Spud::Core.config.site_name end |
#tb_page_title ⇒ Object
3 4 5 6 7 8 9 10 11 12 |
# File 'app/helpers/spud/application_helper.rb', line 3 def tb_page_title if content_for?(:title) title = content_for(:title) + ' : ' + Spud::Core.site_name elsif @page_title title = @page_title + ' : ' + Spud::Core.site_name else title = Spud::Core.site_name end return content_tag :title, title end |