diff --git a/app/assets/javascripts/orbitdesktop.js b/app/assets/javascripts/orbitdesktop.js index 586cf728c..e5f3c3fba 100755 --- a/app/assets/javascripts/orbitdesktop.js +++ b/app/assets/javascripts/orbitdesktop.js @@ -108,8 +108,8 @@ var orbitDesktop = function(dom){ this.contentHolder = dom; this.themesettings = ""; this.theme = "4f8d3f493b67fcd05f086359"; - this.transitionTime = 1000; - this.currenthtml = "desktop.html"; + this.transitionTime = 500; + this.currenthtml = "home"; this.currentface = "home"; this.desktopData = {}; this.tp = ""; @@ -313,8 +313,8 @@ var orbitDesktop = function(dom){ }) $(window).resize(function(){ - // var ww = $(window).width(); - // $("img#thmbackground").attr({"width":ww}); + var ww = $(window).width(); + $("img#thmbackground").attr({"width":ww}); if( $('.tinycanvas').length > 0 ){ $('.tinycanvas').tinyscrollbar_update('relative'); } if($(o.contentHolder).find("div.app_frame").length > 0){ $(o.contentHolder).find("div.app_frame").each(function(){ @@ -378,8 +378,8 @@ var orbitDesktop = function(dom){ }; this.layout_data = function(h){ - var $e; - var column_container,layout, base_width, total_width, gutter, no_of_entries = 0, pagination_link, pagination_variable; + var $e; + var column_container,layout, base_width , no_of_entries = 0, pagination_link , pagination_variable, gutter, total_width; o.paging = true; gutter = (!isNaN(gutter)) ? gutter : 12; this.layout_data.generate_layout_html = function(l){ @@ -393,6 +393,7 @@ var orbitDesktop = function(dom){ case "simple": total_columns++; temp_div.append(column_container.html()); + total_width = "auto"; break; case "datalist": no_of_entries = (typeof column_container.attr("per-column") != "undefined"? parseInt(column_container.attr("per-column")) : 4); @@ -411,7 +412,10 @@ var orbitDesktop = function(dom){ x = 0; temp_div.append(column); } - }); + }) + if(x != 0){ + temp_div.append(column); + } } total_width = (!isNaN(base_width)) ? (base_width + gutter*2 +1) * total_columns : null; break; @@ -419,17 +423,16 @@ var orbitDesktop = function(dom){ entries = column_container.find("div[column=true]"),x = 0,column; if(entries.length!=0){ entries.each(function(i,ul){ - column = $("
"); } - $("#content > #holder").hide("drop",{ easing: "easeInOutQuint" },o.transitionTime,function(){ + $("#content").hide("drop",o.transitionTime,function(){ o.currenthtml = target; o.currentface = target; var cache = false; if(!o.desktopData[o.currentface]){ $(o.contentHolder).empty().load(url,function(data){ if(typeof o.data_method != "undefined"){ - if(o.data_method != ""){ + if(o.data_method != "") window.o[o.data_method](target,url,cache); - } } try{ if(!customload) @@ -566,8 +568,8 @@ var orbitDesktop = function(dom){ o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[load=true]"),data); } }catch(EX){} - header_ani(); - }); + + }) }else{ $(o.contentHolder).html(o.desktopData[o.currentface]); try{ @@ -582,26 +584,11 @@ var orbitDesktop = function(dom){ }catch(EX){} cache = true; if(typeof o.data_method != "undefined"){ - if(o.data_method != ""){ - window.o[o.data_method](target,url,cache); - } + if(o.data_method != "") + window.o[o.data_method](target,url,cache); } - header_ani(); } }); - $('#header') - .delay(600) - .effect('drop',{ - easing: 'easeInOutQuint', - direction: 'down' - },300); - } - - var header_ani = function(){ - $('#header').hide().toggle('drop',{easing: 'easeInOutQuint', direction:'down'}); - $('#header > *').each(function(i){ - $(this).hide().delay(i*100).fadeIn(400,'easeInOutQuint'); - }); } } this.sub_menu_item = function(dom,data){ @@ -645,7 +632,7 @@ var orbitDesktop = function(dom){ } this.initializeDesktop = function(target,url,cache){ //this is for initializing main desktops that are sections and tiles - if(!target)target = "desktop"; + if(!target)target = "home"; var bindHandlers = function(){ // this function will bind all the handlers in the desktop // var groupWrapperWidth = 0; // $("div#desktop .group").each(function(){groupWrapperWidth+=$(this).outerWidth(true);}); @@ -732,7 +719,8 @@ var orbitDesktop = function(dom){ .gridster({ widget_margins: [6, 6], widget_base_dimensions: [120, 120], - // avoid_overlapped_widgets: true, + // avoid_overlapped_widgets: true, + serialize_params: function($w, wgd) { return { col: wgd.col, row: wgd.row, id: $w.data("id") } }, draggable : { start : function(event, ui){ dragged.addClass("noClick"); @@ -785,6 +773,9 @@ var orbitDesktop = function(dom){ }) } + var newpos = o.gridvar.serialize(); + console.log(newpos); + $.post("/desktop/newpositions",{"newpositions":newpos}); } } }).data('gridster'); @@ -829,24 +820,45 @@ var orbitDesktop = function(dom){ // }); } var loadTiles = function(id){ //This will load tiles for a specific desktop .. id of section has to be passed here to load tiles - $("#desktop #group_wrapper").empty(); + $("div#desktop div#group_wrapper").empty(); $.getJSON("/desktop/getgroups",{sectionid:id},function(tiles){ - tiles.sort(o.sortJSON("position",true,parseInt)); + // tiles.sort(o.sortJSON("position",true,parseInt)); var tilecolors = o.themesettings.tilecolor; var totaltiles_in_a_row = 4; var opacity = ["op07","op08","op09",""]; - var row = 1,col = 1,x = 1,y = 1; + var row = 0,col = 1,x = 1,y = 1,total_x = 0,prev_y = 0; var $group = $(''); var $ul = $('