Sha256: 05d44701b83f5f84214cef93e3df81420ad0ece1e32383e94e677abd54b38732

Contents?: true

Size: 1.26 KB

Versions: 6

Compression:

Stored size: 1.26 KB

Contents

module Adminpanel
  class Product < ActiveRecord::Base
    include Adminpanel::Base
    include Adminpanel::Facebook
    include Adminpanel::Twitter

    has_many :categorizations
    has_many :categories, through: :categorizations
    mount_images :photos

    validates_presence_of :name
    validates_presence_of :price
    validates_presence_of :description

    def self.form_attributes
      [
      {"category_ids" => {"type" => "has_many", "model" => "Adminpanel::Category", "name" => "category_ids"}},
      {
        'name' => {
          'type' => 'text_field',
          'label' => 'name',
          'placeholder' => 'name'}
      },
      {
        'price' => {
          'type' => 'text_field',
          'name' => 'price'
        }
      },
      {
        'photos' => {
          'type' => 'adminpanel_file_field',
          'label' => 'photo',
          'placeholder' => 'photo',
          'max-files' => 2
        }
      },
      {
        'description' => {
          'type' => 'wysiwyg_field',
          'label' => 'description',
          'placeholder' => 'description'
        }
      },
      ]
    end

    def self.display_name
      "Producto"
    end

    # def self.gallery_children
    #   'photos'
    # end

    def self.icon
      "icon-truck"
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
adminpanel-2.4.3 test/dummy/app/models/adminpanel/product.rb
adminpanel-2.4.2 test/dummy/app/models/adminpanel/product.rb
adminpanel-2.4.1 test/dummy/app/models/adminpanel/product.rb
adminpanel-2.4.0 test/dummy/app/models/adminpanel/product.rb
adminpanel-2.3.1 test/dummy/app/models/adminpanel/product.rb
adminpanel-2.3.0 test/dummy/app/models/adminpanel/product.rb