Do not display links to enterprise payment methods and shipping methods when enterprise is a supplier only

This commit is contained in:
Rohan Mitchell
2013-10-24 10:46:03 +11:00
parent fb22b5e2b7
commit 0d1dd361d6
2 changed files with 23 additions and 4 deletions

View File

@@ -41,8 +41,10 @@
<%= link_to_with_icon('icon-edit', 'Edit Profile', main_app.edit_admin_enterprise_path(enterprise), class: 'edit') %><br />
<%= link_to_delete_enterprise enterprise %><br />
<%= link_to_with_icon 'icon-chevron-right', 'Payment Methods', spree.admin_payment_methods_path(enterprise_id: enterprise.id) %> (<%= enterprise.payment_methods.count %>)<br />
<%= link_to_with_icon 'icon-plane', 'Shipping Methods', spree.admin_shipping_methods_path(enterprise_id: enterprise.id) %> (<%= enterprise.shipping_methods.count %>)<br />
<% if enterprise.is_distributor %>
<%= link_to_with_icon 'icon-chevron-right', 'Payment Methods', spree.admin_payment_methods_path(enterprise_id: enterprise.id) %> (<%= enterprise.payment_methods.count %>)<br />
<%= link_to_with_icon 'icon-plane', 'Shipping Methods', spree.admin_shipping_methods_path(enterprise_id: enterprise.id) %> (<%= enterprise.shipping_methods.count %>)<br />
<% end %>
<%= link_to_with_icon 'icon-money', 'Enterprise Fees', main_app.admin_enterprise_fees_path(enterprise_id: enterprise.id) %> (<%= enterprise.enterprise_fees.count %>)
</td>
</tr>

View File

@@ -17,12 +17,29 @@ feature %q{
end
scenario "listing enterprises" do
e = create(:enterprise)
s = create(:supplier_enterprise)
d = create(:distributor_enterprise)
login_to_admin_section
click_link 'Enterprises'
page.should have_content e.name
within("tr.enterprise-#{s.id}") do
page.should have_content s.name
page.should have_content "Edit Profile"
page.should have_content "Delete"
page.should_not have_content "Payment Methods"
page.should_not have_content "Shipping Methods"
page.should have_content "Enterprise Fees"
end
within("tr.enterprise-#{d.id}") do
page.should have_content d.name
page.should have_content "Edit Profile"
page.should have_content "Delete"
page.should have_content "Payment Methods"
page.should have_content "Shipping Methods"
page.should have_content "Enterprise Fees"
end
end
scenario "viewing an enterprise" do