Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add destroy link

  • Loading branch information...
commit 81b2b1687af876563f1ae473ae90e57f20d4030a 1 parent ad88bc3
@garethrees authored
View
8 app/assets/stylesheets/jists.css.scss
@@ -74,6 +74,14 @@
}
}
}
+
+ .actions {
+ .destroy {
+ float: right;
+ font-size: 13px;
+ }
+ }
+
}
.jists.index {
View
5 app/controllers/jists_controller.rb
@@ -43,5 +43,10 @@ def update
def destroy
@jist = Jist.find(params[:id])
+ @jist.destroy
+
+ respond_to do |format|
+ format.html { redirect_to(root_path, :notice => 'Jist was successfully deleted.') }
+ end
end
end
View
4 app/views/jists/show.html.erb
@@ -19,6 +19,10 @@
<% end %>
</section>
+ <section class="actions">
+ <%= link_to "Delete this Jist", jist_path(@jist), method: :delete, confirm: 'Are you sure? This Jist will be permanently deleted.', class: 'destroy' %>
+ </section>
+
</article>
<% content_for :secondary do -%>
Please sign in to comment.
Something went wrong with that request. Please try again.