Sha256: 37eea2cb368641506d430b3e3e55750be0f13585bcfbe725ac815bf870da87cc

Contents?: true

Size: 997 Bytes

Versions: 10

Compression:

Stored size: 997 Bytes

Contents

module RocketCMS
  module Models
    module Mongoid
      module News
        extend ActiveSupport::Concern
        if !RocketCMS.config.news_image_styles.nil?
          if RocketCMS.shrine?
            include ImageUploader::Attachment(:image)
          elsif RocketCMS.paperclip?
            include ::Mongoid::Paperclip
          end
        end
        included do
          field :time, type: Time
          index({enabled: 1, time: 1})
          if RocketCMS.paperclip? && RocketCMS.config.news_image_styles.nil?
            has_mongoid_attached_file :image, styles: RocketCMS.config.news_image_styles
          end
          field :name, type: String, localize: RocketCMS.config.localize
          field :excerpt, type: String, localize: RocketCMS.config.localize
          field :content, type: String, localize: RocketCMS.config.localize

          scope :after_now, -> { where(:time.lt => Time.now) }
          scope :by_date, -> { desc(:time) }
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
rocket_cms-0.37.1 lib/rocket_cms/models/mongoid/news.rb
rocket_cms-0.37.0 lib/rocket_cms/models/mongoid/news.rb
rocket_cms-0.36.0 lib/rocket_cms/models/mongoid/news.rb
rocket_cms-0.35.0 lib/rocket_cms/models/mongoid/news.rb
rocket_cms-0.34.0 lib/rocket_cms/models/mongoid/news.rb
rocket_cms-0.33.1 lib/rocket_cms/models/mongoid/news.rb
rocket_cms-0.33.0 lib/rocket_cms/models/mongoid/news.rb
rocket_cms-0.32.0 lib/rocket_cms/models/mongoid/news.rb
rocket_cms-0.31.1 lib/rocket_cms/models/mongoid/news.rb
rocket_cms-0.31.0 lib/rocket_cms/models/mongoid/news.rb