solved desktop conflict during cherry pick
This commit is contained in:
parent
874819266d
commit
2d616ab7a8
|
@ -612,6 +612,7 @@ var orbitDesktop = function(dom){
|
|||
}
|
||||
}
|
||||
this.sub_menu_item = function(dom,data){
|
||||
console.log(dom)
|
||||
var sub_data_method = dom.attr('callback-method');
|
||||
if(sub_data_method){
|
||||
o.lastlink = dom.attr("href");
|
||||
|
@ -818,7 +819,8 @@ var orbitDesktop = function(dom){
|
|||
};
|
||||
|
||||
this.initializeAppManager = function(target,url,cache){ //this is application search ie is app manager initialization
|
||||
var searchArray,allApps;
|
||||
var searchArray, allApps;
|
||||
|
||||
var bindHandlers = function(){ // bind handler for app manager page
|
||||
// var gn = $('.g_col').length,
|
||||
// gw = $('.g_col').outerWidth(true);
|
||||
|
@ -826,7 +828,12 @@ var orbitDesktop = function(dom){
|
|||
// $("div#app_manager .group_search").css("width",$(window).width()-200);
|
||||
//for textbox search
|
||||
var $elements = $("#app_manager .element"),
|
||||
$result = $("#app_manager .search_result");
|
||||
$result = $("#app_manager .search_result"),
|
||||
$appinfo = $("#app_info"),
|
||||
$apptitle = $("#app_info .app_info_name"),
|
||||
$appicon = $("#app_info .app_info_icon")
|
||||
$appinfolist = $("#app_info .app_info_list");
|
||||
|
||||
$("#app_manager #searchbox")
|
||||
.focus(function(){
|
||||
$(this).val("");
|
||||
|
@ -849,8 +856,8 @@ var orbitDesktop = function(dom){
|
|||
if(i == 1){
|
||||
$column = $('<div class="g_col g_col_w1"></div>');
|
||||
}
|
||||
var $newelement = $('<div class="element w1 h1 thmc2">'+$(this).html()+'</div>');
|
||||
$column.append($newelement);
|
||||
$column.append($(this));
|
||||
$(this).show();
|
||||
if(i == 4){
|
||||
$result.append($column);
|
||||
i = 0;
|
||||
|
@ -859,6 +866,7 @@ var orbitDesktop = function(dom){
|
|||
if(i != 0){
|
||||
$result.append($column);
|
||||
}
|
||||
elementSetting();
|
||||
} else {
|
||||
$result.text("No Result Found.");
|
||||
}
|
||||
|
@ -877,11 +885,11 @@ var orbitDesktop = function(dom){
|
|||
switch ($(this).attr("href")){
|
||||
case "ascending":
|
||||
$(this).attr("href","descending").find(".thmtxt").text("Alphabet [Z-A]");
|
||||
allApps = $("div#app_manager .group_search .element").sort(sortAscending);
|
||||
allApps = $("div#app_manager .element").sort(sortAscending);
|
||||
break;
|
||||
case "descending":
|
||||
$(this).attr("href","ascending").find(".thmtxt").text("Alphabet [A-Z]");
|
||||
allApps = $("#app_manager .group_search .element").sort(sortDescending);
|
||||
allApps = $("#app_manager .element").sort(sortDescending);
|
||||
break;
|
||||
}
|
||||
$("#app_manager #app_list").empty();
|
||||
|
@ -897,25 +905,85 @@ var orbitDesktop = function(dom){
|
|||
$('.g_col.col'+ colindex).append(app);
|
||||
}
|
||||
});
|
||||
elementSetting();
|
||||
return false;
|
||||
});
|
||||
$(window).on('keydown', function(){
|
||||
if($('#searchbox').val() == 'Search'){
|
||||
$('#searchbox').focus();
|
||||
|
||||
|
||||
var elementSetting = function(){// for element setting load
|
||||
$(".element").click(function(){
|
||||
$e = $(this);
|
||||
$apptitle.text($e.data("title"));
|
||||
$appicon.attr("src",$e.find("img").attr("src"));
|
||||
$appinfolist.find("li:eq(2) div").text($e.data("version"));
|
||||
var dt = new Date($e.data("update"));
|
||||
$appinfolist.find("li:eq(3) div").text(dt.toUTCString());
|
||||
$appinfolist.find("li:eq(4) div").text($e.data("author"));
|
||||
|
||||
var sections = elementSettingsData[$e.data("id")].sections;
|
||||
|
||||
var sectionids = new Array();
|
||||
$.each(sections,function(i,sec){
|
||||
sectionids.push(sec.id);
|
||||
})
|
||||
|
||||
$appinfolist.find("li:eq(0)").empty();
|
||||
$.each(o.sectionList,function(i,sec){
|
||||
|
||||
var present = $.inArray(sec._id,sectionids);
|
||||
if(present == -1){
|
||||
$sectionswitch = $('<label class="s_grid s_grid_3">'+ sec.name +'</label><div class="s_grid s_grid_9 s_switch"><div class="s_switch_status" status-off="Off">Off</div><label class="s_switch_switcher admbg2"><input type="checkbox" data-widget="'+ $e.data("id") +'" data-section="'+ sec._id +'"><span class="s_switch_toggle"></span></label></div>');
|
||||
}else{
|
||||
$sectionswitch = $('<label class="s_grid s_grid_3">'+ sec.name +'</label><div class="s_grid s_grid_9 s_switch"><div class="s_switch_status" status-on="On">On</div><label class="s_switch_switcher thmc2"><input type="checkbox" checked="checked" data-widget="'+ $e.data("id") +'" data-section="'+ sec._id +'"><span class="s_switch_toggle"></span></label></div>');
|
||||
}
|
||||
$appinfolist.find("li:eq(0)").append($sectionswitch);
|
||||
})
|
||||
$appinfo.show();
|
||||
o.simple_switch(function(dom){
|
||||
var options = {
|
||||
"status" : dom.is(":checked"),
|
||||
"widget_id" : dom.data("widget"),
|
||||
"section_id" : dom.data("section")
|
||||
}
|
||||
var sectionDetails = o.sectionList.filter(function(o){return(o._id == dom.data("section"))})[0];
|
||||
$.ajax({
|
||||
url : "/desktop/appactivation",
|
||||
type : "post",
|
||||
datatype : "json",
|
||||
data : options,
|
||||
success : function(data){
|
||||
if(data.success == "true"){
|
||||
elementSettingsData[$e.data("id")].sections.push({"id" : dom.data("section"),"name":sectionDetails.name});
|
||||
if(dom.is(":checked"))
|
||||
o.notify("Added to " + sectionDetails.name,"success");
|
||||
else
|
||||
o.notify("Removed from " + sectionDetails.name,"success");
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
o.appname_substr('#group_wrapper .element');
|
||||
o.simple_switch();
|
||||
})
|
||||
}
|
||||
|
||||
$appinfo.find("a.panel_close").click(function(){
|
||||
$appinfo.hide();
|
||||
return false;
|
||||
})
|
||||
elementSetting();
|
||||
o.appname_substr('#group_wrapper .element');
|
||||
|
||||
}
|
||||
var elementSettingsData = {};
|
||||
var loadApps = function(){ //this load apps for sorting and searching
|
||||
$.getJSON("/desktop/getapplist",{desktopid:o.desktopId},function(appss){
|
||||
$('#app_list').empty();
|
||||
$.getJSON("/desktop/getapplistforManager",{desktopid:o.desktopId},function(apps){
|
||||
var count = 0, colindex = 0;
|
||||
$('#app_list').append('<div class="g_col g_col_w1 col'+ colindex +'"/>');
|
||||
$.each(appss,function(i,apps){
|
||||
$.each(apps,function(i,app){
|
||||
var $app;
|
||||
count++;
|
||||
$app = $('<div class="element w1 h1 thmc2" data-category="'+app.data_category+'" data-content="'+app.data_content+'"><span class="tile thmc2"></span><a href="'+app._id+'" class="appicon"><img src="'+o.iconPath+app.data_content+'.png" alt="" onclick="return false;"></a><h1 class="appname thmtxt">'+app.title+'</h1></div>');
|
||||
elementSettingsData[app.id] = {"sections" : app.sections};
|
||||
$app = $('<div class="element w1 h1 hp vp thmc2" data-category="'+app.data_category+'" data-title="'+app.title+'" data-author="'+app.author+'" data-version="'+app.version+'" data-update="'+app.last_update+'" data-id="'+app.id+'" ><span class="tile thmc2"></span><a href="'+app.id+'" class="appicon"><img src="'+app.icon+'" alt="" onclick="return false;"></a><h1 class="appname thmtxt">'+app.title+'</h1></div>');
|
||||
if( count > 4 ){
|
||||
count = 1, colindex+=1;
|
||||
$('#app_list').append('<div class="g_col g_col_w1 col'+ colindex +'"/>');
|
||||
|
@ -924,16 +992,14 @@ var orbitDesktop = function(dom){
|
|||
$('.g_col.col'+ colindex).append($app);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
bindHandlers();
|
||||
});
|
||||
}
|
||||
if(cache){
|
||||
bindHandlers();
|
||||
} else {
|
||||
// if(cache){
|
||||
// bindHandlers();
|
||||
// } else {
|
||||
loadApps();
|
||||
}
|
||||
// }
|
||||
};
|
||||
this.initializeSectionsManager = function(target,url,cache){ // this is init function for section manager
|
||||
var elementParent,element,slabel;
|
||||
|
@ -1579,7 +1645,8 @@ var orbitDesktop = function(dom){
|
|||
});
|
||||
});
|
||||
};
|
||||
this.simple_switch = function(){
|
||||
|
||||
this.simple_switch = function(func){
|
||||
$('.s_switch').each(function(){
|
||||
var $switcher = $(this).find('.s_switch_switcher'),
|
||||
$checkbox = $(this).find('input[type=checkbox]'),
|
||||
|
@ -1603,9 +1670,12 @@ var orbitDesktop = function(dom){
|
|||
$status.text(status_off);
|
||||
break;
|
||||
}
|
||||
if(typeof func == "function")
|
||||
func.call(this,$(this));
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
this.single_select = function(){
|
||||
// single select
|
||||
$('.ssl .ssl_item').each(function(){
|
||||
|
|
|
@ -604,6 +604,7 @@ a.admtxt.admbg2:hover {
|
|||
width: 420px;
|
||||
height: 516px;
|
||||
margin-right: 36px; }
|
||||
|
||||
#app_info .app_info_header {
|
||||
height: 120px;
|
||||
margin: -12px -12px 12px -12px;
|
||||
|
|
|
@ -117,8 +117,8 @@ class DesktopController< ApplicationController
|
|||
jsfile = []
|
||||
cssfile = ""
|
||||
shape = "w1 h1"
|
||||
fullsize = false
|
||||
link = ""
|
||||
fullsize = false
|
||||
if tile.data_category == "widget"
|
||||
widge = DesktopWidget.find(tile.desktop_widget_id.to_s)
|
||||
# data_content = widge.widget_layout.file
|
||||
|
@ -128,9 +128,7 @@ class DesktopController< ApplicationController
|
|||
shape = widge.shape
|
||||
title = widge.name
|
||||
# binding.pry
|
||||
if not widge.fullsize.nil?
|
||||
fullsize = widge.fullsize
|
||||
end
|
||||
else
|
||||
data_content = tile.data_content
|
||||
title = tile.title
|
||||
|
@ -195,6 +193,33 @@ class DesktopController< ApplicationController
|
|||
render :json=>a.to_json
|
||||
end
|
||||
|
||||
def getapplistforManager
|
||||
@dwss = DesktopWidget.all
|
||||
@tiles = Array.new
|
||||
desktop = Desktop.find(params['desktopid'])
|
||||
sections = desktop.sections
|
||||
sections.each do |section|
|
||||
groups = section.groups
|
||||
groups.each do |group|
|
||||
@tiles += group.tiles
|
||||
end
|
||||
end
|
||||
@validtiles = Array.new
|
||||
@allWidgets = Array.new
|
||||
@dwss.each do |dw|
|
||||
@id = dw.id
|
||||
@validtiles = @tiles.select{|t| t.desktop_widget_id == @id}
|
||||
@sections = Array.new
|
||||
@validtiles.each do |vt|
|
||||
grp = Group.find(vt.group_id)
|
||||
sec = Section.find(grp.section_id);
|
||||
@sections << {"id"=>sec.id,"name"=>sec.name}
|
||||
end
|
||||
@allWidgets << {"id"=>dw.id, "data_category"=> "widget","title" => dw.name, "version" => dw.version, "author"=>dw.author, "last_update"=>dw.updated_at, "icon"=>dw.images.where(:name=>dw.icon).first.file.url, "sections" => @sections}
|
||||
end
|
||||
render :json=>@allWidgets.to_json
|
||||
end
|
||||
|
||||
def newpositions
|
||||
@newpositions = params[:newpositions]
|
||||
|
||||
|
@ -237,4 +262,26 @@ class DesktopController< ApplicationController
|
|||
render :xml=>feed
|
||||
end
|
||||
|
||||
def appactivation
|
||||
@group = Section.find(params[:section_id]).groups.first
|
||||
@widget = DesktopWidget.find(params[:widget_id])
|
||||
status = params[:status]
|
||||
|
||||
case status
|
||||
when "true"
|
||||
tile = Tile.new(data_category: "widget", position: 8, desktop_widget_id: @widget.id)
|
||||
@group.tiles+=[tile]
|
||||
@group.save
|
||||
when "false"
|
||||
tile = @group.tiles.where("desktop_widget_id"=>@widget.id).first
|
||||
if tile != nil
|
||||
tile.destroy
|
||||
end
|
||||
end
|
||||
|
||||
b = Array.new
|
||||
b = {"success"=>"true"}
|
||||
render :json=>b.to_json
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ class DesktopWidgetsController < OrbitBackendController
|
|||
require 'zip/zip'
|
||||
|
||||
def index
|
||||
@desktopWidgets = DesktopWidget.all
|
||||
end
|
||||
|
||||
def upload
|
||||
|
@ -21,6 +22,19 @@ class DesktopWidgetsController < OrbitBackendController
|
|||
temp_file.close
|
||||
end
|
||||
end
|
||||
def edit
|
||||
@dw = DesktopWidget.find(params[:id])
|
||||
end
|
||||
|
||||
def update
|
||||
@dw = DesktopWidget.find(params[:id])
|
||||
if(params[:desktop_widget])
|
||||
@imagefile = params[:desktop_widget][:image]
|
||||
@dw.images.build(:file => @imagefile)
|
||||
@dw.save
|
||||
end
|
||||
redirect_to action: "index"
|
||||
end
|
||||
|
||||
def unzip_widget(file, zip_name)
|
||||
Zip::ZipFile.open(file) { |zip_file|
|
||||
|
|
|
@ -6,8 +6,11 @@ class DesktopWidget
|
|||
field :name
|
||||
field :author
|
||||
field :shape
|
||||
field :fullsize, :type => Boolean
|
||||
field :fullsize, :type => Boolean, default: false
|
||||
field :version, :type => String
|
||||
field :text_color, :type => String, default: "#fff"
|
||||
field :bg_color, :type => String, default: "#fff"
|
||||
field :icon, default: "icon.png"
|
||||
|
||||
has_one :css_default, as: :css, :autosave => true, :dependent => :destroy
|
||||
has_one :widget_layout, :autosave => true, :dependent => :destroy
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
<div id="holder">
|
||||
<div id="group_wrapper" class="overview" content-layout="simple">
|
||||
<div id="app_info" class="admbg vp hp">
|
||||
<div id="app_info" class="admbg vp hp" style="display:none;">
|
||||
<div class="app_info_header s_grid_row hp">
|
||||
<div class="s_grid s_grid_3">
|
||||
<img class="app_info_icon" src="/assets/icons/wikibooks.png" alt="">
|
||||
|
@ -25,18 +25,18 @@
|
|||
</div>
|
||||
<ul class="app_info_list">
|
||||
<li class="s_grid_row">
|
||||
<label class="s_grid s_grid_3">Activation</label>
|
||||
<div class="s_grid s_grid_9 s_switch">
|
||||
<div class="s_switch_status" status-on="On" status-off="Off"></div>
|
||||
<!-- <label class="s_grid s_grid_3">Activation</label>
|
||||
<div class="s_grid s_grid_9 s_switch"> -->
|
||||
<!-- <div class="s_switch_status" status-on="On" status-off="Off"></div>
|
||||
<label class="s_switch_switcher">
|
||||
<input type="checkbox">
|
||||
</label>
|
||||
</div>
|
||||
</label> -->
|
||||
<!-- </div> -->
|
||||
</li>
|
||||
<li class="s_grid_row">
|
||||
<label class="s_grid s_grid_3">Description</label>
|
||||
<div class="s_grid s_grid_9">
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
|
||||
</div>
|
||||
</li>
|
||||
<li class="s_grid_row">
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
<div>
|
||||
<%= @dw.name %>
|
||||
|
||||
<h4>Upload Widget image </h4>
|
||||
<div class="main2">
|
||||
<%= form_for @dw, :url => desktop_widget_path(@dw) do |f| %>
|
||||
|
||||
<p>
|
||||
<%= f.file_field :image %>
|
||||
</p>
|
||||
<%= submit_tag %>
|
||||
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,10 @@
|
|||
<div>
|
||||
<ul>
|
||||
<% @desktopWidgets.each do |dw| %>
|
||||
<li> <%= dw.name %>
|
||||
<%= link_to "Delete", desktop_widget_path(dw), :method=>"delete" %>
|
||||
<%= link_to "Edit", edit_desktop_widget_path(dw) %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
|
@ -233,7 +233,7 @@ Orbit::Application.routes.draw do
|
|||
match "/desktop/compatibility" => "desktop#compatibility"
|
||||
match "desktop" => "desktop#index"
|
||||
match "/desktop/desktop" => "desktop#desktop"
|
||||
match '/desktop/desktop'=>'desktop#desktop'
|
||||
match '/desktop/appactivation'=>'desktop#appactivation'
|
||||
match '/desktop/app_manager'=>'desktop#app_manager'
|
||||
match '/desktop/allsections'=>'desktop#allsections'
|
||||
match '/desktop/settings'=>'desktop#settings'
|
||||
|
@ -244,6 +244,7 @@ Orbit::Application.routes.draw do
|
|||
match '/desktop/themes/'=>'desktop#themes'
|
||||
match '/desktop/sections/'=>'desktop#sections'
|
||||
match '/desktop/getapplist/'=>'desktop#getapplist'
|
||||
match '/desktop/getapplistforManager/'=>'desktop#getapplistforManager'
|
||||
match '/desktop/newpositions/'=>'desktop#newpositions'
|
||||
match '/desktop/connections/'=>'desktop#connections'
|
||||
match '/desktop/widget_layout' => 'desktop#widget_layout'
|
||||
|
|
Loading…
Reference in New Issue