From 1f077cf2b3e286acea8bdf173b8fd98f4268e287 Mon Sep 17 00:00:00 2001 From: devin Date: Fri, 20 Apr 2012 07:31:48 +0800 Subject: [PATCH] javascript update --- app/assets/javascripts/orbitdesktop.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/app/assets/javascripts/orbitdesktop.js b/app/assets/javascripts/orbitdesktop.js index 0be3ba55..bbf2a5f8 100755 --- a/app/assets/javascripts/orbitdesktop.js +++ b/app/assets/javascripts/orbitdesktop.js @@ -371,15 +371,18 @@ var orbitDesktop = function(dom){ }); $("div#sections .section_label li:not(:nth-child(1))").droppable({ drop:function(event, ui){ - element = ui.draggable; - elementParent = ui.draggable.parent(); - if($("#"+$(this).data("category")+" .element").length>=24){ + elementParent = ui.draggable.parents('.group'); + var $item = $( this ), + $list = $( '#'+$item.data("category") ); + + if($list.children('.element').length>=24){ o.notify("Section is full.","alert"); } else{ - element.appendTo('body'); - // .appendTo("#"+$(this).data("category")); - $.post("/desktop/save_desktop_settings",{"save":"appnewsection","appid":element.attr("id"),"newsectionid":$(this).data("content"),"desktopid":o.desktopId}) + ui.draggable.hide('fast',function(){ + $(this).appendTo($list).fadeIn(); + }); + $.post("/desktop/save_desktop_settings",{"save":"appnewsection","appid":ui.draggable.attr("id"),"newsectionid":$(this).data("content"),"desktopid":o.desktopId}); if(o.sectionId == $(this).data("content") || o.sectionId == elementParent.attr("id")){ o.desktopData["home"]=""; } @@ -390,7 +393,8 @@ var orbitDesktop = function(dom){ }, out:function(){ $(this).find('span.tile').addClass('op06'); - } + }, + accept: '.to_drop' }); $('.tinycanvas') .tinyscrollbar({ axis: 'x'})