forked from OpenNeo/impress
delete outfits from outfit page
This commit is contained in:
parent
1caa296359
commit
d0dd797cdf
7 changed files with 86 additions and 13 deletions
|
@ -27,9 +27,21 @@ class OutfitsController < ApplicationController
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
if @outfit.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
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -6,11 +6,22 @@ body.outfits-index
|
||||||
|
|
||||||
li
|
li
|
||||||
+outfit-star
|
+outfit-star
|
||||||
|
clear: left
|
||||||
|
float: left
|
||||||
|
margin-bottom: .5em
|
||||||
|
|
||||||
h4
|
h4
|
||||||
display: inline
|
float: left
|
||||||
|
width: 12em
|
||||||
|
|
||||||
.outfit-edit-link
|
.outfit-edit-link, form
|
||||||
|
float: left
|
||||||
font-size: 85%
|
font-size: 85%
|
||||||
margin-left: 1em
|
margin-left: 1em
|
||||||
|
|
||||||
|
.outfit-edit-link
|
||||||
|
+awesome-button
|
||||||
|
|
||||||
|
.outfit-delete-button
|
||||||
|
margin: 0
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
= outfit_li_for(outfit) do
|
= outfit_li_for(outfit) do
|
||||||
.outfit-star
|
.outfit-star
|
||||||
%h4= link_to outfit.name, outfit
|
%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}?")
|
||||||
|
|
||||||
|
|
|
@ -18,3 +18,7 @@
|
||||||
%p
|
%p
|
||||||
It'll be fantastic. Promise.
|
It'll be fantastic. Promise.
|
||||||
|
|
||||||
|
- content_for :javascripts do
|
||||||
|
= include_javascript_libraries :jquery
|
||||||
|
= javascript_include_tag 'outfits/index'
|
||||||
|
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
// Place your application-specific JavaScript functions and classes here
|
|
||||||
// This file is automatically included by javascript_include_tag :defaults
|
|
4
public/javascripts/outfits/index.js
Normal file
4
public/javascripts/outfits/index.js
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
$('form.button_to input[type=submit]').click(function (e) {
|
||||||
|
if(!confirm(this.getAttribute('data-confirm'))) e.preventDefault();
|
||||||
|
});
|
||||||
|
|
|
@ -1409,7 +1409,7 @@ body.outfits-edit .object:hover ul, body.outfits-edit .object:hover .object-info
|
||||||
}
|
}
|
||||||
/* line 415, ../../../app/stylesheets/outfits/_edit.sass */
|
/* line 415, ../../../app/stylesheets/outfits/_edit.sass */
|
||||||
body.outfits-edit .nc-icon {
|
body.outfits-edit .nc-icon {
|
||||||
background: url('/images/nc.png?1296599919') no-repeat;
|
background: url('/images/nc.png?1310662236') no-repeat;
|
||||||
height: 16px;
|
height: 16px;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 16px;
|
right: 16px;
|
||||||
|
@ -2168,6 +2168,12 @@ body.outfits-edit #save-outfit-wrapper.shared-outfit #current-outfit-permalink {
|
||||||
body.outfits-index #outfits {
|
body.outfits-index #outfits {
|
||||||
list-style: none;
|
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 */
|
/* line 4, ../../../app/stylesheets/outfits/_star.sass */
|
||||||
body.outfits-index #outfits li .outfit-star {
|
body.outfits-index #outfits li .outfit-star {
|
||||||
bottom: -2px;
|
bottom: -2px;
|
||||||
|
@ -2194,15 +2200,52 @@ body.outfits-index #outfits li.loading .outfit-star {
|
||||||
body.outfits-index #outfits li.loading.active .outfit-star {
|
body.outfits-index #outfits li.loading.active .outfit-star {
|
||||||
background-image: url('/images/loading_current_outfit.gif?1296599919');
|
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 */
|
/* 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%;
|
font-size: 85%;
|
||||||
margin-left: 1em;
|
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 */
|
/* line 2, ../../../app/stylesheets/partials/_campaign-progress.sass */
|
||||||
body.outfits-new .campaign-progress-wrapper {
|
body.outfits-new .campaign-progress-wrapper {
|
||||||
|
|
Loading…
Reference in a new issue