Sha256: 58d43750a534d8741cb9d1ca35e47359f228363bc17205d97fd0d766b2c9efd5

Contents?: true

Size: 1014 Bytes

Versions: 1

Compression:

Stored size: 1014 Bytes

Contents

module Enjoy::Catalog
  module Models
    module ItemCategory
      extend ActiveSupport::Concern
      include Enjoy::Model
      include Enjoy::Enableable
      include Enjoy::Seoable
      include Enjoy::SitemapDataField

      include Enjoy::Catalog.orm_specific('ItemCategory')

      include ManualSlug

      included do
        manual_slug :name
      end

      def clean_excerpt
        Rails::Html::FullSanitizer.new.sanitize(self.excerpt.strip)
      end

      def clean_content
        Rails::Html::FullSanitizer.new.sanitize(self.content.strip)
      end

      def item_class
        Enjoy::Catalog::Item
      end

      def items
        item_class.in(item_category_ids: self.id)
      end

      def all_items
        item_class.any_in(item_category_ids: self.self_and_descendants.map(&:id))
      end

      # module ClassMethods
      #   def rails_admin_add_fields
      #     {}
      #   end
      #
      #   def rails_admin_add_config(config)
      #   end
      # end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
enjoy_cms_catalog-0.2.0 lib/enjoy/catalog/models/item_category.rb