Sha256: 0d7a3bb90c5cb6d6d66467ee349373632c2c3d1f0fdfa2fe133909bc225f9f7b

Contents?: true

Size: 888 Bytes

Versions: 23

Compression:

Stored size: 888 Bytes

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: "Enjoy::Seo"
    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

end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
enjoy_cms-0.3.7.4 app/models/concerns/enjoy/seoable.rb
enjoy_cms-0.3.7.3 app/models/concerns/enjoy/seoable.rb
enjoy_cms-0.3.7.2 app/models/concerns/enjoy/seoable.rb
enjoy_cms-0.3.7.1 app/models/concerns/enjoy/seoable.rb
enjoy_cms-0.3.7 app/models/concerns/enjoy/seoable.rb
enjoy_cms-0.3.6.2 app/models/concerns/enjoy/seoable.rb
enjoy_cms-0.3.6.1 app/models/concerns/enjoy/seoable.rb
enjoy_cms-0.3.6 app/models/concerns/enjoy/seoable.rb
enjoy_cms-0.3.5 app/models/concerns/enjoy/seoable.rb
enjoy_cms-0.3.4 app/models/concerns/enjoy/seoable.rb
enjoy_cms-0.3.3 app/models/concerns/enjoy/seoable.rb
enjoy_cms-0.3.2.1 app/models/concerns/enjoy/seoable.rb
enjoy_cms-0.3.2 app/models/concerns/enjoy/seoable.rb
enjoy_cms-0.3.1.2 app/models/concerns/enjoy/seoable.rb
enjoy_cms-0.3.1.1 app/models/concerns/enjoy/seoable.rb
enjoy_cms-0.3.1 app/models/concerns/enjoy/seoable.rb
enjoy_cms-0.3.0.4 app/models/concerns/enjoy/seoable.rb
enjoy_cms-0.3.0.3 app/models/concerns/enjoy/seoable.rb
enjoy_cms-0.3.0.2 app/models/concerns/enjoy/seoable.rb
enjoy_cms-0.2.1 app/models/concerns/enjoy/seoable.rb