Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

More bugfixes

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

0 notes on commit 391f173

Please sign in to comment.
Something went wrong with that request. Please try again.