Module: Sunrise::Controllers::HeadOptions
- Defined in:
- lib/sunrise/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/sunrise/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 |
# File 'lib/sunrise/controllers/head_options.rb', line 10 def (record, = {}) return if record.nil? = { :spliter => Sunrise.title_spliter, :append_title => true }.merge() header = [:header] || (record.respond_to?(:header) ? record.header : nil) if header && header.has_info? @page_keywords ||= header.read(:keywords) @page_description ||= header.read(:description) @page_title ||= header.read(:title) end @page_title ||= begin view_title = if record.respond_to?(:title) record.title elsif record.respond_to(:name) record.name end page_title = [] page_title << [:title] if .key?(:title) page_title << view_title page_title << I18n.t("page.title") if [:append_title] page_title.flatten.compact.uniq.join([:spliter]) end end |