Sha256: 8a92ccafdd8899efb59034e13233c427eb381d61bb363bfa2e11457f09fa651b

Contents?: true

Size: 1.29 KB

Versions: 3

Compression:

Stored size: 1.29 KB

Contents

module Seoable
  extend ActiveSupport::Concern
  if RocketCMS.mongoid?
    include ::Mongoid::Paperclip
  end
  
  included do
    if RocketCMS.mongoid?
      field :name, type: String, localize: RocketCMS.configuration.localize
      field :h1, type: String, localize: RocketCMS.configuration.localize

      field :title, type: String, localize: RocketCMS.configuration.localize
      field :keywords, type: String, localize: RocketCMS.configuration.localize
      field :description, type: String, localize: RocketCMS.configuration.localize
      field :robots, type: String, localize: RocketCMS.configuration.localize

      field :og_title, type: String, localize: RocketCMS.configuration.localize
      has_mongoid_attached_file :og_image, styles: {thumb: "800x600>"}
    elsif RocketCMS.active_record?
      has_attached_file :og_image, styles: {thumb: "800x600>"}
    end
    validates_attachment_content_type :og_image, content_type: %w(image/gif image/jpeg image/jpg image/png), if: :og_image?
  end

  def page_title
    title.blank? ? name : title
  end

  def get_og_title
    og_title.blank? ? name : og_title
  end
  
  def self.admin
    RocketCMS.seo_config
  end

  def og_image_jcrop_options
    {aspectRation: 800.0/600.0}
  end
  
  # deprecated
  def self.seo_config
    RocketCMS.seo_config
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ack_rocket_cms-0.7.7.1 app/models/concerns/seoable.rb
ack_rocket_cms-0.7.7 app/models/concerns/seoable.rb
ack_rocket_cms-0.7.6.4 app/models/concerns/seoable.rb