Permalink
Browse files

More bugfixes

  • Loading branch information...
1 parent e3b6b6d commit 391f1736ec9ae2316b00f31f996a055c2682abe2 @sachac committed Nov 10, 2011
View
1 app/controllers/csa_foods_controller.rb
@@ -5,7 +5,6 @@ class CsaFoodsController < ApplicationController
# GET /csa_foods.xml
def index
@csa_foods = current_account.csa_foods.includes(:food).order('date_received DESC, disposition ASC')
- @remaining = CsaFood.remaining(current_user)
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @csa_foods }
View
25 app/views/clothing_logs/_by_date.html.haml
@@ -1,15 +1,16 @@
- dates ||= @dates
- by_date ||= @by_date
- size ||= :small
-%div
- - dates.each do |date|
- .entry
- - list = by_date[date]
- .date= link_to date, clothing_logs_by_date_path(date)
- .clothes
- - if list
- - list.each do |item|
- .item= clothing_thumbnail(item.clothing, :size => size)
- - else
- No records
-.clear-both
+- if dates
+ %div
+ - dates.each do |date|
+ .entry
+ - list = by_date[date]
+ .date= link_to date, clothing_logs_by_date_path(date)
+ .clothes
+ - if list
+ - list.each do |item|
+ .item= clothing_thumbnail(item.clothing, :size => size)
+ - else
+ No records
+ .clear-both
View
13 app/views/csa_foods/index.html.haml
@@ -1,8 +1,11 @@
-%h1
- Community-supported agriculture -
- = pluralize @remaining, 'gram'
- to go
-
+%h1 Community-supported agriculture
+.food.category
+ - remaining = (current_account.csa_foods.where('disposition = ""').sum(:quantity) / 1000.0)
+ - days = current_account.csa_foods.next_delivery - Date.today
+ = link_to "#{'%0.1f' % remaining}kg of CSA food to go,", csa_foods_path
+ = "#{pluralize days, "day"} until next delivery = "
+ = "#{'%0.1f' % (remaining * 1.0 / days)}kg per day"
+
= form_tag bulk_update_csa_foods_path do
- if can? :update, CsaFood
= submit_tag 'Update'

0 comments on commit 391f173

Please sign in to comment.