public
Description: A Family Budget application
Clone URL: git://github.com/francois/family_budget.git
Implement budget viewing.
francois (author)
Thu Feb 28 09:23:52 -0800 2008
commit  dfe543992f1ab8bb8128abeb105c9c6d976ae0f4
tree    12f1a8c2b47fef5035e42ec6de8165cc2ba22878
parent  7c2da594b980cff50749bdc67162fbc8ce72f481
...
44
45
46
 
 
 
 
47
...
44
45
46
47
48
49
50
51
0
@@ -44,4 +44,8 @@ module ApplicationHelper
0
   def render_current_date
0
     "#{DAY_NAMES[current_date.wday]} le #{current_date.day}"
0
   end
0
+
0
+ def amount(value)
0
+ value ? "%0.2f"%value : ""
0
+ end
0
 end
...
1
 
 
 
 
2
...
1
2
3
4
5
6
0
@@ -1,2 +1,6 @@
0
 module BudgetsHelper
0
+ MONTH_NAMES = %w(Janvier Février Mars Avril Mai Juin Juillet Août September Octobre Novembre Décembre)
0
+ def month_name(month)
0
+ MONTH_NAMES[month-1]
0
+ end
0
 end
...
1
2
 
 
 
 
3
4
5
...
1
2
3
4
5
6
7
8
9
0
@@ -1,5 +1,9 @@
0
 module Extensions
0
   module Budgets
0
+ def for_account_year_month(account, year, month)
0
+ find_or_initialize_by_account_id_and_year_and_month(account.id, year, month)
0
+ end
0
+
0
     def for_period(year, month)
0
       find(:all, :conditions => {:year => year, :month => month})
0
     end
...
16
17
18
19
 
 
20
21
22
...
16
17
18
 
19
20
21
22
23
0
@@ -16,7 +16,8 @@
0
     <tr>
0
       <td id="nav">
0
         <ul>
0
- <li class="accounts first"><%= link_to "Gérer mes comptes", accounts_path %></li>
0
+ <li class="budget first"><%= link_to "Gérer mon budget", budget_path %></li>
0
+ <li class="accounts"><%= link_to "Gérer mes comptes", accounts_path %></li>
0
           <li class="transfers"><%= link_to "Gérer mes transactions", transfers_path %></li>
0
           <li class="reports last"><%= link_to "Rapports", reports_path %></li>
0
         </ul>
...
1
2
3
 
4
5
6
...
1
2
3
4
5
6
7
0
@@ -1,6 +1,7 @@
0
 ActionController::Routing::Routes.draw do |map|
0
   map.resources :transfers
0
   map.resources :reports
0
+ map.resource :budget
0
 
0
   map.resources :accounts
0
 
...
24
25
26
 
 
 
 
 
...
24
25
26
27
28
29
30
31
0
@@ -24,3 +24,8 @@ table { border-collapse: collapse; }
0
 #newxfer label { display: block; }
0
 #newxfer input { display: block; }
0
 #newxfer h3 { background: black; color: white; padding: 0; margin-top: 0; font-size: 1em; }
0
+.budget { width: 100%; }
0
+.budget input, .budget td { text-align: right; }
0
+.budget td[scope] { text-align: left; }
0
+.budget td.over { background: red; }
0
+.budget tfoot td { font-weight: bold; border-top: 1px solid #735b3d; }

Comments

    No one has commented yet.