test/dummy/app/models/adminpanel/product.rb in adminpanel-2.5.3 vs test/dummy/app/models/adminpanel/product.rb in adminpanel-2.5.4
- old
+ new
@@ -1,31 +1,43 @@
module Adminpanel
class Product < ActiveRecord::Base
include Adminpanel::Base
include Adminpanel::Facebook
include Adminpanel::Twitter
+ 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" => "has_many", "model" => "Adminpanel::Category", "name" => "category_ids"}},
{
+ "category_ids" => {
+ "type" => "checkbox",
+ "options" => Proc.new {|object|
+ Adminpanel::Category.all
+ }
+ }
+ },
+
+ {
'name' => {
'type' => 'text_field',
'label' => 'name',
'placeholder' => 'name'}
},
{
'price' => {
'type' => 'text_field',
- 'name' => 'price'
}
},
{
'photos' => {
'type' => 'adminpanel_file_field',