Permalink
Browse files

New expenses modal

  • Loading branch information...
SelenaSmall committed Sep 20, 2015
1 parent 1d4caf0 commit f66038b8b088c3c2903d410ee1d9a51f45447613
@@ -17,6 +17,7 @@ def create
if @expense.save
format.html { redirect_to [@mybudget, @expenses], notice: 'expense was successfully created.' }
format.json { render :show, status: :created, location: @expense }
format.js {redirect_via_turbolinks_to [@mybudget, @expenses]}
else
format.html { render :new }
format.json { render json: @expense.errors, status: :unprocessable_entity }
@@ -1,4 +1,4 @@
class TransferController < ApplicationController
class TransfersController < ApplicationController
before_action :set_mybudget
before_action :set_transfer, only: [:show, :edit, :update, :destroy]

@@ -0,0 +1,29 @@
<div class="modal-dialog reorder-modal-form">
<div class="modal-content">
<%= bootstrap_form_for([@mybudget, @expense], remote: true) do |f| %>
<div class="modal-header">
<h4 class="modal-title">New Income</h4>
</div>

<div class="modal-body">
<table>
<tr>
<td class="field-name">
<%= f.label :expense %><br>
</td>
<td class="field"><%= f.text_field :expense %></td>
</tr>
<tr>
<td class="field-name"> <%= f.label :amount %><br></td>
<td class="field"><%= f.number_field :amount %></td>
</tr>
</table>
</div>

<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal" data-behaviour="form-clear">Cancel</button>
<%= f.submit class: "btn btn-primary", data: { trigger: 'loading' } %>
</div>
<% end %>
</div>
</div>
@@ -0,0 +1,2 @@
$("#new-expense-modal-form").html("<%= j render('expenses/modal_form_new', expense: @expense) %>");
$('#new-expense-modal-form').modal('show')

This file was deleted.

Oops, something went wrong.
@@ -2,7 +2,10 @@

<h2>Expenses</h2>
<div> - this will do the same as above. There will be links for each allowing for the calculation of new expenses added on the spot.</div>
<%= link_to 'Add Expense', new_mybudget_expense_path(@mybudget, @expense) %>

<%= link_to new_mybudget_expense_path(@mybudget, @expense),
remote: true, id: "new-item-link", class: "btn btn-sm btn-default round" do %> New
<%end%>

<table class="table" >
<thead>
@@ -1,8 +1,7 @@
<div class="bordered-form" >
<h2>Incomes</h2>
<div> - this is going to be an incomes show page which will list all of the incomes and allow the user to add new income values as the week goes. In the long run this will help keep track of projections.</div>

<!--<%= link_to 'Add Income', new_mybudget_income_path(@mybudget, @income) %>-->

<%= link_to new_mybudget_income_path(@mybudget, @income),
remote: true, id: "new-item-link", class: "btn btn-sm btn-default round" do %> New
<%end%>
@@ -1,8 +1,7 @@
<div class="bordered-form" >
<h2>transfers</h2>
<h2>Transfers</h2>
<div> - this is going to be an transfers show page which will list all of the transfers and allow the user to add new transfer values as the week goes. In the long run this will help keep track of projections.</div>

<!--<%= link_to 'Add transfer', new_mybudget_transfer_path(@mybudget, @transfer) %>-->
<%= link_to new_mybudget_transfer_path(@mybudget, @transfer),
remote: true, id: "new-item-link", class: "btn btn-sm btn-default round" do %> New
<%end%>
@@ -23,5 +23,7 @@

<!-- Modal form -->
<div class="modal fade" id='new-income-modal-form' role='dialog'></div>
<div class="modal fade" id='new-expense-modal-form' role='dialog'></div>
<div class="modal fade" id='new-transfer-modal-form' role='dialog'></div>
<!-- Modal form -->
</div>

0 comments on commit f66038b

Please sign in to comment.