Permalink
Browse files

Moved some not static pages from the static_pages controller to a new…

… controller named home where user signed in home will be.
  • Loading branch information...
1 parent f5ee3ca commit 6eda3de34c3759c3e6cc947d55faa67e41d31af1 @ivik committed Nov 15, 2012
@@ -0,0 +1,16 @@
+class HomeController < ApplicationController
+ def home
+ if signed_in?
+ @yearbooks = current_user.yearbooks.paginate(page: params[:page_yearbooks], per_page: 5)
+ @categories = current_user.categories.paginate(page: params[:page_categories], per_page: 10)
+
+ #Get the last entered month
+ @month = @yearbooks.first.months.first
+
+ #Get the 10 last entered transactions
+ @transactions = @month.transactions.limit(15)
+ else
+ redirect_to "/start"
+ end
+ end
+end
@@ -1,14 +1,7 @@
class StaticPagesController < ApplicationController
def home
if signed_in?
- @yearbooks = current_user.yearbooks.paginate(page: params[:page_yearbooks], per_page: 5)
- @categories = current_user.categories.paginate(page: params[:page_categories], per_page: 10)
-
- #Get the last entered month
- @month = @yearbooks.first.months.first
-
- #Get the 10 last entered transactions
- @transactions = @month.transactions.limit(15)
+ redirect_to root_path
end
end
@@ -15,7 +15,9 @@
%td
= link_to category.name, category
%td
- TODO Needs to be done!
+ - category.sub_categories.each do |sub_category|
+ = link_to sub_category.name, edit_sub_category_path(sub_category)
+ %br
%td
= return_expense_or_income(category.is_expense)
%td
@@ -0,0 +1,9 @@
+- provide(:title, 'Welcome')
+.row
+ .span6
+ %section
+ = render 'yearbooks'
+ %section
+ = render 'categories'
+ .span6
+ = render 'transactions'
@@ -1,11 +0,0 @@
-- provide(:title, 'Sign in')
-.hero-unit.center
- %h1
- = full_title(yield)
- .row
- %p The best economic logger ever! or something like that...
-.row.center
- .span12
- %h2 No Account yet?
- %p
- #{link_to "Sign up now!", signup_path, class: "btn btn-large"}
@@ -1,9 +0,0 @@
-- provide(:title, 'Welcome')
-.row
- .span6
- %section
- = render 'static_pages/home_yearbooks'
- %section
- = render 'static_pages/home_categories'
- .span6
- = render 'static_pages/home_transactions'
@@ -1,4 +1,11 @@
-- if signed_in?
- = render 'static_pages/signed_in'
-- else
- = render 'static_pages/not_signed_in'
+- provide(:title, 'Sign in')
+.hero-unit.center
+ %h1
+ = full_title(yield)
+ .row
+ %p The best economic logger ever! or something like that...
+.row.center
+ .span12
+ %h2 No Account yet?
+ %p
+ #{link_to "Sign up now!", signup_path, class: "btn btn-large"}
View
@@ -1,6 +1,6 @@
EcoLogger::Application.routes.draw do
- root to: 'static_pages#home'
+ root to: 'home#home'
resources :users
resources :sessions, only: [:new, :create, :destroy]
@@ -32,6 +32,7 @@
match '/transactions/get_sub_categories', to: 'transactions#get_sub_categories'
+ match '/start', to: 'static_pages#home'
match '/help', to: 'static_pages#help'
match '/about', to: 'static_pages#about'
match '/contact', to: 'static_pages#contact'

0 comments on commit 6eda3de

Please sign in to comment.