Sha256: 6f81d7610c5025ff8ef1f07446561ec14d464d54f3842bca8ac0193bc47414e8

Contents?: true

Size: 1.29 KB

Versions: 14

Compression:

Stored size: 1.29 KB

Contents

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

    has_many :categorizations
    has_many :categories, through: :categorizations

    mount_images :photos

    validates_presence_of :name
    validates_presence_of :price
    validates_presence_of :description

    def supername
      "Super#{name}"
    end

    def self.form_attributes
      [
      {
        "category_ids" => {
          "type" => "checkbox",
          "options" => Proc.new {|object|
            Adminpanel::Category.all
          }
        }
      },

      {
        'name' => {
          'type' => 'text_field',
          'label' => 'name',
          'placeholder' => 'name'}
      },
      {
        'price' => {
          'type' => 'text_field',
        }
      },
      {
        '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.icon
      "icon-truck"
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
adminpanel-3.6.1 test/dummy/app/models/adminpanel/product.rb
adminpanel-3.6.0 test/dummy/app/models/adminpanel/product.rb
adminpanel-3.5.1 test/dummy/app/models/adminpanel/product.rb
adminpanel-3.5.0 test/dummy/app/models/adminpanel/product.rb
adminpanel-3.4.7 test/dummy/app/models/adminpanel/product.rb
adminpanel-3.4.6 test/dummy/app/models/adminpanel/product.rb
adminpanel-3.4.5 test/dummy/app/models/adminpanel/product.rb
adminpanel-3.4.4 test/dummy/app/models/adminpanel/product.rb
adminpanel-3.4.3 test/dummy/app/models/adminpanel/product.rb
adminpanel-3.4.2 test/dummy/app/models/adminpanel/product.rb
adminpanel-3.4.1 test/dummy/app/models/adminpanel/product.rb
adminpanel-3.4.0 test/dummy/app/models/adminpanel/product.rb
adminpanel-3.3.4 test/dummy/app/models/adminpanel/product.rb
adminpanel-3.3.3 test/dummy/app/models/adminpanel/product.rb