diff --git a/app/controllers/outfits_controller.rb b/app/controllers/outfits_controller.rb index dabcb643..4b69a0cb 100644 --- a/app/controllers/outfits_controller.rb +++ b/app/controllers/outfits_controller.rb @@ -27,9 +27,21 @@ class OutfitsController < ApplicationController def destroy if @outfit.destroy - render :json => true + respond_to do |format| + format.html { + flash[:success] = "Outfit #{@outfit.name} successfully deleted" + redirect_to current_user_outfits_path + } + format.json { render :json => true } + end else - render :json => false, :status => :bad_request + respond_to do |format| + format.html { + flash[:alert] = "Error deleting outfit. Try again?" + redirect_to current_user_outfits_path, :status => :bad_request + } + format.json { render :json => false, :status => :bad_request } + end end end diff --git a/app/stylesheets/outfits/_index.sass b/app/stylesheets/outfits/_index.sass index 05958fa6..fd40a952 100644 --- a/app/stylesheets/outfits/_index.sass +++ b/app/stylesheets/outfits/_index.sass @@ -6,11 +6,22 @@ body.outfits-index li +outfit-star + clear: left + float: left + margin-bottom: .5em h4 - display: inline + float: left + width: 12em - .outfit-edit-link + .outfit-edit-link, form + float: left font-size: 85% margin-left: 1em + .outfit-edit-link + +awesome-button + + .outfit-delete-button + margin: 0 + diff --git a/app/views/outfits/_outfit.html.haml b/app/views/outfits/_outfit.html.haml index c03314db..ebf3c9a0 100644 --- a/app/views/outfits/_outfit.html.haml +++ b/app/views/outfits/_outfit.html.haml @@ -1,5 +1,6 @@ = outfit_li_for(outfit) do .outfit-star %h4= link_to outfit.name, outfit - = link_to_edit_outfit '(edit)', outfit, :class => 'outfit-edit-link' + = link_to_edit_outfit 'Edit', outfit, :class => 'outfit-edit-link' + = button_to('Delete', outfit, :method => 'delete', :class => 'outfit-delete-button', :confirm => "Are you sure you want to delete the outfit #{outfit.name}?") diff --git a/app/views/outfits/index.html.haml b/app/views/outfits/index.html.haml index 0c58feb6..bd5bd07e 100644 --- a/app/views/outfits/index.html.haml +++ b/app/views/outfits/index.html.haml @@ -18,3 +18,7 @@ %p It'll be fantastic. Promise. +- content_for :javascripts do + = include_javascript_libraries :jquery + = javascript_include_tag 'outfits/index' + diff --git a/public/javascripts/application.js b/public/javascripts/application.js index fe457769..e69de29b 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -1,2 +0,0 @@ -// Place your application-specific JavaScript functions and classes here -// This file is automatically included by javascript_include_tag :defaults diff --git a/public/javascripts/outfits/index.js b/public/javascripts/outfits/index.js new file mode 100644 index 00000000..6351a3bc --- /dev/null +++ b/public/javascripts/outfits/index.js @@ -0,0 +1,4 @@ +$('form.button_to input[type=submit]').click(function (e) { + if(!confirm(this.getAttribute('data-confirm'))) e.preventDefault(); +}); + diff --git a/public/stylesheets/compiled/screen.css b/public/stylesheets/compiled/screen.css index 9a2d3fcd..c3504025 100644 --- a/public/stylesheets/compiled/screen.css +++ b/public/stylesheets/compiled/screen.css @@ -1409,7 +1409,7 @@ body.outfits-edit .object:hover ul, body.outfits-edit .object:hover .object-info } /* line 415, ../../../app/stylesheets/outfits/_edit.sass */ body.outfits-edit .nc-icon { - background: url('/images/nc.png?1296599919') no-repeat; + background: url('/images/nc.png?1310662236') no-repeat; height: 16px; position: absolute; right: 16px; @@ -2168,6 +2168,12 @@ body.outfits-edit #save-outfit-wrapper.shared-outfit #current-outfit-permalink { body.outfits-index #outfits { list-style: none; } +/* line 7, ../../../app/stylesheets/outfits/_index.sass */ +body.outfits-index #outfits li { + clear: left; + float: left; + margin-bottom: 0.5em; +} /* line 4, ../../../app/stylesheets/outfits/_star.sass */ body.outfits-index #outfits li .outfit-star { bottom: -2px; @@ -2194,15 +2200,52 @@ body.outfits-index #outfits li.loading .outfit-star { body.outfits-index #outfits li.loading.active .outfit-star { background-image: url('/images/loading_current_outfit.gif?1296599919'); } -/* line 10, ../../../app/stylesheets/outfits/_index.sass */ -body.outfits-index #outfits h4 { - display: inline; -} /* line 13, ../../../app/stylesheets/outfits/_index.sass */ -body.outfits-index #outfits .outfit-edit-link { +body.outfits-index #outfits h4 { + float: left; + width: 12em; +} +/* line 17, ../../../app/stylesheets/outfits/_index.sass */ +body.outfits-index #outfits .outfit-edit-link, body.outfits-index #outfits form { + float: left; font-size: 85%; margin-left: 1em; } +/* line 22, ../../../app/stylesheets/outfits/_index.sass */ +body.outfits-index #outfits .outfit-edit-link { + /* http://www.zurb.com/blog_uploads/0000/0617/buttons-03.html */ + -moz-border-radius: 5px; + -webkit-border-radius: 5px; + background: #006400 url('/images/alert-overlay.png?1296599919') repeat-x; + border: 0; + display: inline-block; + padding: 0.5em 0.75em 0.45em; + color: white; + text-decoration: none; + -moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5); + -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5); + text-shadow: 0 -1px 1px rgba(0, 0, 0, 0.25); + border-bottom: 1px solid rgba(0, 0, 0, 0.25); + position: relative; + font-weight: bold; + line-height: 1; +} +/* line 34, ../../../app/stylesheets/partials/clean/_mixins.sass */ +body.outfits-index #outfits .outfit-edit-link:hover { + background-color: #005300; +} +/* line 53, ../../../app/stylesheets/partials/clean/_mixins.sass */ +body.outfits-index #outfits .outfit-edit-link:hover { + color: white; +} +/* line 55, ../../../app/stylesheets/partials/clean/_mixins.sass */ +body.outfits-index #outfits .outfit-edit-link:active { + top: 1px; +} +/* line 25, ../../../app/stylesheets/outfits/_index.sass */ +body.outfits-index #outfits .outfit-delete-button { + margin: 0; +} /* line 2, ../../../app/stylesheets/partials/_campaign-progress.sass */ body.outfits-new .campaign-progress-wrapper {