Adding distributor and producer checkboxes to enterprise index

This commit is contained in:
Rob H
2014-09-07 21:04:53 +10:00
parent 6540bb8efc
commit 5fb4110328
2 changed files with 14 additions and 13 deletions

View File

@@ -28,14 +28,11 @@
%tr{class: "enterprise-#{enterprise.id}"}
%td= link_to enterprise.name, main_app.edit_admin_enterprise_path(enterprise)
%td
- if enterprise.is_primary_producer && enterprise.is_distributor
Producer & Distributor
- elsif enterprise.is_distributor
Distributor
- elsif enterprise.is_primary_producer
Producer
- else
%h1.icon-exclamation-sign.with-tip{"data-powertip" => "This enterprise does not have any roles", style: "text-align: center;color: #DA5354"}
= enterprise_form.check_box :is_primary_producer
Producer
%br/
= enterprise_form.check_box :is_distributor
Hub
%td= enterprise_form.check_box :visible
%td= enterprise_form.select :type, Enterprise::TYPES, {}, class: 'select2 fullwidth'
%td{"data-hook" => "admin_users_index_row_actions"}

View File

@@ -263,16 +263,20 @@ feature %q{
click_link "Enterprises"
within("tr.enterprise-#{supplier1.id}") do
expect(page).to have_content supplier1.name
expect(page).to have_select "enterprise_set_collection_attributes_1_type"
end
within("tr.enterprise-#{distributor1.id}") do
expect(page).to have_content distributor1.name
expect(page).to have_checked_field "enterprise_set_collection_attributes_0_is_distributor"
expect(page).to have_unchecked_field "enterprise_set_collection_attributes_0_is_primary_producer"
expect(page).to have_select "enterprise_set_collection_attributes_0_type"
end
within("tr.enterprise-#{supplier1.id}") do
expect(page).to have_content supplier1.name
expect(page).to have_unchecked_field "enterprise_set_collection_attributes_1_is_distributor"
expect(page).to have_checked_field "enterprise_set_collection_attributes_1_is_primary_producer"
expect(page).to have_select "enterprise_set_collection_attributes_1_type"
end
expect(page).to_not have_content "supplier2.name"
expect(page).to_not have_content "distributor2.name"
end