Fixing display of cloned products

The producer and the unit is displayed again.
This commit is contained in:
Maikel Linke
2015-08-27 11:55:31 +10:00
parent 5d34b711e9
commit 64834dd50a
2 changed files with 10 additions and 1 deletions

View File

@@ -19,6 +19,7 @@ angular.module("ofn.admin").factory "BulkProducts", (PagedFetcher, dataFetcher)
# when a respond_overrride for the clone action is used.
id = data.product.id
dataFetcher("/api/products/" + id + "?template=bulk_show").then (newProduct) =>
@unpackProduct newProduct
@insertProductAfter(product, newProduct)
updateVariantLists: (serverProducts, productsWithUnsavedVariants) ->

View File

@@ -1,5 +1,11 @@
object @product
attributes :id, :name, :variant_unit, :variant_unit_scale, :variant_unit_name, :on_demand
# TODO: This is used by bulk product edit when a product is cloned.
# But the list of products is serialized by Api::Admin::ProductSerializer.
# This should probably be unified.
attributes :id, :name, :sku, :variant_unit, :variant_unit_scale, :variant_unit_name, :on_demand, :inherits_properties
attributes :on_hand, :price, :available_on, :permalink_live, :tax_category_id
# Infinity is not a valid JSON object, but Rails encodes it anyway
node( :taxon_ids ) { |p| p.taxons.map{ |t| t.id }.join(",") }
@@ -8,6 +14,8 @@ node( :price ) { |p| p.price.nil? ? '0.0' : p.price }
node( :available_on ) { |p| p.available_on.blank? ? "" : p.available_on.strftime("%F %T") }
node( :permalink_live ) { |p| p.permalink }
node( :producer_id ) { |p| p.supplier_id }
node( :category_id ) { |p| p.primary_taxon_id }
node( :supplier ) do |p|
partial 'api/enterprises/bulk_show', :object => p.supplier
end