Sha256: 42792868315ddc09806a4770287f366e1e6361fae818c62706c5e173599e0d7d
Contents?: true
Size: 1.13 KB
Versions: 3
Compression:
Stored size: 1.13 KB
Contents
# -*- encoding : utf-8 -*- module AbAdmin module Controllers module HeadOptions def head_options(record, options = {}) return if record.nil? options = { :spliter => Utils.title_spliter, :append_title => true }.merge(options) header = options[: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 << options[:title] if options.key?(:title) page_title << view_title page_title << I18n.t("page.title") if options[:append_title] page_title.flatten.compact.uniq.join(options[:spliter]) end @page_description = [I18n.t("page.prefix"), @page_description].compact.join(' - ') end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ab_admin-0.1.2 | lib/ab_admin/controllers/head_options.rb |
ab_admin-0.1.1 | lib/ab_admin/controllers/head_options.rb |
ab_admin-0.1.0 | lib/ab_admin/controllers/head_options.rb |