|
|
@@ -9,13 +9,13 @@ class ProductAttrConfig < ActiveRecord::Base
|
|
|
showProducts=[]
|
|
|
@products = Product.where("show_flag=1").order("created_at desc")
|
|
|
@products.each do |pd|
|
|
|
- a=[pd.id,pd.name]
|
|
|
+ a=[pd.name,pd.id]
|
|
|
showProducts.push(a)
|
|
|
end
|
|
|
showProducts.each {|v| puts v}
|
|
|
return showProducts
|
|
|
end
|
|
|
-
|
|
|
+ TYPE_ENUM = [["颜色","color"],["尺码","size"]]
|
|
|
rails_admin do
|
|
|
navigation_label '商品管理'
|
|
|
weight -250
|
|
|
@@ -28,23 +28,46 @@ class ProductAttrConfig < ActiveRecord::Base
|
|
|
list do
|
|
|
filters [:product_id,:product_attr_key]
|
|
|
field :id
|
|
|
- field :product_id
|
|
|
- field :show_products
|
|
|
+ field :product_id, :enum do
|
|
|
+ enum do
|
|
|
+ show_products
|
|
|
+ end
|
|
|
+ end
|
|
|
field :product_attr_key
|
|
|
- field :size_type
|
|
|
+ field :size_type, :enum do
|
|
|
+ enum do
|
|
|
+ TYPE_ENUM
|
|
|
+ end
|
|
|
+ end
|
|
|
end
|
|
|
|
|
|
show do
|
|
|
field :id
|
|
|
- field :product_id
|
|
|
+ field :product_id, :enum do
|
|
|
+ enum do
|
|
|
+ show_products
|
|
|
+ end
|
|
|
+ end
|
|
|
field :product_attr_key
|
|
|
- field :size_type
|
|
|
+ field :size_type, :enum do
|
|
|
+ enum do
|
|
|
+ TYPE_ENUM
|
|
|
+ end
|
|
|
+ end
|
|
|
end
|
|
|
|
|
|
edit do
|
|
|
- field :product_id
|
|
|
+ field :product_id, :enum do
|
|
|
+ enum do
|
|
|
+ show_products
|
|
|
+ end
|
|
|
+ end
|
|
|
field :product_attr_key
|
|
|
- field :size_type
|
|
|
+ field :size_type, :enum do
|
|
|
+ enum do
|
|
|
+ TYPE_ENUM
|
|
|
+ end
|
|
|
+ end
|
|
|
end
|
|
|
end
|
|
|
|