Sha256: 9fdc105e12f1d697c28b07a1a28a5901f7288444173f8257c969f7bf35fbb3ca
Contents?: true
Size: 1.11 KB
Versions: 3
Compression:
Stored size: 1.11 KB
Contents
module Enjoy::Seoable extend ActiveSupport::Concern LOCALIZED_FIELDS = [:h1, :title, :keywords, :description, :og_title] FIELDS = LOCALIZED_FIELDS + [:og_image, :robots] included do has_one :seo, as: :seoable, autosave: true, class_name: seo_class_name accepts_nested_attributes_for :seo delegate *FIELDS, to: :seo delegate *(FIELDS.map {|f| "#{f}=".to_sym }), to: :seo if Enjoy.config.localize delegate *(LOCALIZED_FIELDS.map {|f| "#{f}_translations".to_sym }), to: :seo delegate *(LOCALIZED_FIELDS.map {|f| "#{f}_translations=".to_sym }), to: :seo end alias seo_without_build seo def seo seo_without_build || build_seo end end def page_title title.blank? ? name : title end def get_og_title og_title.blank? ? name : og_title end def og_image_jcrop_options {aspectRation: 800.0/600.0} end module ClassMethods def seo_class_name "Enjoy::Seo" end def seo_class seo_class_name.constantize end end def seo_class_name self.class.seo_class_name end def seo_class self.class.seo_class end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
enjoy_cms-0.2.0.2 | app/models/concerns/enjoy/seoable.rb |
enjoy_cms-0.2.0.1.beta | app/models/concerns/enjoy/seoable.rb |
enjoy_cms-0.2.0.beta | app/models/concerns/enjoy/seoable.rb |