Class: Spree::Admin::DashboardController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/spree/admin/dashboard_controller.rb

Instance Method Summary collapse

Instance Method Details

#show ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/controllers/spree/admin/dashboard_controller.rb', line 4

def show
  @products_added = current_store.products.any?
  @shipping_methods_added = Spree::ShippingMethod.any?
  @payment_methods_added = current_store.payment_methods.any?
  @taxes_added = Spree::TaxRate.any?

  @onboarding_complete = @products_added && @shipping_methods_added && @payment_methods_added && @taxes_added

  @shippable_countries = Spree::ShippingMethod.all.collect(&:zones).flatten.uniq.compact.collect(&:countries).flatten.uniq.sort_by(&:name)

  @active_tab = if !@products_added
                  'products'
                elsif !@shipping_methods_added
                  'shipping'
                elsif !@payment_methods_added
                  'payment'
                else
                  'taxes'
                end
end