Permalink
Browse files

Add delete input

  • Loading branch information...
rociopaez committed Sep 27, 2014
1 parent 7f53278 commit 23bec20f89d6964fd1f7e3c10fe309e59ef87d46
Showing with 33 additions and 22 deletions.
  1. +6 −0 routes/inputs.rb
  2. +27 −22 views/inputs/index.mote
@@ -18,6 +18,12 @@ class Inputs < Cuba
on get do
render("inputs/edit", title: "Edit Input", input: input, user: current_user, types: current_user.types)
end

on "delete", post do
input.delete

res.redirect("/inputs")
end
end

on post, param("input") do |params|
@@ -1,28 +1,33 @@
% inputs = params[:inputs]

<h2><a href="/inputs/new">New Input</a></h2>
<div class="forms">
<h2><a href="/inputs/new">New Input</a></h2>

<h2>Your Input Types record</h2>
<table>
<thead>
<tr>
<th>Date</th>
<th>Category</th>
<th>Name</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
% inputs.each do |input|
<h2>Your Input Types record</h2>
<table>
<thead>
<tr>
<td>{{input.date}}</td>
<td>{{input.type.category}}</td>
<td>{{input.type.name}}</td>
<td><a href="/inputs/{{input.id}}">Edit</a></td>
<th>Date</th>
<th>Category</th>
<th>Name</th>
<th>Actions</th>
</tr>
% end
</tbody>
</table>
</thead>
<tbody>
% inputs.each do |input|
<tr>
<td>{{input.date}}</td>
<td>{{input.type.category}}</td>
<td>{{input.type.name}}</td>
<td class="action">
<a href="/inputs/{{input.id}}">Edit</a>
<form action="/inputs/{{input.id}}/delete" method="POST">
<input type="submit" value="delete">
</form>
</td>
</tr>
% end
</tbody>
</table>


<!-- <td class="action"><a href="/types/edit">Edit</a> - <a href="###">Delete</a></td> -->
</div>

0 comments on commit 23bec20

Please sign in to comment.