now requests are called requested people, same css but less hacky selection
This commit is contained in:
parent
2800f9351c
commit
0896efa5d6
4 changed files with 55 additions and 34 deletions
|
|
@ -9,7 +9,7 @@
|
|||
%li.requests
|
||||
%ul
|
||||
- for request in @remote_requests
|
||||
%li.person{:id => request.person.id, :request_id => request.id}
|
||||
%li.requested_person{:id => request.person.id, :request_id => request.id}
|
||||
= image_tag(request.person.profile.image_url(:thumb_small)) unless request.person.profile.image_url.nil?
|
||||
.name
|
||||
= request.person.real_name
|
||||
|
|
|
|||
|
|
@ -14,44 +14,55 @@ $(function() {
|
|||
revert: true
|
||||
});
|
||||
|
||||
|
||||
$("li .requested_person").draggable({
|
||||
revert: true
|
||||
});
|
||||
$(".group ul").droppable({
|
||||
drop: function(event, ui) {
|
||||
if (ui.draggable[0].getAttribute('request_id') != null){
|
||||
$.ajax({
|
||||
type: "DELETE",
|
||||
url: "/requests/" + ui.draggable[0].getAttribute('request_id') ,
|
||||
data: {"accept" : true , "group_id" : $(this)[0].id }
|
||||
});
|
||||
alert("Sent the ajax, check it out!")
|
||||
}
|
||||
var move = {};
|
||||
move[ 'friend_id' ] = ui.draggable[0].id
|
||||
move[ 'to' ] = $(this)[0].id;
|
||||
move[ 'from' ] = ui.draggable[0].getAttribute('from_group_id');
|
||||
if (move['to'] == move['from']){
|
||||
$('#group_list').data( ui.draggable[0].id, []);
|
||||
ui.draggable.css('background-color','white');
|
||||
} else {
|
||||
$('#group_list').data( ui.draggable[0].id, move);
|
||||
ui.draggable.css('background-color','orange');
|
||||
}
|
||||
$(this).closest("ul").append(ui.draggable);
|
||||
|
||||
if ($(ui.draggable[0]).hasClass('requested_person')){
|
||||
$.ajax({
|
||||
type: "DELETE",
|
||||
url: "/requests/" + ui.draggable[0].getAttribute('request_id') ,
|
||||
data: {"accept" : true , "group_id" : $(this)[0].id }
|
||||
});
|
||||
alert("Sent the ajax, check it out!")
|
||||
}else {
|
||||
var move = {};
|
||||
move[ 'friend_id' ] = ui.draggable[0].id
|
||||
move[ 'to' ] = $(this)[0].id;
|
||||
move[ 'from' ] = ui.draggable[0].getAttribute('from_group_id');
|
||||
if (move['to'] == move['from']){
|
||||
$('#group_list').data( ui.draggable[0].id, []);
|
||||
ui.draggable.css('background-color','white');
|
||||
} else {
|
||||
$('#group_list').data( ui.draggable[0].id, move);
|
||||
ui.draggable.css('background-color','orange');
|
||||
}
|
||||
$(this).closest("ul").append(ui.draggable);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$(".remove ul").droppable({
|
||||
drop: function(event, ui) {
|
||||
if (ui.draggable[0].getAttribute('request_id') != null){
|
||||
$.ajax({
|
||||
type: "DELETE",
|
||||
url: "/requests/" + ui.draggable[0].getAttribute('request_id')
|
||||
});
|
||||
alert("Removed Request, proably want an undo countdown.")
|
||||
$(ui.draggable[0]).fadeOut('slow')
|
||||
|
||||
if ($(ui.draggable[0]).hasClass('requested_person')){
|
||||
$.ajax({
|
||||
type: "DELETE",
|
||||
url: "/requests/" + ui.draggable[0].getAttribute('request_id')
|
||||
});
|
||||
alert("Removed Request, proably want an undo countdown.")
|
||||
$(ui.draggable[0]).fadeOut('slow')
|
||||
}else{
|
||||
$.ajax({
|
||||
type: "DELETE",
|
||||
url: "/people/" + ui.draggable[0].id)
|
||||
});
|
||||
alert("Removed Friend, proably want an undo countdown.")
|
||||
$(ui.draggable[0]).fadeOut('slow')
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -609,8 +609,11 @@ h1.big_text {
|
|||
list-style: none;
|
||||
padding: 15px; }
|
||||
.group .person,
|
||||
.group .requested_person,
|
||||
.requests .person,
|
||||
.remove .person {
|
||||
.requests .requested_person,
|
||||
.remove .person,
|
||||
.remove .requested_person {
|
||||
display: inline-block;
|
||||
margin-left: 0;
|
||||
padding: 5px;
|
||||
|
|
@ -624,14 +627,20 @@ h1.big_text {
|
|||
padding: 5px;
|
||||
border: 1px solid #999999; }
|
||||
.group .person img,
|
||||
.group .requested_person img,
|
||||
.requests .person img,
|
||||
.remove .person img {
|
||||
.requests .requested_person img,
|
||||
.remove .person img,
|
||||
.remove .requested_person img {
|
||||
height: 50px;
|
||||
width: 50px;
|
||||
display: inline-block; }
|
||||
.group .person .grey,
|
||||
.group .requested_person .grey,
|
||||
.requests .person .grey,
|
||||
.remove .person .grey {
|
||||
.requests .requested_person .grey,
|
||||
.remove .person .grey,
|
||||
.remove .requested_person .grey {
|
||||
font-style: italic;
|
||||
color: #666666; }
|
||||
|
||||
|
|
|
|||
|
|
@ -794,7 +794,8 @@ h1.big_text
|
|||
:style none
|
||||
:padding 15px
|
||||
|
||||
.person
|
||||
.person,
|
||||
.requested_person
|
||||
:display inline-block
|
||||
:margin
|
||||
:left 0
|
||||
|
|
|
|||
Loading…
Reference in a new issue