mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-04-05 07:19:14 +00:00
Admin can reorder producer properties
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
class ProducerProperty < ActiveRecord::Base
|
||||
belongs_to :property, class_name: 'Spree::Property'
|
||||
|
||||
default_scope order("#{self.table_name}.position")
|
||||
|
||||
|
||||
def property_name
|
||||
property.name if property
|
||||
end
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
%tr.product_property.fields{"data-hook" => "producer_property", id: "#{dom_id(f.object)}"}
|
||||
-# admin/admin.js.erb in spree requires id to start with "spree_" for sortable tables
|
||||
%tr.product_property.fields{"data-hook" => "producer_property", id: "spree_#{dom_id(f.object)}"}
|
||||
%td.no-border
|
||||
%span.handle
|
||||
= f.hidden_field :id
|
||||
|
||||
@@ -218,7 +218,7 @@ feature %q{
|
||||
|
||||
# And I remove the property
|
||||
page.should have_field 'enterprise_producer_properties_attributes_0_property_name', with: 'Certified Organic'
|
||||
within("#producer_property_#{pp.id}") { page.find('a.remove_fields').click }
|
||||
within("#spree_producer_property_#{pp.id}") { page.find('a.remove_fields').click }
|
||||
|
||||
# Then the property should have been removed
|
||||
page.should_not have_field 'enterprise_producer_properties_attributes_0_property_name', with: 'Certified Organic'
|
||||
|
||||
Reference in New Issue
Block a user