features and widgets added
Conflicts: app/assets/javascripts/orbitdesktop.js
This commit is contained in:
parent
a62ff9308f
commit
78205d8b00
Binary file not shown.
After Width: | Height: | Size: 8.2 KiB |
Binary file not shown.
After Width: | Height: | Size: 8.0 KiB |
|
@ -37,6 +37,71 @@ var sortAscending = function(a, b) {
|
||||||
var sortDescending = function(a, b) {
|
var sortDescending = function(a, b) {
|
||||||
return $(a).find("h1").text() < $(b).find("h1").text() ? 1 : -1;
|
return $(a).find("h1").text() < $(b).find("h1").text() ? 1 : -1;
|
||||||
};
|
};
|
||||||
|
jQuery.ajax = (function(_ajax){
|
||||||
|
|
||||||
|
var protocol = location.protocol,
|
||||||
|
hostname = location.hostname,
|
||||||
|
exRegex = RegExp(protocol + '//' + hostname),
|
||||||
|
YQL = 'http' + (/^https/.test(protocol)?'s':'') + '://query.yahooapis.com/v1/public/yql?callback=?',
|
||||||
|
query = 'select * from html where url="{URL}" and xpath="*"';
|
||||||
|
|
||||||
|
function isExternal(url) {
|
||||||
|
return !exRegex.test(url) && /:\/\//.test(url);
|
||||||
|
}
|
||||||
|
|
||||||
|
return function(o) {
|
||||||
|
|
||||||
|
var url = o.url;
|
||||||
|
|
||||||
|
if ( /get/i.test(o.type) && !/json/i.test(o.dataType) && isExternal(url) ) {
|
||||||
|
|
||||||
|
// Manipulate options so that JSONP-x request is made to YQL
|
||||||
|
|
||||||
|
o.url = YQL;
|
||||||
|
o.dataType = 'json';
|
||||||
|
|
||||||
|
o.data = {
|
||||||
|
q: query.replace(
|
||||||
|
'{URL}',
|
||||||
|
url + (o.data ?
|
||||||
|
(/\?/.test(url) ? '&' : '?') + jQuery.param(o.data)
|
||||||
|
: '')
|
||||||
|
),
|
||||||
|
format: 'xml'
|
||||||
|
};
|
||||||
|
|
||||||
|
// Since it's a JSONP request
|
||||||
|
// complete === success
|
||||||
|
if (!o.success && o.complete) {
|
||||||
|
o.success = o.complete;
|
||||||
|
delete o.complete;
|
||||||
|
}
|
||||||
|
|
||||||
|
o.success = (function(_success){
|
||||||
|
return function(data) {
|
||||||
|
|
||||||
|
if (_success) {
|
||||||
|
// Fake XHR callback.
|
||||||
|
_success.call(this, {
|
||||||
|
responseText: (data.results[0] || '')
|
||||||
|
// YQL screws with <script>s
|
||||||
|
// Get rid of them
|
||||||
|
.replace(/<script[^>]+?\/>|<script(.|\s)*?\/script>/gi, '')
|
||||||
|
}, 'success');
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
})(o.success);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return _ajax.apply(this, arguments);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
})(jQuery.ajax);
|
||||||
|
|
||||||
|
|
||||||
var orbitDesktop = function(dom){
|
var orbitDesktop = function(dom){
|
||||||
orbitDesktopAPI.apply(this);
|
orbitDesktopAPI.apply(this);
|
||||||
// o = this;
|
// o = this;
|
||||||
|
@ -53,11 +118,12 @@ var orbitDesktop = function(dom){
|
||||||
this.gridvar = null;
|
this.gridvar = null;
|
||||||
this.lastlink= null;
|
this.lastlink= null;
|
||||||
this.tinyscrollbar = null;
|
this.tinyscrollbar = null;
|
||||||
|
this.locationdata = {};
|
||||||
this.initialize = function(){
|
this.initialize = function(){
|
||||||
|
|
||||||
var theme = o.theme;
|
var theme = o.theme;
|
||||||
var custom = false;
|
var custom = false;
|
||||||
|
o.getlocation();
|
||||||
$.getJSON("/desktop/get_desktop_settings",{"get":"desktop","desktopid":o.desktopId},function(desktopSettings){
|
$.getJSON("/desktop/get_desktop_settings",{"get":"desktop","desktopid":o.desktopId},function(desktopSettings){
|
||||||
if(desktopSettings){
|
if(desktopSettings){
|
||||||
if(desktopSettings.theme!="custom"){
|
if(desktopSettings.theme!="custom"){
|
||||||
|
@ -82,6 +148,7 @@ var orbitDesktop = function(dom){
|
||||||
o.loadWallpaper(customwallpaper);
|
o.loadWallpaper(customwallpaper);
|
||||||
o.bindDesktopEvents();
|
o.bindDesktopEvents();
|
||||||
o.loadIconCache();
|
o.loadIconCache();
|
||||||
|
o.getlocation();
|
||||||
var custom_load = window.location.hash;
|
var custom_load = window.location.hash;
|
||||||
if(!custom_load){
|
if(!custom_load){
|
||||||
$(o.contentHolder).empty().load("/desktop/desktop",function(){
|
$(o.contentHolder).empty().load("/desktop/desktop",function(){
|
||||||
|
@ -114,7 +181,32 @@ var orbitDesktop = function(dom){
|
||||||
o.loadIconCache();
|
o.loadIconCache();
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.getlocation = function(){
|
||||||
|
var locationSuccess = function(pos){
|
||||||
|
o.locationdata.lat = pos.coords.latitude;
|
||||||
|
o.locationdata.lng = pos.coords.longitude;
|
||||||
|
$.getJSON("http://maps.googleapis.com/maps/api/geocode/json?latlng="+o.locationdata.lat+","+o.locationdata.lng+"&sensor=true",function(data){
|
||||||
|
$.each(data.results[0].address_components,function(i,val){
|
||||||
|
o.locationdata[val.types[0]] = val.long_name;
|
||||||
|
})
|
||||||
|
o.locationdata.formatted_address = data.results[0].formatted_address;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
var locationError = function(){
|
||||||
|
o.notify("Unable to find your location!","alert");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (navigator.geolocation) {
|
||||||
|
navigator.geolocation.getCurrentPosition(locationSuccess,locationError);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
o.notify("Your browser does not support Geolocation!","alert");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
this.bindDesktopEvents = function(){ //this function will bind the global handlers to thd desktop, for example doc
|
this.bindDesktopEvents = function(){ //this function will bind the global handlers to thd desktop, for example doc
|
||||||
$(".docklist a").click(function(){
|
$(".docklist a").click(function(){
|
||||||
o.menu_item($(this));
|
o.menu_item($(this));
|
||||||
|
@ -296,17 +388,16 @@ var orbitDesktop = function(dom){
|
||||||
column_container = $e.find("div.overview");
|
column_container = $e.find("div.overview");
|
||||||
layout = column_container.attr("content-layout"), base_width = parseInt(column_container.attr("base-width")), no_of_entries,total_columns=0, pagination_link = column_container.attr("pagination-link"), pagination_variable = column_container.attr("pagination-var");
|
layout = column_container.attr("content-layout"), base_width = parseInt(column_container.attr("base-width")), no_of_entries,total_columns=0, pagination_link = column_container.attr("pagination-link"), pagination_variable = column_container.attr("pagination-var");
|
||||||
var temp_div = $("<div></div>");
|
var temp_div = $("<div></div>");
|
||||||
|
var entries = [];
|
||||||
switch (layout){
|
switch (layout){
|
||||||
case "simple":
|
case "simple":
|
||||||
total_columns++;
|
total_columns++;
|
||||||
temp_div.append(column_container.html());
|
temp_div.append(column_container.html());
|
||||||
var entries = [];
|
|
||||||
total_width = "auto";
|
|
||||||
break;
|
break;
|
||||||
case "datalist":
|
case "datalist":
|
||||||
no_of_entries = (typeof column_container.attr("per-column") != "undefined"? parseInt(column_container.attr("per-column")) : 4);
|
no_of_entries = (typeof column_container.attr("per-column") != "undefined"? parseInt(column_container.attr("per-column")) : 4);
|
||||||
var height_percentage = 100/no_of_entries;
|
var height_percentage = 100/no_of_entries;
|
||||||
var entries = column_container.find("li[item=true]"),x = 0;
|
entries = column_container.find("li[item=true]"),x = 0;
|
||||||
if(entries.length != 0){
|
if(entries.length != 0){
|
||||||
entries.each(function(i,li){
|
entries.each(function(i,li){
|
||||||
if(x == 0){
|
if(x == 0){
|
||||||
|
@ -324,7 +415,7 @@ var orbitDesktop = function(dom){
|
||||||
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;
|
break;
|
||||||
case "column":
|
case "column":
|
||||||
var entries = column_container.find("div[column=true]"),x = 0,column;
|
entries = column_container.find("div[column=true]"),x = 0,column;
|
||||||
if(entries.length!=0){
|
if(entries.length!=0){
|
||||||
entries.each(function(i,ul){
|
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");
|
||||||
|
@ -336,6 +427,9 @@ var orbitDesktop = function(dom){
|
||||||
}
|
}
|
||||||
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;
|
break;
|
||||||
|
default:
|
||||||
|
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
// total_width = (!isNaN(base_width) ? ( base_width + 12 ) * total_columns : null);
|
// total_width = (!isNaN(base_width) ? ( base_width + 12 ) * total_columns : null);
|
||||||
return {"markup":temp_div.html(),"width":total_width,"total":entries.length};
|
return {"markup":temp_div.html(),"width":total_width,"total":entries.length};
|
||||||
|
@ -440,6 +534,7 @@ var orbitDesktop = function(dom){
|
||||||
if(!customload)customload=false;
|
if(!customload)customload=false;
|
||||||
var target = dom.attr("id");
|
var target = dom.attr("id");
|
||||||
var url = dom.attr("href");
|
var url = dom.attr("href");
|
||||||
|
if(!url)return false;
|
||||||
o.lastlink = url;
|
o.lastlink = url;
|
||||||
o.data_method = dom.attr("callback-method");
|
o.data_method = dom.attr("callback-method");
|
||||||
if(o.currenthtml!=target){
|
if(o.currenthtml!=target){
|
||||||
|
@ -452,7 +547,6 @@ var orbitDesktop = function(dom){
|
||||||
$("#content").hide("drop",o.transitionTime,function(){
|
$("#content").hide("drop",o.transitionTime,function(){
|
||||||
o.currenthtml = target;
|
o.currenthtml = target;
|
||||||
o.currentface = target;
|
o.currentface = target;
|
||||||
|
|
||||||
var cache = false;
|
var cache = false;
|
||||||
if(!o.desktopData[o.currentface]){
|
if(!o.desktopData[o.currentface]){
|
||||||
$(o.contentHolder).empty().load(url,function(data){
|
$(o.contentHolder).empty().load(url,function(data){
|
||||||
|
@ -609,51 +703,6 @@ var orbitDesktop = function(dom){
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// });
|
// });
|
||||||
o.simple_drop_down();
|
|
||||||
o.tinyscrollbar_ext({
|
|
||||||
main: '.tinycanvas'
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
// $("div#group_wrapper ul li[data-category=app]").click(function(){
|
|
||||||
// o.appWindow({
|
|
||||||
// title : $(this).find("a").attr("href"),
|
|
||||||
// appid : $(this).find("a").attr("href")
|
|
||||||
// });
|
|
||||||
// });
|
|
||||||
}
|
|
||||||
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));
|
|
||||||
var tilecolors = o.themesettings.tilecolor;
|
|
||||||
var totaltiles_in_a_row = 4;
|
|
||||||
var opacity = ["op05","op06","op07","op08","op09"];
|
|
||||||
var row = 1,col = 1,x = 1,y = 1;
|
|
||||||
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));
|
|
||||||
var tilecolor = tilecolors[Math.floor(Math.random()*tilecolors.length)];
|
|
||||||
var op = opacity[Math.floor(Math.random()*opacity.length)];
|
|
||||||
if(tile.data_category == "app")
|
|
||||||
$li = $('<li data-id="'+tile.id+'" class="widget" data-row="'+row+'" data-col="'+col+'" data-sizex="'+x+'" data-sizey="'+y+'" 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;"><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" 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-spinner icon-spin"></i> Loading</div></div><h1 class="appname thmtxt">'+tile.title+'</h1></li>');
|
|
||||||
|
|
||||||
row = row + y;
|
|
||||||
|
|
||||||
$ul.append($li);
|
|
||||||
})
|
|
||||||
$group.append($ul);
|
|
||||||
$("div#desktop div#group_wrapper").append($group);
|
|
||||||
var dragged = null,draggable,lastpos = [];
|
var dragged = null,draggable,lastpos = [];
|
||||||
o.gridvar = $(".grid ul").find("> li ").mousedown(function(e){
|
o.gridvar = $(".grid ul").find("> li ").mousedown(function(e){
|
||||||
!draggable;
|
!draggable;
|
||||||
|
@ -668,7 +717,11 @@ var orbitDesktop = function(dom){
|
||||||
widget_base_dimensions: [120, 120],
|
widget_base_dimensions: [120, 120],
|
||||||
// avoid_overlapped_widgets: true,
|
// avoid_overlapped_widgets: true,
|
||||||
draggable : {
|
draggable : {
|
||||||
|
start : function(event, ui){
|
||||||
|
dragged.addClass("noClick");
|
||||||
|
},
|
||||||
stop: function(event, ui){
|
stop: function(event, ui){
|
||||||
|
|
||||||
// var widgetchanged_col = dragged.attr("data-col");
|
// var widgetchanged_col = dragged.attr("data-col");
|
||||||
// var total = 0;
|
// var total = 0;
|
||||||
// // console.log(widgetchanged.col);
|
// // console.log(widgetchanged.col);
|
||||||
|
@ -706,7 +759,7 @@ var orbitDesktop = function(dom){
|
||||||
$(".grid ul .widget[data-col="+i+"]").each(function(){
|
$(".grid ul .widget[data-col="+i+"]").each(function(){
|
||||||
var pos = $(this).position();
|
var pos = $(this).position();
|
||||||
if(pos){
|
if(pos){
|
||||||
console.log(pos.top + $(this).height() + 6);
|
|
||||||
if((pos.top + $(this).height() + 6) > 550){
|
if((pos.top + $(this).height() + 6) > 550){
|
||||||
revertbacktiles();
|
revertbacktiles();
|
||||||
|
|
||||||
|
@ -733,6 +786,66 @@ var orbitDesktop = function(dom){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
o.simple_drop_down();
|
||||||
|
o.tinyscrollbar_ext({
|
||||||
|
main: '.tinycanvas'
|
||||||
|
})
|
||||||
|
$("li.app[data-category=app]").click(function(){
|
||||||
|
if(!$(this).hasClass("noClick")){
|
||||||
|
var url = $(this).find("a").data("url");
|
||||||
|
var app = $(this);
|
||||||
|
o.appWindow({
|
||||||
|
"appid" : app.data("id"),
|
||||||
|
"title" : app.data("title"),
|
||||||
|
"url" : url
|
||||||
|
})
|
||||||
|
}
|
||||||
|
dragged.removeClass("noClick");
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
// $("div#group_wrapper ul li[data-category=app]").click(function(){
|
||||||
|
// o.appWindow({
|
||||||
|
// title : $(this).find("a").attr("href"),
|
||||||
|
// appid : $(this).find("a").attr("href")
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
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));
|
||||||
|
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 $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));
|
||||||
|
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 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);
|
||||||
|
})
|
||||||
|
$group.append($ul);
|
||||||
|
$("div#desktop div#group_wrapper").append($group);
|
||||||
|
|
||||||
bindHandlers();
|
bindHandlers();
|
||||||
o.initializeWidgets();
|
o.initializeWidgets();
|
||||||
})
|
})
|
||||||
|
|
|
@ -115,6 +115,7 @@ var orbitDesktopAPI = function(){
|
||||||
//takes set of arguments as array and gives callback
|
//takes set of arguments as array and gives callback
|
||||||
//settings.method (string) : like open and close
|
//settings.method (string) : like open and close
|
||||||
//settings.title (string) : the window title
|
//settings.title (string) : the window title
|
||||||
|
//settings.extUrl (boolean) : true for opening external url else false
|
||||||
//settings.appid (string) : appid.. user can use this appid to open or close or refresh the window
|
//settings.appid (string) : appid.. user can use this appid to open or close or refresh the window
|
||||||
//settings.url (string) : it is the url if you want to force external url to open in appwindow... you have to pass extURL in appid if you want to open externalurl
|
//settings.url (string) : it is the url if you want to force external url to open in appwindow... you have to pass extURL in appid if you want to open externalurl
|
||||||
if(typeof settings == "undefined")settings = {};
|
if(typeof settings == "undefined")settings = {};
|
||||||
|
@ -123,13 +124,16 @@ var orbitDesktopAPI = function(){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(!settings.method)settings.method = "open";
|
if(!settings.method)settings.method = "open";
|
||||||
|
if(!settings.extUrl)settings.extUrl = true;
|
||||||
if(settings.method == 'open'){
|
if(settings.method == 'open'){
|
||||||
var appurl = "http://www.rulingcom.com";
|
var appurl = "http://www.rulingcom.com";
|
||||||
o.windowcounter++;
|
o.windowcounter++;
|
||||||
if(!settings.title)settings.title = "New Window "+o.windowcounter;
|
if(!settings.title)settings.title = "New Window "+o.windowcounter;
|
||||||
if(settings.appid=="extURL"){
|
if(settings.extUrl){
|
||||||
if(settings.url){
|
if(settings.url){
|
||||||
if(settings.url.substr(0,3)!="http")settings.url = "http://"+settings.url;
|
|
||||||
|
if(settings.url.substr(0,4)!="http")settings.url = "http://"+settings.url;
|
||||||
|
console.log(settings.url)
|
||||||
var urlregex = new RegExp("^(http:\/\/www.|https:\/\/www.|ftp:\/\/www.|www.){1}([0-9A-Za-z]+\.)");
|
var urlregex = new RegExp("^(http:\/\/www.|https:\/\/www.|ftp:\/\/www.|www.){1}([0-9A-Za-z]+\.)");
|
||||||
if(urlregex.test(settings.url))
|
if(urlregex.test(settings.url))
|
||||||
appurl = settings.url;
|
appurl = settings.url;
|
||||||
|
@ -143,7 +147,7 @@ var orbitDesktopAPI = function(){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var whtml =$('<div id="app_frame_'+o.windowcounter+'" class="thmc2 app_frame" data-content="'+settings.appid+'"><div id="content"><div id="header" class="hh3"><div class="dtitle w2 hh3 hp" style="text-transform:capitalize;"><span class="thmtxth">'+settings.title+'</span></div><span class="icon-remove hh3 hp thmtxt"></span></div><div id="holder_'+o.windowcounter+'" class="app_holder"><iframe src="'+appurl+'" frameborder="0" scrolling="auto"></iframe><div class="clear"></div></div></div></div>');
|
var whtml =$('<div id="app_frame_'+o.windowcounter+'" class="thmc2 app_frame" data-app="'+settings.appid+'"><div id="content"><div id="header" class="hh3"><div class="dtitle w2 hh3 hp" style="text-transform:capitalize;"><span class="thmtxth">'+settings.title+'</span></div><span class="icon-remove hh3 hp thmtxt"></span></div><div id="holder_'+o.windowcounter+'" class="app_holder"><iframe src="'+appurl+'" frameborder="0" scrolling="auto"></iframe><div class="clear"></div></div></div></div>');
|
||||||
$(o.contentHolder).append(whtml);
|
$(o.contentHolder).append(whtml);
|
||||||
var parentwindow = $(o.contentHolder).find("div#app_frame_"+o.windowcounter);
|
var parentwindow = $(o.contentHolder).find("div#app_frame_"+o.windowcounter);
|
||||||
var app_holder_height = parentwindow.height() - 72;
|
var app_holder_height = parentwindow.height() - 72;
|
||||||
|
|
|
@ -117,6 +117,8 @@ class DesktopController< ApplicationController
|
||||||
jsfile = []
|
jsfile = []
|
||||||
cssfile = ""
|
cssfile = ""
|
||||||
shape = "w1 h1"
|
shape = "w1 h1"
|
||||||
|
fullsize = false
|
||||||
|
link = ""
|
||||||
if tile.data_category == "widget"
|
if tile.data_category == "widget"
|
||||||
widge = DesktopWidget.find(tile.desktop_widget_id.to_s)
|
widge = DesktopWidget.find(tile.desktop_widget_id.to_s)
|
||||||
# data_content = widge.widget_layout.file
|
# data_content = widge.widget_layout.file
|
||||||
|
@ -125,11 +127,21 @@ class DesktopController< ApplicationController
|
||||||
cssfile = widge.css_default.file.as_json[:file]
|
cssfile = widge.css_default.file.as_json[:file]
|
||||||
shape = widge.shape
|
shape = widge.shape
|
||||||
title = widge.name
|
title = widge.name
|
||||||
|
# binding.pry
|
||||||
|
if not widge.fullsize.nil?
|
||||||
|
fullsize = widge.fullsize
|
||||||
|
end
|
||||||
else
|
else
|
||||||
data_content = tile.data_content
|
data_content = tile.data_content
|
||||||
title = tile.title
|
title = tile.title
|
||||||
|
case data_content
|
||||||
|
when "envocab"
|
||||||
|
link = "http://www.english-vocabulary.eu/"
|
||||||
|
when "wikibooks"
|
||||||
|
link = "http://www.wikibooks.org"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
gr << {"id"=>tile.id,"data_category"=>tile.data_category,"data_content"=>data_content,"js"=>jsfile,"css"=>cssfile,"shape"=>shape,"position"=>tile.position,"title"=>title}
|
gr << {"id"=>tile.id,"data_category"=>tile.data_category,"data_content"=>data_content,"js"=>jsfile,"css"=>cssfile,"shape"=>shape,"position"=>tile.position,"title"=>title,"fullsize"=>fullsize,"link"=>link}
|
||||||
end
|
end
|
||||||
# gr << a
|
# gr << a
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,6 +6,7 @@ class DesktopWidget
|
||||||
field :name
|
field :name
|
||||||
field :author
|
field :author
|
||||||
field :shape
|
field :shape
|
||||||
|
field :fullsize, :type => Boolean
|
||||||
field :version, :type => String
|
field :version, :type => String
|
||||||
|
|
||||||
has_one :css_default, as: :css, :autosave => true, :dependent => :destroy
|
has_one :css_default, as: :css, :autosave => true, :dependent => :destroy
|
||||||
|
@ -13,7 +14,7 @@ class DesktopWidget
|
||||||
has_many :images, as: :imgs, :autosave => true, :dependent => :destroy
|
has_many :images, as: :imgs, :autosave => true, :dependent => :destroy
|
||||||
has_many :javascripts, as: :js, :autosave => true, :dependent => :destroy
|
has_many :javascripts, as: :js, :autosave => true, :dependent => :destroy
|
||||||
has_and_belongs_to_many :desktops, :autosave => true
|
has_and_belongs_to_many :desktops, :autosave => true
|
||||||
belongs_to :tiles, :autosave => true
|
has_many :tiles, :autosave => true
|
||||||
|
|
||||||
accepts_nested_attributes_for :images, :allow_destroy => true
|
accepts_nested_attributes_for :images, :allow_destroy => true
|
||||||
accepts_nested_attributes_for :javascripts, :allow_destroy => true
|
accepts_nested_attributes_for :javascripts, :allow_destroy => true
|
||||||
|
|
|
@ -6,9 +6,10 @@ class Tile
|
||||||
field :data_content
|
field :data_content
|
||||||
field :position, type: Integer
|
field :position, type: Integer
|
||||||
field :shape
|
field :shape
|
||||||
|
field :fullsize, type: Boolean
|
||||||
field :title
|
field :title
|
||||||
|
|
||||||
belongs_to :group
|
belongs_to :group
|
||||||
has_one :desktop_widget
|
belongs_to :desktop_widget
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -69,9 +69,9 @@ def cache_dir
|
||||||
|
|
||||||
|
|
||||||
def manipulate!
|
def manipulate!
|
||||||
cache_stored_file! if !cached?
|
# cache_stored_file! if !cached?
|
||||||
#raise File.extname(current_path.to_s).to_s
|
#raise File.extname(current_path.to_s).to_s
|
||||||
image = ::MiniMagick::Image.open(current_path)
|
# image = ::MiniMagick::Image.open(current_path)
|
||||||
# image = yield(image)
|
# image = yield(image)
|
||||||
# image.write(current_path)
|
# image.write(current_path)
|
||||||
# ::MiniMagick::Image.open(current_path)
|
# ::MiniMagick::Image.open(current_path)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<div id="side">
|
<div id="side">
|
||||||
<div id="rwidget" class="wh2 thmc4">
|
<div id="rwidget" class="wh2 thmc4">
|
||||||
<ul class="docklist">
|
<ul class="docklist">
|
||||||
<li class="d_cate"><a callback-method='initializeDesktop' href="desktop/" class="widget_fn wh2 hh2" id='d_desktop' onclick="return false;"><span class="widget_icon"><img src="" alt="Home" id="home_icon" width="30" height="30"/></span></a>
|
<li class="d_cate"><a callback-method='initializeDesktop' href="desktop/" class="widget_fn wh2 hh2" id='home' onclick="return false;"><span class="widget_icon"><img src="" alt="Home" id="home_icon" width="30" height="30"/></span></a>
|
||||||
<ul class="dock_child hh2 thmc4" style="width: 180px;">
|
<ul class="dock_child hh2 thmc4" style="width: 180px;">
|
||||||
<li class="dock_item"><a callback-method='initializeAppSearch' href="<%= desktop_app_manager_path %>" class="widget_fn wh2 hh2" id="d_app_manager" onclick="return false;"><span class="widget_icon"><img src="" alt="App Manager" id="app_manager_icon" width="30" height="30"/></span></a></li>
|
<li class="dock_item"><a callback-method='initializeAppSearch' href="<%= desktop_app_manager_path %>" class="widget_fn wh2 hh2" id="d_app_manager" onclick="return false;"><span class="widget_icon"><img src="" alt="App Manager" id="app_manager_icon" width="30" height="30"/></span></a></li>
|
||||||
<li class="dock_item"><a callback-method='initializeSectionsManager' href="<%= desktop_allsections_path %>" class="widget_fn wh2 hh2" id="d_sections" custom-load="sections" onclick="return false;"><span class="widget_icon"><img src="" alt="All Sections" id="sections_icon" width="30" height="30"/></span></a></li>
|
<li class="dock_item"><a callback-method='initializeSectionsManager' href="<%= desktop_allsections_path %>" class="widget_fn wh2 hh2" id="d_sections" custom-load="sections" onclick="return false;"><span class="widget_icon"><img src="" alt="All Sections" id="sections_icon" width="30" height="30"/></span></a></li>
|
||||||
|
|
Loading…
Reference in New Issue