From 35e4cf64afd14a12e432d9444decece3b20381e8 Mon Sep 17 00:00:00 2001 From: Ali Asaria Date: Thu, 23 Jun 2011 09:29:40 -0400 Subject: [PATCH] Hovering away no longer stops editing of editables fixes #21 --- client/css/style.css | 4 +++- .../development-bundle/ui/jquery-ui-1.8.9.custom.js | 3 ++- .../development-bundle/ui/jquery.ui.mouse.js | 2 +- client/lib/jquery.jeditable.js | 10 +++++----- client/script.js | 11 +++++++++++ views/layout.jade | 4 +++- 6 files changed, 25 insertions(+), 9 deletions(-) diff --git a/client/css/style.css b/client/css/style.css index 10a6cb3..e06951a 100644 --- a/client/css/style.css +++ b/client/css/style.css @@ -81,7 +81,7 @@ width: 16px; height: 16px; } .card-edit-form, .card-edit-form input, .card-edit-form textarea { - border:none; + border: none; font-size:inherit; font-weight:inherit; background-color:inherit; @@ -95,6 +95,8 @@ width: 16px; height: 16px; overflow: hidden; resize: none; width: 100%; + color: #330066; + color: #666; } diff --git a/client/lib/jquery-ui/development-bundle/ui/jquery-ui-1.8.9.custom.js b/client/lib/jquery-ui/development-bundle/ui/jquery-ui-1.8.9.custom.js index f3c2079..36f7d55 100755 --- a/client/lib/jquery-ui/development-bundle/ui/jquery-ui-1.8.9.custom.js +++ b/client/lib/jquery-ui/development-bundle/ui/jquery-ui-1.8.9.custom.js @@ -656,7 +656,8 @@ $.widget("ui.mouse", { .bind('mousemove.'+this.widgetName, this._mouseMoveDelegate) .bind('mouseup.'+this.widgetName, this._mouseUpDelegate); - event.preventDefault(); + //ali: fixing this http://bugs.jqueryui.com/ticket/4261 + //event.preventDefault(); event.originalEvent.mouseHandled = true; return true; }, diff --git a/client/lib/jquery-ui/development-bundle/ui/jquery.ui.mouse.js b/client/lib/jquery-ui/development-bundle/ui/jquery.ui.mouse.js index d63fdd7..0875542 100755 --- a/client/lib/jquery-ui/development-bundle/ui/jquery.ui.mouse.js +++ b/client/lib/jquery-ui/development-bundle/ui/jquery.ui.mouse.js @@ -86,7 +86,7 @@ $.widget("ui.mouse", { .bind('mousemove.'+this.widgetName, this._mouseMoveDelegate) .bind('mouseup.'+this.widgetName, this._mouseUpDelegate); - event.preventDefault(); + //event.preventDefault(); event.originalEvent.mouseHandled = true; return true; }, diff --git a/client/lib/jquery.jeditable.js b/client/lib/jquery.jeditable.js index 2fe9537..ba08640 100644 --- a/client/lib/jquery.jeditable.js +++ b/client/lib/jquery.jeditable.js @@ -285,16 +285,16 @@ } else if ('submit' == settings.onblur) { input.blur(function(e) { /* prevent double submit if submit was clicked */ - //t = setTimeout(function() { + t = setTimeout(function() { form.submit(); - //}, 200); + }, 200); }); //ali here: i hacked this in so that submit happens on mouseout too - input.mouseout(function(e) { + input.blur(function(e) { /* prevent double submit if submit was clicked */ - //t = setTimeout(function() { + t = setTimeout(function() { form.submit(); - //}, 200); + }, 200); }); } else if ($.isFunction(settings.onblur)) { input.blur(function(e) { diff --git a/client/script.js b/client/script.js index 04eeee8..e7d5f9b 100644 --- a/client/script.js +++ b/client/script.js @@ -171,6 +171,17 @@ function drawNewCard(id, text, x, y, rot, colour, sticker, animationspeed) var card = $(h); card.appendTo('#board'); + //@TODO + //Draggable has a bug which prevents blur event + //http://bugs.jqueryui.com/ticket/4261 + //So we have to blur all the cards and editable areas when + //we click on a card + //The following doesn't work so we will do the bug + //fix recommended in the above bug report + // card.click( function() { + // $(this).focus(); + // } ); + card.draggable( { snap: false, diff --git a/views/layout.jade b/views/layout.jade index ea35043..d847822 100644 --- a/views/layout.jade +++ b/views/layout.jade @@ -6,7 +6,9 @@ html(lang="en") - + + +