Skip to content
Browse files

uppdateringar

  • Loading branch information...
1 parent c284bd1 commit f28bd35e0aed75a7c35be22cafebb46339af47b1 @andreaseriksson committed Mar 29, 2012
View
BIN .DS_Store
Binary file not shown.
View
BIN app/.DS_Store
Binary file not shown.
View
7 app/assets/stylesheets/application.css
@@ -13,15 +13,14 @@
*/
body {
- padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
-
+ padding-top: 60px;
background-color: #e1e2f1;
/*background-image: url("bkg.png");*/
}
.jumbotron {
text-align: center;
- margin-bottom: 50px;
+ margin-bottom: 90px;
}
.jumbotron p {
@@ -88,6 +87,8 @@ body {
td a i {visibility: hidden;}
+ a.main-image { margin-bottom: 20px; }
+
@media (max-width: 480px) {
h1.logo {font-size: 60px;margin: 30px 0;}
View
66 app/controllers/dashboard_controller.rb
@@ -1,8 +1,66 @@
# encoding: utf-8
class DashboardController < ApplicationController
+
+ require 'date'
+
+ before_filter :authorize
- before_filter :authorize
-
- def index
- end
+ def index
+ #@categories = list_categories
+
+ @pie_chart_categories = get_transaction_categories
+ @range = test_f
+ end
+
+
+
+ #Function thats list all the transaction_categories
+ def get_transaction_categories
+
+ categories = list_categories
+
+ string = ""
+ i = 0
+ categories.each do |category|
+
+ i = i+1
+
+ string = string + "['#{category}', #{get_transaction_category_sum(category)}]"
+ if categories.count > i
+ string = string + ","
+ end
+
+ end
+
+ return string
+ end
+
+ def get_transaction_category_sum(category)
+
+ transactions = Transaction.where("account_id = ? AND category = ?", current_user.account_id,category).sum("amount")
+ return transactions
+ end
+
+ def test_f
+ date = current_user.account.created_at.beginning_of_month
+ laterdate = Date.new(2013, 1, 10)
+
+ month_list = ""
+
+ (date.year..laterdate.year).each do |y|
+ mo_start = (date.year == y) ? date.month : 1
+ mo_end = (laterdate.year == y) ? laterdate.month : 12
+
+ (mo_start..mo_end).each do |m|
+ #month_list = month_list + Date::MONTHNAMES[m]
+
+ date_post = y.to_s + "-" + m.to_s.rjust(2,'0') + ","
+
+ month_list = month_list + date_post
+
+ end
+ end
+ return month_list
+ end
+
end
View
BIN app/views/.DS_Store
Binary file not shown.
View
17 app/views/dashboard/index.html.erb
@@ -1,3 +1,8 @@
+<%= current_user.account.created_at.beginning_of_month %>
+<%= @pie_chart_categories %>
+
+<%= @range %>
+
<script type="text/javascript">
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
@@ -6,11 +11,7 @@
data.addColumn('string', 'Task');
data.addColumn('number', 'Hours per Day');
data.addRows([
- ['Work', 11],
- ['Eat', 2],
- ['Commute', 2],
- ['Watch TV', 2],
- ['Sleep', 7]
+ <%= @pie_chart_categories %>
]);
var options = {
@@ -36,6 +37,12 @@
</div>
<div class="span4">
<h3>Utgifter efter kategori</h3>
+ <h5>Period:
+ <%= form_tag("/dashboard", :method => "get") do %>
+ <%= select_tag(:year_month, options_for_select(@pie_chart_categories)) %>
+ <% end %>
+ </h5>
+ <p>Den här grafen ska visa vilka utgifter som finns uppdelat på kategorier.</p>
</div>
</div><!--/row-->
View
9 app/views/home/index.html.erb
@@ -1,12 +1,12 @@
- <div class="row">
- <div class="span12 jumbotron">
+ <div class="row">
+ <div class="span12 jumbotron">
<h1 class="logo">Hushålla.se</h1>
<p class="masthead">Håll enkelt koll på utgifter</p>
<p>
- <%= link_to("Registrera dig här", signup_path , :class => 'btn btn-large btn-primary') %>
+ <%= link_to('Registrera dig här', signup_path , :class => 'btn btn-large btn-primary') %>
<a href="#" class="btn btn-large">Så här fungerar det</a>
</p>
@@ -15,16 +15,19 @@
<div class="row">
<div class="span4">
+ <a href="#" class="thumbnail main-image"><img src="http://placehold.it/360x220"></a>
<h3>Kassabok</h3>
<p>Progress bars use CSS3 gradients, transitions, and animations to achieve all their effects. These features are not supported in IE7-9 or older versions of Firefox.</p>
<p>Opera and IE do not support animations at this time.</p>
</div>
<div class="span4">
+ <a href="#" class="thumbnail main-image"><img src="http://placehold.it/360x220"></a>
<h3>Årsbudget</h3>
<p>Progress bars use CSS3 gradients, transitions, and animations to achieve all their effects. These features are not supported in IE7-9 or older versions of Firefox.</p>
<p>Opera and IE do not support animations at this time.</p>
</div>
<div class="span4">
+ <a href="#" class="thumbnail main-image"><img src="http://placehold.it/360x220"></a>
<h3>Statistik & Grafer</h3>
<p>Progress bars use CSS3 gradients, transitions, and animations to achieve all their effects. These features are not supported in IE7-9 or older versions of Firefox.</p>
<p>Opera and IE do not support animations at this time.</p>
View
2 config/nginx.conf
@@ -4,7 +4,7 @@ upstream unicorn {
server {
listen 80 default deferred;
- # server_name example.com;
+ server_name hushalla.se www.hushalla.se hushålla.se www.hushålla.se;
root /home/deployer/apps/hushalla/current/public;
location ^~ /assets/ {

0 comments on commit f28bd35

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