Sha256: 70e01e67db0e54bc89a885e2f8d50419c4ed9ee2ef81849d13d775f9682dbaf7

Contents?: true

Size: 1 KB

Versions: 7

Compression:

Stored size: 1 KB

Contents

module Enjoy
  module Models
    module Mongoid
      module News
        extend ActiveSupport::Concern
        unless Enjoy.config.news_image_styles.nil?
          include Enjoy::MongoidPaperclip
        end

        included do
          field :name, type: String, localize: Enjoy.config.localize, default: ""
          
          field :time, type: Time
          index({enabled: 1, time: 1})
          unless Enjoy.config.news_image_styles.nil?
            enjoy_cms_mongoid_attached_file(:image,
                      styles: Enjoy.configuration.news_image_styles,
                      content_type: { content_type: ["image/jpg", "image/jpeg", "image/png"] }
            )
          end

          field :excerpt, type: String, localize: Enjoy.configuration.localize, default: ""
          field :content, type: String, localize: Enjoy.configuration.localize, default: ""

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
enjoy_cms-0.2.1 lib/enjoy/models/mongoid/news.rb
enjoy_cms-0.2.0.3.2 lib/enjoy/models/mongoid/news.rb
enjoy_cms-0.2.0.3.1 lib/enjoy/models/mongoid/news.rb
enjoy_cms-0.2.0.3 lib/enjoy/models/mongoid/news.rb
enjoy_cms-0.2.0.2 lib/enjoy/models/mongoid/news.rb
enjoy_cms-0.2.0.1.beta lib/enjoy/models/mongoid/news.rb
enjoy_cms-0.2.0.beta lib/enjoy/models/mongoid/news.rb