rename _count vars to _total

This commit is contained in:
David Cook
2013-05-22 14:03:51 +10:00
parent 4e7f966429
commit 423bd52fd6
4 changed files with 35 additions and 8 deletions

1
.gitignore vendored
View File

@@ -30,4 +30,3 @@ config/abr.yml
config/heroku_env.rb
NERD_tree*
coverage
config/database.yml

View File

@@ -11,9 +11,9 @@ class ApplicationController < ActionController::Base
def load_data_for_sidebar
@suppliers = Enterprise.is_primary_producer.with_supplied_active_products_on_hand.limit(5)
@supplier_count = Enterprise.is_primary_producer.with_supplied_active_products_on_hand.count
@supplier_total = Enterprise.is_primary_producer.with_supplied_active_products_on_hand.count
@distributors = Enterprise.is_distributor.with_distributed_active_products_on_hand.by_name.limit(5)
@distributor_count = Enterprise.is_distributor.with_distributed_active_products_on_hand.by_name.count
@distributor_total = Enterprise.is_distributor.with_distributed_active_products_on_hand.by_name.count
end
# All render calls within the block will be performed with the specified format

View File

@@ -11,8 +11,8 @@
= link_to distributor.name, [main_app, distributor]
- else
%abbr(title="One or more of the products in your cart is not available from this distributor")= distributor.name
- if @distributor_count > @distributors.count
- distributors_more = @distributors.count - @distributor_count
- if @distributor_total > @distributors.count
- distributors_more = @distributors.count - @distributor_total
= "#{distributors_more} more..."
- if current_distributor && validator.can_change_distributor?
= button_to 'Browse All Distributors', deselect_distributor_orders_path, :method => :get
@@ -20,9 +20,8 @@
%h6.filter_name Shop by Supplier
%ul.filter_choices
- @suppliers.each do |supplier|
-# - if supplier.has_supplied_products_on_hand? -#d.cook: this is filtered in the controller now
%li.nowrap= link_to supplier.name, [main_app, supplier]
- if @supplier_count > @suppliers.count
- suppliers_more = @suppliers.count - @supplier_count
- if @supplier_total > @suppliers.count
- suppliers_more = @suppliers.count - @supplier_total
= "#{suppliers_more} more..."
= button_to 'Browse All Suppliers', main_app.suppliers_enterprises_path, :method => :get

29
config/database.yml Normal file
View File

@@ -0,0 +1,29 @@
development:
adapter: postgresql
encoding: unicode
#template: template0
#collate: en_US.UTF8
#ctype: en_US.UTF8
database: open_food_web_dev
pool: 5
host: localhost
username: ofw
password: f00d
test:
adapter: postgresql
encoding: unicode
database: open_food_web_test
pool: 5
host: localhost
username: ofw
password: f00d
#not used with heroku
production:
adapter: postgresql
encoding: unicode
database: open_food_web_prod
pool: 5
username: ofw
password: f00d