Sort distribution choices by name

This commit is contained in:
Rohan Mitchell
2015-12-04 12:54:00 +11:00
parent 3419198635
commit 80ebaece2d
2 changed files with 4 additions and 2 deletions

View File

@@ -117,7 +117,7 @@ Spree::Admin::OrdersController.class_eval do
end
def load_distribution_choices
@shops = Enterprise.is_distributor.managed_by(spree_current_user)
@order_cycles = OrderCycle.managed_by(spree_current_user)
@shops = Enterprise.is_distributor.managed_by(spree_current_user).by_name
@order_cycles = OrderCycle.managed_by(spree_current_user).by_name
end
end

View File

@@ -24,6 +24,8 @@ class OrderCycle < ActiveRecord::Base
scope :soonest_opening, lambda { upcoming.order('order_cycles.orders_open_at ASC') }
scope :by_name, order('name')
scope :distributing_product, lambda { |product|
joins(:exchanges).
merge(Exchange.outgoing).