Module: Freeberry::Controllers::HeadOptions
- Defined in:
- lib/freeberry/controllers/head_options.rb
Class Method Summary collapse
-
.included(base) ⇒ Object
Inclusion hook to make #current_user and #logged_in? available as ActionView helper methods.
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
Inclusion hook to make #current_user and #logged_in? available as ActionView helper methods.
6 7 8 |
# File 'lib/freeberry/controllers/head_options.rb', line 6 def self.included(base) base.send :helper_method, :head_options if base.respond_to? :helper_method end |
Instance Method Details
#head_options(record, options = {}) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/freeberry/controllers/head_options.rb', line 10 def (record, = {}) return if record.nil? = { :spliter => " | " }.merge() header = record.respond_to?(:header) ? record.header : nil @view_title = record.title if record.respond_to?(:title) @view_title ||= I18n.t('page.title') # title page_title = [] page_title << [:title] if .key?(:title) page_title << ((header.nil? || header.title.blank?) ? record.title : header.title) page_title << I18n.t('page.title') if [:append_title] page_title.flatten! page_title.compact! page_title.uniq! @page_title = page_title.join([:spliter]) # keywords keywords = record.keywords.join(', ') if record.respond_to?(:keywords) keywords ||= (header.nil? || header.keywords.blank?) ? page_title.join(' ').split.join(', ') : header.keywords @page_keywords = keywords # description description = (header.nil? || header.description.blank?) ? page_title.join(" - ") : header.description @page_description = description end |