widget and gridster fixes
This commit is contained in:
1 parent
0781779ac0
commit
bc0477a5ed
5 files changed
+87
-60
No files matched your search
@@ -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 = $("<div class='column type_column' style='width:"+base_width+"px;margin-right:"+gutter+"px;padding-right:"+gutter+"px;'></div");
|
||||
column = $("<div class='column type_column' style='width:"+base_width+"px;margin-right:"+gutter+"px;padding-right:"+gutter+"px;'></div");
|
||||
total_columns++;
|
||||
column.append(ul);
|
||||
x++;
|
||||
temp_div.append(column);
|
||||
});
|
||||
})
|
||||
total_width = (!isNaN(base_width)) ? (base_width + gutter*2 +1) * total_columns : null;
|
||||
}
|
||||
total_width = (!isNaN(base_width)) ? (base_width + gutter*2 +1) * total_columns : null;
|
||||
break;
|
||||
default:
|
||||
|
||||
break;
|
||||
}
|
||||
// total_width = (!isNaN(base_width) ? ( base_width + 12 ) * total_columns : null);
|
||||
@@ -716,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");
|
||||
@@ -769,6 +773,9 @@ var orbitDesktop = function(dom){
|
||||
})
|
||||
|
||||
}
|
||||
var newpos = o.gridvar.serialize();
|
||||
console.log(newpos);
|
||||
$.post("/desktop/newpositions",{"newpositions":newpos});
|
||||
}
|
||||
}
|
||||
}).data('gridster');
|
||||
@@ -815,32 +822,54 @@ 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
|
||||
$("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 = $('<div class="grid gridster"></div>');
|
||||
var $ul = $('<ul style="margin: -6px 0 0 -6px;"></ul>');
|
||||
|
||||
$.each(tiles,function(i,tile){
|
||||
if(row >= 4){
|
||||
row = 1;
|
||||
col++;
|
||||
}
|
||||
var shape = tile.shape.split(" ");
|
||||
x = parseInt(shape[0].substr(1,1));
|
||||
y = parseInt(shape[1].substr(1,1));
|
||||
// if(tile.title == "Weather")console.log("Big - row : " + tile.row + ", col : "+ tile.column);
|
||||
// if(tile.title == "Google Scholar")console.log("Scholar - row : " + tile.row + ", col : "+ tile.column);
|
||||
|
||||
// if(total_x % 2 != 0)
|
||||
// row = row - y;
|
||||
// if(i == 7)tile.row = null;
|
||||
if(tile.row){
|
||||
row = tile.row;
|
||||
col = tile.column;
|
||||
x = parseInt(shape[0].substr(1,1));
|
||||
y = parseInt(shape[1].substr(1,1));
|
||||
}else{
|
||||
console.log(row + " : " + col);
|
||||
x = parseInt(shape[0].substr(1,1));
|
||||
if(total_x % 2 == 0){
|
||||
row = row + y;
|
||||
}else if(x == 1){
|
||||
col++;
|
||||
}
|
||||
y = parseInt(shape[1].substr(1,1));
|
||||
total_x = total_x + ( x * y );
|
||||
prev_y = y;
|
||||
if(total_x > 8){
|
||||
row = 1;
|
||||
total_x = 0;
|
||||
col++;
|
||||
}
|
||||
}
|
||||
var tilecolor = tilecolors[Math.floor(Math.random()*tilecolors.length)];
|
||||
var op = opacity[Math.floor(Math.random()*opacity.length)];
|
||||
var f = (tile.fullsize?"fullsize":null);
|
||||
|
||||
if(tile.data_category == "app")
|
||||
$li = $('<li data-id="'+tile.id+'" class="app" data-row="'+row+'" data-col="'+col+'" data-sizex="'+x+'" data-sizey="'+y+'" data-title="'+tile.title+'" data-category="'+tile.data_category+'" data-content="'+tile.data_content+'"><span class="tile '+tilecolor+' '+op+'"></span><a href="'+tile.data_content+'" class="appicon" onclick="return false;" data-url="'+tile.link+'"><img src="'+o.iconPath+tile.data_content+'.png" alt="" ></a><h1 class="appname thmtxt">'+tile.title+'</h1></li>');
|
||||
else
|
||||
$li = $('<li data-id="'+tile.id+'" class="widget '+f+'" data-row="'+row+'" data-col="'+col+'" data-sizex="'+x+'" data-sizey="'+y+'" data-category="'+tile.data_category+'" data-content="'+tile.data_content+'" js-link="'+tile.js[0].url+'" css-link="'+tile.css.url+'"><span class="tile '+tilecolor+' '+op+'"></span><div class="appholder"><div class="thmtxt o-loading"><i class="icon-spinning icon-spinner"></i> Loading</div></div><h1 class="appname thmtxt">'+tile.title+'</h1></li>');
|
||||
else
|
||||
$li = $('<li data-id="'+tile.id+'" class="widget '+f+'" data-row="'+row+'" data-col="'+col+'" data-sizex="'+x+'" data-sizey="'+y+'" data-category="'+tile.data_category+'" data-content="'+tile.data_content+'" js-link="'+tile.js[0].url+'" css-link="'+tile.css.url+'"><span class="tile '+tilecolor+' '+op+'"></span><div class="appholder"><div class="thmtxt all-loading"><i class="icon-spinner icon-spin"></i> Loading </div></div><h1 class="appname thmtxt">'+tile.title+'</h1></li>');
|
||||
|
||||
row = row + y;
|
||||
|
||||
|
||||
$ul.append($li);
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user