reverting commit manually

This commit is contained in:
danielvincent 2010-10-22 15:56:19 -07:00
parent 829ad6360a
commit c0423e5e56
3 changed files with 54 additions and 110 deletions

View file

@ -16,7 +16,7 @@
%h3=t('.requests') %h3=t('.requests')
.requests .requests
%ul %ul.dropzone
- if @remote_requests.size < 1 - if @remote_requests.size < 1
%li No new requests %li No new requests
- else - else
@ -44,23 +44,20 @@
%span.tip click to edit %span.tip click to edit
%ul.tools %ul.tools
%li= link_to t('.add_a_new_friend'), "#add_request_pane_#{aspect.id}", :class => 'add_request_button'
%li!= remove_link(aspect) %li!= remove_link(aspect)
%ul.dropzone{:data=>{:aspect_id=>aspect.id}}
%ul.people{:data=>{:aspect_id=>aspect.id}}
-for person in aspect.people -for person in aspect.people
%li.person{:data=>{:guid=>person.id, :aspect_id=>aspect.id}} %li.person{:data=>{:guid=>person.id, :aspect_id=>aspect.id}}
.delete .delete
.x .x
= link_to "X", "#remove_person_pane", :class => "remove_person_button" X
.circle .circle
= person_image_tag(person) = person_image_tag(person)
.draggable_info
Drag to add people
%li.dropzone_targets
%span.dropzone.add_person
= link_to "Add person", "#add_request_pane_#{aspect.id}", :class => 'add_request_button'
%span.dropzone.move_person
= link_to "Move person", '#'
.fancybox_content .fancybox_content
@ -68,11 +65,3 @@
= render "requests/new_request", :aspect => aspect = render "requests/new_request", :aspect => aspect
.fancybox_content
#remove_person_pane
.span-12.last
.modal_title_bar
%h4 Remove from aspect
.person

View file

@ -21,62 +21,49 @@ function decrementRequestsCounter() {
// Dragging person between aspects // Dragging person between aspects
$(function() { $(function() {
$(".person").draggable({ $("ul .person").draggable({
revert: true, revert: true,
start: function(event,ui){ start: function(event,ui){
$(this).children("img").animate({'height':80, 'width':80, 'opacity':0.8},200); $(this).children("img").animate({'height':80, 'width':80, 'opacity':0.8},200);
$(".dropzone").fadeIn(100); $(".draggable_info").fadeIn(100);
}, },
stop: function(event,ui){ stop: function(event,ui){
$(this).children("img").animate({'height':70, 'width':70, 'opacity':1},200); $(this).children("img").animate({'height':70, 'width':70, 'opacity':1},200);
$(".draggable_info").fadeOut(100);
} }
}); });
$(".dropzone", ".aspect").droppable({ $(".aspect ul.dropzone").droppable({
hoverClass: 'active', hoverClass: 'active',
drop: function(event, ui) { drop: function(event, ui) {
var dropzone = $(this); var dropzone = $(this);
var person = ui.draggable; var person = ui.draggable;
var aspect = dropzone.closest(".aspect");
if( person.hasClass('request') ){ if( person.hasClass('request') ){
$.ajax({ $.ajax({
type: "DELETE", type: "DELETE",
url: "/requests/" + person.attr('data-guid'), url: "/requests/" + person.attr('data-guid'),
data: {"accept" : true, "aspect_id" : aspect.attr('data-guid') }, data: {"accept" : true, "aspect_id" : dropzone.attr('data-aspect_id') },
success: function(data){ success: function(data){
decrementRequestsCounter(); decrementRequestsCounter();
} }
}); });
}; };
if( aspect.attr('data-guid') != person.attr('data-aspect_id' )){
if( dropzone.hasClass("move_person") ){ if( dropzone.attr('data-aspect_id') != person.attr('data-aspect_id' )){
$.ajax({ $.ajax({
url: "/aspects/move_friend/", url: "/aspects/move_friend/",
data: {"friend_id" : person.attr('data-guid'), data: {"friend_id" : person.attr('data-guid'),
"from" : person.attr('data-aspect_id'), "from" : person.attr('data-aspect_id'),
"to" : { "to" : aspect.attr('data-guid') }}, "to" : { "to" : dropzone.attr('data-aspect_id') }},
success: function(data){ success: function(data){
person.attr('data-aspect_id', aspect.attr('data-guid')); person.attr('data-aspect_id', dropzone.attr('data-aspect_id'));
}}); }});
$("ul.people li:last", aspect).before(person);
} else {
$.ajax({
url: "/aspects/add_to_aspect/",
data: {"friend_id" : person.attr('data-guid'),
"aspect_id" : aspect.attr('data-guid') },
success: function(data){
person.attr('data-aspect_id', aspect.attr('data-guid'));
}});
$("ul.people li:last", aspect).before(person);
} }
}
$(this).closest("ul").append(person);
} }
}); });
@ -101,7 +88,7 @@ $(function() {
'aspect_id' : person.attr('data-aspect_id') } 'aspect_id' : person.attr('data-aspect_id') }
}); });
} }
person.fadeOut('slow', function(){person.remove()}); person.fadeOut('slow', $(this).remove());
} }
} }
}); });
@ -111,7 +98,6 @@ $(function() {
// Person deletion // Person deletion
$(".delete").live("click", function() { $(".delete").live("click", function() {
var person = $(this).closest("li.person"); var person = $(this).closest("li.person");
@ -132,19 +118,17 @@ $(".delete").live("click", function() {
} else { } else {
var person_id = $(this).closest("li.person").attr('data-guid'); if( confirm("Remove this person from all aspects?") ){
var person_id = $(this).closest("li.person").attr('data-guid');
$.ajax({
/* type: "DELETE",
$.ajax({ url: "/people/" + person_id,
type: "DELETE", success: function() {
url: "/people/" + person_id, person.fadeOut(200);
success: function() { }
person.fadeOut(200); });
} }
});
*/
} }
}); });

View file

@ -938,71 +938,49 @@ h1.big_text
&:last-child &:last-child
:margin :margin
:right 0 :right 0
ul#aspect_list
:list
:style none
:padding 0
:margin 0
.aspect, .aspect,
.requests, .requests,
.aspect_remove .aspect_remove
:position relative :list
:style none
:color #999 :color #999
:cursor default :cursor default
:text-shadow 0 1px #fff :text-shadow 0 1px #fff
ul.dropzone
:position relative
:min-height 20px
:margin 0
:bottom 25px
.dropzone
:display inline-block
:-webkit-border-radius 10px :-webkit-border-radius 10px
:-moz-border-radius 10px :-moz-border-radius 10px
:border-radius 10px :border-radius 10px
:margin 5px :list
:style none
:padding 15px
:border 2px dashed #ccc :border 2px dashed #ccc
:height 70px
:max-height 70px
:width 70px
:max-width 70px
&.active &.active
:background :background
:color rgba(255,252,127,0.2) :color rgba(255,252,127,0.2)
a .draggable_info
:display block :position absolute
:height 100% :display none
:padding :right 15px
:top 12px :bottom 10px
:text
:align center
:font :font
:style italic
:size 14px :size 14px
:color #aaa
:color #999
&:hover
:color #666
ul
:list
:style none
:min-height 20px
:margin 0
:bottom 25px
:padding 0
li
:display inline-block
.person .person
:display inline-block
:cursor move :cursor move
:z-index 10 :z-index 10
:top 0 :position relative
:padding 0 :padding 0
:margin 5px :margin 5px
@ -1056,15 +1034,8 @@ ul#aspect_list
.x .x
:z-index 2 :z-index 2
:position absolute :position absolute
:padding :top 2px
:top 2px :left 7px
:left 7px
a
:cursor default
:display block
:height 100%
:text-shadow none
:color #eee
&:hover &:hover
:cursor default :cursor default