mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-06 02:51:34 +00:00
Removing enterprises form from user edit page
This commit is contained in:
@@ -1,6 +0,0 @@
|
||||
Deface::Override.new(:virtual_path => "spree/admin/users/_form",
|
||||
:insert_after => "[data-hook='admin_user_form_fields']",
|
||||
:partial => "spree/admin/users/enterprises_form",
|
||||
:name => "add_enterprises_to_user"
|
||||
)
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
%fieldset
|
||||
%legend 'Manage Enterprises'
|
||||
= f.field_container :enterprise_roles do
|
||||
- f.object.build_enterprise_roles
|
||||
%table
|
||||
= f.fields_for :enterprise_roles do |enterprise_form|
|
||||
%tr
|
||||
%td
|
||||
= hidden_field_tag "#{enterprise_form.object_name}[_destroy]", 1, :id => nil
|
||||
= check_box_tag "#{enterprise_form.object_name}[_destroy]", 0, !enterprise_form.object.new_record?
|
||||
%td
|
||||
= label_tag "#{enterprise_form.object_name}[_destroy]", enterprise_form.object.enterprise.name
|
||||
= enterprise_form.hidden_field :enterprise_id
|
||||
@@ -31,30 +31,6 @@ feature %q{
|
||||
user.enterprises.first.name.should == supplier2.name
|
||||
end
|
||||
end
|
||||
|
||||
context "with existing enterprises managed" do
|
||||
before do
|
||||
user.enterprise_roles.create!(enterprise: supplier1)
|
||||
user.enterprise_roles.create!(enterprise: distributor1)
|
||||
end
|
||||
|
||||
it "can remove and add enterprise management for a user" do
|
||||
login_to_admin_section
|
||||
|
||||
click_link 'Users'
|
||||
click_link user.email
|
||||
click_link 'Edit'
|
||||
|
||||
uncheck distributor1.name # remove
|
||||
check distributor2.name # add
|
||||
|
||||
click_button 'Update'
|
||||
|
||||
user.enterprises.count.should == 2
|
||||
user.enterprises.should include supplier1
|
||||
user.enterprises.should include distributor2
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "product management" do
|
||||
|
||||
Reference in New Issue
Block a user