');
if( count > 4 ){
count = 1, colindex+=1;
$('#app_list').append('');
@@ -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(){
diff --git a/app/assets/stylesheets/desktop/desktop-main.css b/app/assets/stylesheets/desktop/desktop-main.css
index f1d42a54f..80a587e8c 100644
--- a/app/assets/stylesheets/desktop/desktop-main.css
+++ b/app/assets/stylesheets/desktop/desktop-main.css
@@ -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;
diff --git a/app/controllers/desktop_controller.rb b/app/controllers/desktop_controller.rb
index 882765f10..aedc752b7 100644
--- a/app/controllers/desktop_controller.rb
+++ b/app/controllers/desktop_controller.rb
@@ -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
+ fullsize = widge.fullsize
else
data_content = tile.data_content
title = tile.title
@@ -194,6 +192,33 @@ class DesktopController< ApplicationController
end
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]
@@ -236,5 +261,27 @@ class DesktopController< ApplicationController
feed = Net::HTTP.get_response(URI.parse("https://mail.google.com/mail/feed/atom")).body
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
diff --git a/app/controllers/desktop_widgets_controller.rb b/app/controllers/desktop_widgets_controller.rb
index 2605f3679..f52a58c99 100644
--- a/app/controllers/desktop_widgets_controller.rb
+++ b/app/controllers/desktop_widgets_controller.rb
@@ -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|
diff --git a/app/models/desktop/desktop_widget.rb b/app/models/desktop/desktop_widget.rb
index 879b40b68..ae2fd9b69 100644
--- a/app/models/desktop/desktop_widget.rb
+++ b/app/models/desktop/desktop_widget.rb
@@ -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
diff --git a/app/views/desktop/app_manager.html.erb b/app/views/desktop/app_manager.html.erb
index 70831dde7..44d199cc6 100644
--- a/app/views/desktop/app_manager.html.erb
+++ b/app/views/desktop/app_manager.html.erb
@@ -13,7 +13,7 @@
-
+
@@ -25,18 +25,18 @@
-
-
-
+
+
+
- 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.
diff --git a/app/views/desktop_widgets/edit.html.erb b/app/views/desktop_widgets/edit.html.erb
new file mode 100644
index 000000000..396ccff04
--- /dev/null
+++ b/app/views/desktop_widgets/edit.html.erb
@@ -0,0 +1,16 @@
+
\ No newline at end of file
diff --git a/app/views/desktop_widgets/index.html.erb b/app/views/desktop_widgets/index.html.erb
new file mode 100644
index 000000000..72e920723
--- /dev/null
+++ b/app/views/desktop_widgets/index.html.erb
@@ -0,0 +1,10 @@
+
\ No newline at end of file
diff --git a/config/routes.rb b/config/routes.rb
index 527c5aa0a..63dc7403e 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -200,7 +200,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'
@@ -211,6 +211,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'