Sha256: 0e18a7d58c525cf0eebfbe6850c7d169c5880a282a9406bcfd13eb5933a4a7f1

Contents?: true

Size: 1.16 KB

Versions: 14

Compression:

Stored size: 1.16 KB

Contents

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

        include Enjoy::HtmlField

        included do
          if defined?(RailsAdminComments)
            include RailsAdminComments::Commentable
          end

          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

          enjoy_cms_html_field :excerpt, type: String, localize: Enjoy.configuration.localize, default: ""
          enjoy_cms_html_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

14 entries across 14 versions & 1 rubygems

Version Path
enjoy_cms-0.3.7.4 lib/enjoy/models/mongoid/news.rb
enjoy_cms-0.3.7.3 lib/enjoy/models/mongoid/news.rb
enjoy_cms-0.3.7.2 lib/enjoy/models/mongoid/news.rb
enjoy_cms-0.3.7.1 lib/enjoy/models/mongoid/news.rb
enjoy_cms-0.3.7 lib/enjoy/models/mongoid/news.rb
enjoy_cms-0.3.6.2 lib/enjoy/models/mongoid/news.rb
enjoy_cms-0.3.6.1 lib/enjoy/models/mongoid/news.rb
enjoy_cms-0.3.6 lib/enjoy/models/mongoid/news.rb
enjoy_cms-0.3.5 lib/enjoy/models/mongoid/news.rb
enjoy_cms-0.3.4 lib/enjoy/models/mongoid/news.rb
enjoy_cms-0.3.3 lib/enjoy/models/mongoid/news.rb
enjoy_cms-0.3.2.1 lib/enjoy/models/mongoid/news.rb
enjoy_cms-0.3.2 lib/enjoy/models/mongoid/news.rb
enjoy_cms-0.3.1.2 lib/enjoy/models/mongoid/news.rb