Skip to content
Permalink
Browse files

Create a new income modal

  • Loading branch information...
SelenaSmall committed Sep 20, 2015
1 parent 8e501d1 commit 694cb3ae84c5e2dbfbd0a2ecc4f8617455058319
@@ -20,6 +20,7 @@ def create
if @income.save
format.html { redirect_to [@mybudget, @incomes], notice: 'income was successfully created.' }
format.json { render :show, status: :created, location: @income }
format.js {redirect_via_turbolinks_to [@mybudget, @incomes]}
else
format.html { render :new }
format.json { render json: @income.errors, status: :unprocessable_entity }
@@ -1,30 +1,20 @@
<div class="bordered-form">
<%= form_for [@mybudget, @expense] do |f| %>
<%= form_for [@mybudget, @expense] do |f| %>

<table>
<tr>
<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>

<%= 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 class="actions">
<%= f.submit %>
<%= f.submit %>
</div>

<% end %>
<% end %>
</div>
@@ -0,0 +1,29 @@
<div class="modal-dialog reorder-modal-form">
<div class="modal-content">
<%= bootstrap_form_for([@mybudget, @income], 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 :income %><br>
</td>
<td class="field"><%= f.text_field :income %></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-income-modal-form").html("<%= j render('incomes/modal_form_new', income: @income) %>");
$('#new-income-modal-form').modal('show')
@@ -1,7 +1,12 @@
<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 '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%>


<table class="table" >
<thead>
@@ -19,4 +19,8 @@
</div>
<div class="col-md-4">
</div>

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

0 comments on commit 694cb3a

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