From 7fefdd3753d54a0201ee674afc34be75546f6c0e Mon Sep 17 00:00:00 2001 From: Daniel Vincent Grippi Date: Sat, 11 Sep 2010 08:59:25 -0700 Subject: [PATCH] minor cleanup --- public/javascripts/group-edit.js | 89 ++++++++++++++---------- public/javascripts/view.js | 78 +++++++-------------- public/stylesheets/application.css | 7 +- public/stylesheets/sass/application.sass | 6 +- 4 files changed, 85 insertions(+), 95 deletions(-) diff --git a/public/javascripts/group-edit.js b/public/javascripts/group-edit.js index 5c136ebff..e24ff9a47 100644 --- a/public/javascripts/group-edit.js +++ b/public/javascripts/group-edit.js @@ -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()); + }); + }); +}); diff --git a/public/javascripts/view.js b/public/javascripts/view.js index 8b4c44134..9881c9c57 100644 --- a/public/javascripts/view.js +++ b/public/javascripts/view.js @@ -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(); + }); +}; + diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index ad271dfda..0918b614e 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -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; } diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index 87bff2526..b851028ae 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -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 -