mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-25 20:46:48 +00:00
Add visible checkbox to enterprises index page to allow bulk editing of visibility
This commit is contained in:
@@ -10,7 +10,8 @@ module Admin
|
||||
def bulk_update
|
||||
@enterprise_set = EnterpriseSet.new(params[:enterprise_set])
|
||||
if @enterprise_set.save
|
||||
redirect_to main_app.admin_enterprises_path, :notice => 'Distributor collection times updated.'
|
||||
flash[:success] = 'Enterprises updated successfully'
|
||||
redirect_to main_app.admin_enterprises_path
|
||||
else
|
||||
render :index
|
||||
end
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
Producer
|
||||
- else
|
||||
%h1.icon-exclamation-sign.with-tip{"data-powertip" => "This enterprise does not have any roles", style: "text-align: center;color: #DA5354"}
|
||||
%td= enterprise.visible ? 'Visible' : 'Invisible'
|
||||
%td= enterprise_form.check_box :visible
|
||||
%td= enterprise.description
|
||||
%td{"data-hook" => "admin_users_index_row_actions"}
|
||||
= link_to_with_icon('icon-edit', 'Edit Profile', main_app.edit_admin_enterprise_path(enterprise), class: 'edit')
|
||||
|
||||
@@ -33,6 +33,23 @@ feature %q{
|
||||
end
|
||||
end
|
||||
|
||||
scenario "editing enterprises in bulk" do
|
||||
s = create(:supplier_enterprise)
|
||||
d = create(:distributor_enterprise)
|
||||
|
||||
login_to_admin_section
|
||||
click_link 'Enterprises'
|
||||
|
||||
within("tr.enterprise-#{d.id}") do
|
||||
page.should have_field "enterprise_set_collection_attributes_0_visible", checked: true
|
||||
uncheck "enterprise_set_collection_attributes_0_visible"
|
||||
end
|
||||
click_button "Update"
|
||||
flash_message.should == 'Enterprises updated successfully'
|
||||
distributor = Enterprise.find(d.id)
|
||||
distributor.visible.should == false
|
||||
end
|
||||
|
||||
scenario "viewing an enterprise" do
|
||||
e = create(:enterprise)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user