Skip to content
Permalink
Browse files

redesign, refactor, rebuild

  • Loading branch information...
SelenaSmall committed Sep 17, 2015
1 parent de65856 commit a6ff04afe2535fb18affddaf2b66955b285dd4cf
Showing with 434 additions and 263 deletions.
  1. +1 −1 app/assets/stylesheets/application.scss
  2. +0 −80 app/assets/stylesheets/income.scss
  3. +99 −3 app/assets/stylesheets/mybudget.scss
  4. +21 −10 app/controllers/expenses_controller.rb
  5. +23 −9 app/controllers/incomes_controller.rb
  6. +0 −7 app/controllers/mybudget_controller.rb
  7. +51 −0 app/controllers/mybudgets_controller.rb
  8. +1 −3 app/models/expense.rb
  9. +0 −4 app/models/income.rb
  10. +4 −0 app/models/mybudget.rb
  11. +0 −37 app/views/expenses/_expenses_index_form.html.erb
  12. +30 −0 app/views/expenses/_form.html.erb
  13. +0 −37 app/views/expenses/_new_expenses_form.html.erb
  14. +2 −2 app/views/expenses/edit.html.erb
  15. +1 −0 app/views/expenses/new.html.erb
  16. +6 −7 app/views/incomes/{_new_incomes_form.html.erb → _form.html.erb}
  17. +0 −37 app/views/incomes/_incomes_index_form.html.erb
  18. +1 −2 app/views/incomes/edit.html.erb
  19. +3 −0 app/views/incomes/new.html.erb
  20. +1 −2 app/views/layouts/application.html.erb
  21. +0 −10 app/views/mybudget/home.html.erb
  22. +31 −0 app/views/mybudgets/_expenses.html.erb
  23. +29 −0 app/views/mybudgets/_form.html.erb
  24. +30 −0 app/views/mybudgets/_incomes.html.erb
  25. +27 −0 app/views/mybudgets/index.html.erb
  26. +1 −0 app/views/mybudgets/new.html.erb
  27. +19 −0 app/views/mybudgets/show.html.erb
  28. +3 −3 config/routes.rb
  29. +3 −2 db/migrate/20150903122041_create_incomes.rb
  30. +3 −2 db/migrate/20150916090038_create_expenses.rb
  31. +9 −0 db/migrate/20150917073356_create_mybudgets.rb
  32. +17 −5 db/schema.rb
  33. +11 −0 test/fixtures/mybudgets.yml
  34. +7 −0 test/models/mybudget_test.rb
@@ -4,4 +4,4 @@

@import "rails_bootstrap_forms.css";

@import "income";
@import "mybudget";
@@ -1,80 +0,0 @@
.application {
background-color: #D6EAFF;
padding-top: 15px;
h1 {
font-size: 60px;
font-weight: bolder;
font-family: monospace;
color: black;
}
}

.navbar-default {
margin-bottom: 0px;
background-color: #D6EAFF;
border: none;
.dropdown-toggle {
padding: inherit;
padding-top: 20px;
padding-right: 20px;
}

}

.col-md-12 {
padding-left: 80px;
padding-right: 80px;
}

.col-md-8 {
margin: 15px;
}

.bordered-form {
margin-left: 50;
padding: 20px;
padding-left: 40px;
padding-right: 40px;
background-color: #ADD6FF;
border-radius: 15px;
width: 750px;

.field-name {
padding-left: 40px;
}

.field {
padding: 10px;
padding-left: 250px;

#income_other_income {
text-align: right;
}
#income_wages {
text-align: right;
}
}

.total-output {
text-align: right;
padding-right: 20px;
font-style: bold;
font-size: 40px
}

.actions {
padding-left: 472px;
font-size: 18px;
}

h1 {
font-size: 40px;
font-weight: inherit;
border-bottom: solid black 1px;
}
}

#total-field-name {
font-size: 25px;
color: #1F3D99;
}
@@ -1,3 +1,99 @@
// Place all the styles related to the mybudget controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
.application {
background-color: #D6EAFF;
padding-top: 15px;
h1 {
font-size: 60px;
font-weight: bolder;
font-family: monospace;
color: black;
}

.summary-row {
margin-left: 50px;
margin-top: 20px;
margin-bottom: 20px;

.total-field {
text-align: right;
margin-right: 20px;
padding-left: 200px;
font-style: bold;
font-size: 40px
}

#total-field-name {
font-size: 25px;
color: #1F3D99;
}
}
}

.navbar-default {
margin-bottom: 0px;
background-color: #D6EAFF;
border: none;
.dropdown-toggle {
padding: inherit;
padding-top: 20px;
padding-right: 20px;
}

}

.col-md-12 {
padding-left: 80px;
padding-right: 80px;
}

.col-md-8 {
margin: 15px;
}

.bordered-form {
margin-left: 50px;
margin-top: 20px;
margin-bottom: 20px;
padding: 20px;
padding-left: 40px;
padding-right: 40px;
background-color: #ADD6FF;
border-radius: 15px;
width: 750px;

.field-name {
padding-left: 40px;
}

.table {
padding: 10px;
padding-left: 250px;
}

.amount {
text-align: right;
}

.table-items {
text-align: right;
}

.total-output {
text-align: right;
padding-right: 20px;
font-style: bold;
font-size: 40px
}

.actions {
padding-left: 472px;
font-size: 18px;
}

h2 {
font-size: 40px;
font-weight: inherit;
border-bottom: solid black 1px;
text-align: left;
}

}
@@ -1,20 +1,27 @@
class ExpensesController < ApplicationController
before_action :set_mybudget
before_action :set_expense, only: [:show, :edit, :update, :destroy]

#def new
# @expense = Expense.new
#end
def index
@expenses = @mybudget.expenses.all
end

def edit
def new
@expense = @mybudget.expenses.build
end

def create
@expense = Expense.new(expense_params)
@expense = @mybudget.expenses.build(expense_params)

respond_to do |format|
if @expense.save
format.html { redirect_to edit_expense_path(@expense)}
end
end
if @expense.save
format.html { redirect_to [@mybudget, @expenses], notice: 'expense was successfully created.' }
format.json { render :show, status: :created, location: @expense }
else
format.html { render :new }
format.json { render json: @expense.errors, status: :unprocessable_entity }
end
end
end

def update
@@ -26,11 +33,15 @@ def update
end

private
def set_mybudget
@mybudget = Mybudget.find(params[:mybudget_id])
end

def set_expense
@expense = Expense.find(params[:id])
end

def expense_params
params.require(:expense).permit(:outgoing, :oneoff)
params.require(:expense).permit(:expense, :amount)
end
end
@@ -1,20 +1,30 @@
class IncomesController < ApplicationController
before_action :set_mybudget
before_action :set_income, only: [:show, :edit, :update, :destroy]

#def new
# @income = Income.new
#end
def index
@incomes = @mybudget.incomes.all
end

def new
@income = @mybudget.incomes.build
end

def edit
end

def create
@income = Income.new(income_params)
@income = @mybudget.incomes.build(income_params)

respond_to do |format|
if @income.save
format.html { redirect_to edit_income_path(@income)}
end
end
if @income.save
format.html { redirect_to [@mybudget, @incomes], notice: 'income was successfully created.' }
format.json { render :show, status: :created, location: @income }
else
format.html { render :new }
format.json { render json: @income.errors, status: :unprocessable_entity }
end
end
end

def update
@@ -26,11 +36,15 @@ def update
end

private
def set_mybudget
@mybudget = Mybudget.find(params[:mybudget_id])
end

def set_income
@income = Income.find(params[:id])
end

def income_params
params.require(:income).permit(:wages, :other_income)
params.require(:income).permit(:income, :amount)
end
end

This file was deleted.

@@ -0,0 +1,51 @@
class MybudgetsController < ApplicationController
before_action :set_mybudget, only: [:show, :edit, :update, :destroy]

def index
@mybudget = Mybudget.all
end

def new
@mybudget = Mybudget.new
end

def show
end

def edit
end

def create
@mybudget = Mybudget.new(mybudget_params)

respond_to do |format|
if @mybudget.save
format.html { redirect_to mybudget_path(@mybudget), notice: 'mybudget was successfully created.' }
format.json { render :show, status: :created, location: @mybudget }
else
format.html { render :new }
format.json { render json: @mybudget.errors, status: :unprocessable_entity }
end
end
end

def update
end

def destroy
@mybudget.destroy
respond_to do |format|
format.html { redirect_to mybudgets_home_path(@mybudget), notice: 'mybudget was successfully destroyed.' }
format.json { head :no_content }
end
end

private
def set_mybudget
@mybudget = Mybudget.find(params[:id])
end

def mybudget_params
params.require(:mybudget).permit(:name, :open_bal)
end
end
@@ -1,5 +1,3 @@
class Expense < ActiveRecord::Base
def total_expense
outgoing.to_d + oneoff.to_d
end
belongs_to :mybudget
end
@@ -1,7 +1,3 @@
class Income < ActiveRecord::Base
belongs_to :mybudget

def total_income
wages.to_d + other_income.to_d
end
end
@@ -0,0 +1,4 @@
class Mybudget < ActiveRecord::Base
has_many :incomes
has_many :expenses
end

0 comments on commit a6ff04a

Please sign in to comment.
You can’t perform that action at this time.