Permalink
Browse files

Move template: types/edit => types

  • Loading branch information...
rociopaez committed Sep 9, 2014
1 parent 4e08dc4 commit 67a1d76e93efb7e6259ea62e5d43411fbd8c491b
Showing with 18 additions and 3 deletions.
  1. +13 −1 routes/types.rb
  2. +2 −1 views/layout.mote
  3. +3 −1 views/{types/edit.mote → types.mote}
@@ -4,6 +4,10 @@ class Types < Cuba
render("types/new", title: "New Type")
end
on("edit") do
render("types/edit", title: "Edit Type")
end
on post, param("type") do |params|
create_type = CreateType.new(params)
if create_type.valid?
@@ -12,8 +16,16 @@ class Types < Cuba
end
end
on("types/new") do
on post, params("type") do |params|
create_type = CreateType.new(params)
Type.create(category: type_attributes["category"], name: type_attributes["name"], user_id: user.id)
end
end
on default do
render("types/edit", title: "Edit Types", user: current_user)
render("types", title: "Types", user: current_user)
end
end
end
@@ -13,10 +13,11 @@
<h1><a href="/dashboard">migraine.io</a></h1>
<nav>
<ul>
<li><a href="/dashboard">Dashboard</a></a></li>
<li><a href="/inputs">Inputs</a></a></li>
<li><a href="/outputs">Outputs</a></a></li>
<li><a href="/types">Types</a></a></li>
<li><a href="/profile">Profile</a></a></li>
<li><a href="/types/edit">Edit Types</a></a></li>
<li><a href="/sign_out">Sign Out</a></a></li>
</ul>
</nav>
@@ -1,3 +1,5 @@
% user = params.fetch(:user)
<div class="profile_set">
<h2>Input Types</h2>
@@ -16,7 +18,7 @@
<tr>
<td>{{type.category}}</td>
<td>{{type.name}}</td>
<td class="action"><a href="###">Edit</a> - <a href="###">Delete</a></td>
<td class="action"><a href="/types/edit">Edit</a> - <a href="###">Delete</a></td>
</tr>
% end
</tbody>

0 comments on commit 67a1d76

Please sign in to comment.