minor cleanup

This commit is contained in:
Daniel Vincent Grippi 2010-09-11 08:59:25 -07:00
parent c43d61e068
commit 7fefdd3753
4 changed files with 85 additions and 95 deletions

View file

@ -1,41 +1,58 @@
$('#move_friends_link').live( 'click',
function(){
$.post('/groups/move_friends',
{'moves' : $('#group_list').data()},
function(){ $('#group_title').html("Groups edited successfully!");});
$(".person").css('background-color','white');
$('#group_list').removeData();
$(".person").attr('from_group_id', function(){return $(this).parent().attr('id')})
});
$('#move_friends_link').live( 'click', function(){
$.post('/groups/move_friends',
{ 'moves' : $('#group_list').data() },
function(){ $('#group_title').html("Groups edited successfully!");});
$(".person").css('background-color','white');
$('#group_list').removeData();
$(".person").attr('from_group_id', function(){return $(this).parent().attr('id')})
});
$(function() {
$("li .person").draggable({
revert: true
});
$("li .person").draggable({
revert: true
});
$(".group ul").droppable({
drop: function(event, ui) {
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);
$("li .person").draggable({
revert: true
});
$(".group ul").droppable({
drop: function(event, ui) {
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);
}
});
});
$(".group h3").live( 'click', function() {
});
var $this = $(this);
var id = $this.closest("li").children("ul").attr("id");
var link = "/groups/"+ id;
$this.keypress(function(e) {
if (e.which == 13) {
e.preventDefault();
$this.blur();
//save changes
$.ajax({
type: "PUT",
url: link,
data: {"group" : {"name" : $this.text() }}
});
}
//update all other group links
$this.keyup(function(e) {
$("a[href='"+link+"']").text($this.text());
});
});
});

View file

@ -16,7 +16,7 @@ $(document).ready(function(){
});
//buttons//////
$("#add_group_button").fancybox();
$("#add_group_button").fancybox({ 'titleShow' : false });
$("#add_request_button").fancybox({ 'titleShow': false });
$("input[type='submit']").addClass("button");
@ -25,59 +25,31 @@ $(document).ready(function(){
$(this).fadeIn("slow");
});
});//end document ready
$(".group h3").live( 'click', function() {
var $this = $(this);
var id = $this.closest("li").children("ul").attr("id");
var link = "/groups/"+ id;
$this.keypress(function(e) {
if (e.which == 13) {
e.preventDefault();
$this.blur();
//save changes
$.ajax({
type: "PUT",
url: link,
data: {"group" : {"name" : $this.text() }}
});
}
//update all other group links
$this.keyup(function(e) {
$("a[href='"+link+"']").text($this.text());
});
});
});
function pane_toggler_button( name ) {
$("#add_" + name + "_button").toggle(
function(evt){
evt.preventDefault();
$("#add_" + name + "_pane").fadeIn(300);
},function(evt){
evt.preventDefault();
$("#add_" + name +"_pane").fadeOut(200);
$("#global_search").hover(
function() {
$(this).fadeTo('fast', '1');
},
function() {
$(this).fadeTo('fast', '0.5');
}
);
}
});//end document ready
//Called with $(selector).clearForm()
$.fn.clearForm = function() {
return this.each(function() {
var type = this.type, tag = this.tagName.toLowerCase();
if (tag == 'form')
return $(':input',this).clearForm();
if (type == 'text' || type == 'password' || tag == 'textarea')
this.value = '';
//else if (type == 'checkbox' || type == 'radio')
//this.checked = false;
else if (tag == 'select')
this.selectedIndex = -1;
$(this).blur();
});
};
$.fn.clearForm = function() {
return this.each(function() {
var type = this.type, tag = this.tagName.toLowerCase();
if (tag == 'form')
return $(':input',this).clearForm();
if (type == 'text' || type == 'password' || tag == 'textarea')
this.value = '';
//else if (type == 'checkbox' || type == 'radio')
//this.checked = false;
else if (tag == 'select')
this.selectedIndex = -1;
$(this).blur();
});
};

View file

@ -78,6 +78,7 @@ header {
color: black;
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#333333), to(black));
padding: 0;
padding-top: 5px;
border-bottom: 1px solid #cccccc; }
header #diaspora_text {
z-index: 6;
@ -85,8 +86,7 @@ header {
font-family: "BrandonGrotesqueLightRegular";
font-size: 16px;
border: none;
color: white;
top: 3px; }
color: white; }
header #diaspora_text a {
color: #999999; }
header #diaspora_text a:hover {
@ -458,7 +458,7 @@ h1.big_text {
#group_nav {
position: relative;
color: black;
margin-top: 7px;
margin-top: 8px;
margin-bottom: 1px; }
#group_nav #group_manage_button {
display: inline; }
@ -562,6 +562,7 @@ h1.big_text {
#global_search {
display: inline;
position: relative;
opacity: 0.5;
padding-right: 167px; }
#global_search form {
display: inline; }

View file

@ -83,6 +83,7 @@ header
:color #000
:background -webkit-gradient(linear, 0% 0%, 0% 100%, from(#333333), to(#000000))
:padding 0
:top 5px
:border
:bottom 1px solid #ccc
@ -94,7 +95,6 @@ header
:size 16px
:border none
:color #fff
:top 3px
a
:color #999
@ -585,7 +585,7 @@ h1.big_text
:position relative
:color #000
:margin
:top 7px
:top 8px
:bottom 1px
@ -733,6 +733,7 @@ h1.big_text
#global_search
:display inline
:position relative
:opacity 0.5
:padding
:right 167px
@ -824,4 +825,3 @@ h1.big_text
:style italic
:color #666