Skip to content
This repository was archived by the owner on Nov 17, 2018. It is now read-only.

Commit ba27874

Browse files
committed
Committed unadded files.
1 parent f8f5660 commit ba27874

File tree

7 files changed

+155
-0
lines changed

7 files changed

+155
-0
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Place all the behaviors and hooks related to the matching controller here.
2+
# All this logic will automatically be available in application.js.
3+
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
4+
5+
6+
prettyTime = (t) -> "#{t.toLocaleTimeString()} #{t.getMonth()+1}/#{t.getDate()}"
7+
8+
prettyFriendName = (f) -> "#{f.first_name} #{f.last_name}"
9+
10+
options =
11+
chartType: 'AreaChart'
12+
13+
cols: [{id: 'date', type: 'date'}],
14+
15+
url: '/user/get_balances_over_time_with_friends'
16+
17+
processData: (d) ->
18+
console.debug(d)
19+
friends = d.friends
20+
balanceses = d.balances
21+
rows = []
22+
for friend in friends
23+
options.cols.push({id: friend.id, label: prettyFriendName(friend), type:'number'})
24+
console.debug(balanceses)
25+
for [strDate, balances] in balanceses
26+
console.debug(balances)
27+
date = new Date(strDate)
28+
rows.push({
29+
c: [
30+
{
31+
v: date,
32+
f: prettyTime(date)
33+
}
34+
].concat(balances.map((b) -> {v: b or 0}))
35+
})
36+
console.debug(rows)
37+
return rows
38+
39+
optionsMainChart:
40+
hAxis:
41+
textStyle:
42+
fontName: 'Lucida Grande'
43+
vAxis:
44+
textStyle:
45+
fontName: 'Lucida Grande'
46+
47+
optionsScrollChart:
48+
backgroundColor: '#F5F5F5'
49+
chartArea:
50+
width: '100%'
51+
height: '100%'
52+
hAxis:
53+
textPosition: 'none'
54+
vAxis:
55+
textPosition: 'none'
56+
57+
createScrolledChart(options)
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
2+
urlParams = Hash[*window.location.href[window.location.href.indexOf('?') + 1..].split(/&|=/)]
3+
4+
console.log(urlParams)
5+
6+
prettyTime = (t) -> "#{t.toLocaleTimeString()} #{t.getMonth()+1}/#{t.getDate()}"
7+
8+
9+
options =
10+
chartType: 'AreaChart'
11+
12+
cols: [{id: 'date', type: 'date'}, {id: 'balance', type: 'number'}]
13+
14+
url: "/user/get_expenses_over_time_cumulative?query=#{urlParams['query']}"
15+
16+
processData: (d) -> d.map((e) ->
17+
date = new Date(e.date)
18+
{c: [{v: date, f: prettyTime(date)}, {v: Number(e.expense)}]}
19+
)
20+
21+
optionsMainChart:
22+
colors: ['#0088CC']
23+
legend:
24+
position: 'none'
25+
hAxis:
26+
textStyle:
27+
fontName: 'Lucida Grande'
28+
vAxis:
29+
textStyle:
30+
fontName: 'Lucida Grande'
31+
32+
optionsScrollChart:
33+
colors: ['#0088CC']
34+
backgroundColor: '#F5F5F5'
35+
chartArea:
36+
width: '100%'
37+
height: '100%'
38+
legend:
39+
position: 'none'
40+
hAxis:
41+
textPosition: 'none'
42+
vAxis:
43+
textPosition: 'none'
44+
45+
$(activateMatchbox)
46+
createScrolledChart(options)

app/views/.DS_Store

6 KB
Binary file not shown.

app/views/layouts/.DS_Store

6 KB
Binary file not shown.

app/views/user/_top_menu.html.erb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<ul id='top-menu'>
2+
<% [
3+
['balance', 'Balance', '/user/balance_over_time'],
4+
['expenses', 'Expenses', '/user/expenses_over_time'],
5+
['more', 'More', '#'],
6+
['menu', 'Menu', '#'],
7+
['options', 'Options', '#']
8+
].each do |id, name, link| %>
9+
<li class='top-menu-item <%= id %> <%= 'active' if id == top_menu.to_s %>'>
10+
<a href='<%= link %>'><%= name %></a>
11+
</li>
12+
<% end %>
13+
<li class='top-menu-item logout'>
14+
<a href='/user/logout'>Logout</a>
15+
</li>
16+
</ul>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<%= render partial: 'user/top_menu', object: :balance %>
2+
<%= javascript_include_tag "oauth_balances_over_time_with_friends" %>
3+
<div id='main-container-outer'>
4+
<div id='main-container'>
5+
<div id='side-menu-container'>
6+
<%= render partial: 'user/balance_side_menu', object: :'with-friends' %>
7+
</div>
8+
<div id='content-container'>
9+
<div id='main-chart-container'>
10+
<div id='main-chart'></div>
11+
</div>
12+
<div id='scroll-chart-container' class='well'>
13+
<div id='scroll-chart'></div>
14+
</div>
15+
</div>
16+
</div>
17+
</div>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<div id='data'></div>
2+
<%= render partial: 'user/top_menu', object: :expenses %>
3+
<%= javascript_include_tag "oauth_expenses" %>
4+
5+
<div id='main-container-outer'>
6+
<div id='main-container'>
7+
<div id='side-menu-container'>
8+
<%= render partial: 'user/expenses_side_menu', object: :total %>
9+
</div>
10+
<div id='content-container'>
11+
<div id='main-chart-container'>
12+
<div id='main-chart'></div>
13+
</div>
14+
<div id='scroll-chart-container' class='well'>
15+
<div id='scroll-chart'></div>
16+
</div>
17+
</div>
18+
</div>
19+
</div>

0 commit comments

Comments
 (0)