Do not show icons for producer-enterprises

Payment and shipping methods don't apply to them.
This commit is contained in:
Pau Perez
2018-05-22 16:50:27 +02:00
parent 208e3bbadd
commit 2a3772dba0
2 changed files with 34 additions and 32 deletions

View File

@@ -0,0 +1,33 @@
%a.sixteen.columns.alpha.list-item{ class: "#{cycle('odd','even')}", href: "#{main_app.edit_admin_enterprise_path(enterprise)}" }
%span.five.columns.alpha
= enterprise.name
%span.symbol.three.columns.centered
- if can?(:admin, Spree::PaymentMethod) && enterprise.is_distributor
- payment_method_count = enterprise.payment_methods.count
- if payment_method_count > 0
%span.icon-ok-sign{ 'ofn-with-tip' => "#{pluralize payment_method_count, 'payment method'}" }
- else
%span.icon-remove-sign{ 'ofn-with-tip' => t('.has_no_payment_methods', enterprise: enterprise.name) }
- else
 
%span.symbol.three.columns.centered
- if can?(:admin, Spree::ShippingMethod) && enterprise.is_distributor
- shipping_method_count = enterprise.shipping_methods.count
- if shipping_method_count > 0
%span.icon-ok-sign{ 'ofn-with-tip' => "#{pluralize shipping_method_count, 'shipping method'}" }
- else
%span.icon-remove-sign{ 'ofn-with-tip' => t('.has_no_shipping_methods', enterprise: enterprise.name) }
- else
 
%span.symbol.three.columns.centered
- if can?(:admin, EnterpriseFee) && enterprise.is_distributor
- fee_count = enterprise.enterprise_fees.count
- if fee_count > 0
%span.icon-ok-sign{ 'ofn-with-tip' => "#{pluralize fee_count, 'fee'}" }
- else
%span.icon-warning-sign{ 'ofn-with-tip' => t('.has_no_enterprise_fees', enterprise: enterprise.name) }
- else
 
%span.two.columns.omega.right
%span.icon-arrow-right

View File

@@ -26,38 +26,7 @@
= t "spree_admin_enterprises_fees"
%div.sixteen.columns.alpha.list
- @enterprises.each do |enterprise|
%a.sixteen.columns.alpha.list-item{ class: "#{cycle('odd','even')}", href: "#{main_app.edit_admin_enterprise_path(enterprise)}" }
%span.five.columns.alpha
= enterprise.name
%span.symbol.three.columns.centered
- if can? :admin, Spree::PaymentMethod
- payment_method_count = enterprise.payment_methods.count
- if payment_method_count > 0
%span.icon-ok-sign{ 'ofn-with-tip' => "#{pluralize payment_method_count, 'payment method'}" }
- else
%span.icon-remove-sign{ 'ofn-with-tip' => t('.has_no_payment_methods', enterprise: enterprise.name) }
- else
 
%span.symbol.three.columns.centered
- if can? :admin, Spree::ShippingMethod
- shipping_method_count = enterprise.shipping_methods.count
- if shipping_method_count > 0
%span.icon-ok-sign{ 'ofn-with-tip' => "#{pluralize shipping_method_count, 'shipping method'}" }
- else
%span.icon-remove-sign{ 'ofn-with-tip' => t('.has_no_shipping_methods', enterprise: enterprise.name) }
- else
 
%span.symbol.three.columns.centered
- if can? :admin, EnterpriseFee
- fee_count = enterprise.enterprise_fees.count
- if fee_count > 0
%span.icon-ok-sign{ 'ofn-with-tip' => "#{pluralize fee_count, 'fee'}" }
- else
%span.icon-warning-sign{ 'ofn-with-tip' => t('.has_no_enterprise_fees', enterprise: enterprise.name) }
- else
 
%span.two.columns.omega.right
%span.icon-arrow-right
= render 'enterprise_row', { enterprise: enterprise }
%a.sixteen.columns.alpha.button.bottom.blue{ href: "#{main_app.admin_enterprises_path}" }
= t "spree_admin_overview_enterprises_footer"