Sha256: 97dbdb457f1eb3bb53d7492ee6c7469d7905ca87f1ebba3344f9d82d2b433607

Contents?: true

Size: 1.16 KB

Versions: 4

Compression:

Stored size: 1.16 KB

Contents

module Adminpanel
  class Product < ActiveRecord::Base
    attr_accessible :price, :name, :photos_attributes, :category_ids, :description

    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',
					'name' => 'name',
					'label' => 'name',
					'placeholder' => 'name'}
			},
      {
        'price' => {
          'type' => 'text_field',
          'name' => 'price'
        }
      },
			{
				'photos' => {
					'type' => 'adminpanel_file_field',
					'name' => 'photo',
					'label' => 'photo',
					'placeholder' => 'photo'}
			},
			{
				'description' => {
					'type' => 'wysiwyg_field',
					'name' => 'description',
					'label' => 'description',
					'placeholder' => 'description'}
			},
      ]
    end

    def self.display_name
      "Product"
    end

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
adminpanel-1.2.12 spec/dummy/app/models/adminpanel/product.rb
adminpanel-1.2.11 spec/dummy/app/models/adminpanel/product.rb
adminpanel-1.2.10 spec/dummy/app/models/adminpanel/product.rb
adminpanel-1.2.9 spec/dummy/app/models/adminpanel/product.rb