mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-01 02:03:22 +00:00
Fix merge issues: DCV name change and application controller var name issues.
This commit is contained in:
@@ -9,6 +9,10 @@ class ApplicationController < ActionController::Base
|
||||
@cms_site = Cms::Site.where(:identifier => 'open-food-web').first
|
||||
end
|
||||
|
||||
# This is getting sloppy, since @all_distributors is also used for order cycle selection,
|
||||
# which is not in the sidebar. I don't like having an application controller method that's
|
||||
# coupled to several parts of the code. We might be able to solve this using cells:
|
||||
# https://github.com/apotonick/cells
|
||||
def load_data_for_sidebar
|
||||
sidebar_distributors_limit = false
|
||||
sidebar_suppliers_limit = false
|
||||
@@ -19,6 +23,7 @@ class ApplicationController < ActionController::Base
|
||||
@total_suppliers = Enterprise.is_primary_producer.distinct_count
|
||||
|
||||
@sidebar_distributors = Enterprise.active_distributors.by_name.limit(sidebar_distributors_limit)
|
||||
@all_distributors = Enterprise.active_distributors
|
||||
@total_distributors = Enterprise.is_distributor.distinct_count
|
||||
end
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<%= form_for current_order(true) do |f| %>
|
||||
<div class="distributors">
|
||||
<h2>Active Hubs</h2>
|
||||
<%= f.select :distributor_id, distributor_options(@distributors, f.object.distributor_id, current_order_cycle) %>
|
||||
<%= f.select :distributor_id, distributor_options(@all_distributors, f.object.distributor_id, current_order_cycle) %>
|
||||
<br />
|
||||
<%= f.submit 'Choose Hub' %>
|
||||
</div>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
%h6.filter_name Shop by Distributor
|
||||
%ul.filter_choices
|
||||
- order = current_order(false)
|
||||
- validator = DistributorChangeValidator.new(order)
|
||||
- validator = DistributionChangeValidator.new(order)
|
||||
- @sidebar_distributors.each do |distributor|
|
||||
%li.nowrap
|
||||
- if order.nil? || order.distributor == distributor || validator.can_change_to_distributor?(distributor)
|
||||
|
||||
Reference in New Issue
Block a user