simple component update

minor update
This commit is contained in:
devin chen 2013-06-06 14:11:55 +08:00 committed by saurabhbhatia
parent 2b12a4775c
commit ac58b993c2
4 changed files with 60 additions and 47 deletions

View File

@ -1072,7 +1072,7 @@ var orbitDesktop = function(dom){
var $app; var $app;
count++; count++;
elementSettingsData[app.id] = {"sections" : app.sections}; elementSettingsData[app.id] = {"sections" : app.sections};
$app = $('<div class="element w1 h1 thmc2" data-type="'+app.data_category+'" data-author="'+app.author+'" data-version="'+app.version+'" data-update="'+app.last_update+'" data-id="'+app.id+'" data-text-color="'+app.text_color+'" data-background="'+app.background+'" ><span class="tile thmc2"></span><a href="'+app.id+'" class="appicon"><img src="'+app.icon+'" alt="" onclick="return false;"></a><h1 class="appname thmtxt text_ofl"><span>'+app.title+'</span></h1></div>'); $app = $('<div class="element w1 h1 thmc2" data-type="'+app.data_category+'" data-title="'+app.title+'" data-author="'+app.author+'" data-version="'+app.version+'" data-update="'+app.last_update+'" data-id="'+app.id+'" data-text-color="'+app.text_color+'" data-background="'+app.background+'" ><span class="tile thmc2"></span><a href="'+app.id+'" class="appicon"><img src="'+app.icon+'" alt="" onclick="return false;"></a><h1 class="appname thmtxt text_ofl"><span>'+app.title+'</span></h1></div>');
if( count > 4 ){ if( count > 4 ){
count = 1, colindex+=1; count = 1, colindex+=1;
$('#app_list').append('<div class="g_col g_col_w1 col'+ colindex +'"/>'); $('#app_list').append('<div class="g_col g_col_w1 col'+ colindex +'"/>');
@ -1286,8 +1286,6 @@ var orbitDesktop = function(dom){
} }
}); });
}); });
o.single_select();
o.simple_tab();
$('.color-picker').miniColors({ $('.color-picker').miniColors({
change:function(hex){ change:function(hex){
@ -1338,7 +1336,10 @@ var orbitDesktop = function(dom){
$(".stock_wallpaper .ssl_item").click(function(){ $(".stock_wallpaper .ssl_item").click(function(){
var wallpapername = $(this).find("img").attr("alt"); var wallpapername = $(this).find("img").attr("alt");
o.changeWallpaper(wallpapername); o.changeWallpaper(wallpapername);
}) });
o.single_select();
o.simple_tab();
} }
var loadthmc = function(){ // a general function to load the themecolor in color selector var loadthmc = function(){ // a general function to load the themecolor in color selector
$('.color-picker').each(function(){ $('.color-picker').each(function(){
@ -1361,19 +1362,19 @@ var orbitDesktop = function(dom){
color = $('#theme_preview_area .'+cc).css(hex); color = $('#theme_preview_area .'+cc).css(hex);
$(this).miniColors("value", o.rgb2hex(color)); $(this).miniColors("value", o.rgb2hex(color));
}); });
} };
$.getJSON("/desktop/get_desktop_settings",{"get":"theme","desktopid":o.desktopId},function(theme){ $.getJSON("/desktop/get_desktop_settings",{"get":"theme","desktopid":o.desktopId},function(theme){
$('#st1 .theme_list [id='+theme+']') $('#st1 .theme_list [id='+theme+']')
.addClass("thmc1 active", 300) .addClass("thmc1 active", 300)
.find("span") .find("span")
.addClass("thmtxt"); .addClass("thmtxt");
bindHandlers();
loadthmc();
})
bindHandlers();
loadthmc();
});
} }
this.initializeSettings.connection = function(){ this.initializeSettings.connection = function(){
@ -1612,7 +1613,6 @@ var orbitDesktop = function(dom){
} else { } else {
$("#thmbackground").css("background-image","url("+o.wallpaperPath+wallpaper+")"); $("#thmbackground").css("background-image","url("+o.wallpaperPath+wallpaper+")");
} }
console.log('loaded');
}; };
this.loadIconCache = function(){ // this function load or refresh icon cache for the theme this.loadIconCache = function(){ // this function load or refresh icon cache for the theme
@ -1707,6 +1707,7 @@ var orbitDesktop = function(dom){
// ** not sure to update canvas here ( $.tinyscrollbar_update() ) // ** not sure to update canvas here ( $.tinyscrollbar_update() )
var sw = 0, var sw = 0,
$simple_layout = $('#content .overview[content-layout=simple]'); $simple_layout = $('#content .overview[content-layout=simple]');
if($simple_layout.find(".s_column").length > 0){ if($simple_layout.find(".s_column").length > 0){
$simple_layout.each(function(){ $simple_layout.each(function(){
$(this).find(".s_column").filter(":visible").each(function(){ $(this).find(".s_column").filter(":visible").each(function(){
@ -1733,46 +1734,64 @@ var orbitDesktop = function(dom){
}; };
this.simple_tab = function(){ this.simple_tab = function(){
// tab // tab
var $anchor = $('.s_tab a[href*=#]'), var active = 'thmc2 thmtxt',
$tabcontent = $('.st_c'); normal = 'admtxt admbg';
$anchor.each(function(){ $('.s_tab').each(function(){
$(this).click(function(){ var $anchor = $(this).find('a[href*=#]'),
var target = $(this).attr('href'); $current_tab = $anchor.filter('[data-active="true"]');
$anchor.removeClass('thmc2 thmtxt admtxt admbg').addClass('admtxt admbg');
$(this).toggleClass('thmc2 thmtxt admtxt admbg'); // initialize
$tabcontent.hide(); $current_tab.switchClass(normal,active,300);
$(target).show(); $($current_tab.attr('href')).show();
if( $('.tinycanvas').length > 0 ){
$('.tinycanvas').tinyscrollbar_update(); $anchor.each(function(){
} $(this).click(function(){
return false; var target = $(this).attr('href');
$anchor.switchClass(active,normal,200);
$(this)
.switchClass(normal,active,200)
.parents('.s_tab')
.find('a[href*=#]').not('a[href*='+target+']')
.switchClass(active,normal,200);
$(target)
.siblings('.st_c')
.hide()
.end()
.show();
if( $(target).parents('.tinycanvas').length > 0 ){
$(target).parents('.tinycanvas').tinyscrollbar_update();
}
return false;
});
}); });
}); });
}; };
this.simple_switch = function(func){ this.simple_switch = function(func){
$('.s_switch').each(function(){ $('.s_switch').each(function(){
var $switcher = $(this).find('.s_switch_switcher'), var switcher = $(this).find('.s_switch_switcher'),
$checkbox = $(this).find('input[type=checkbox]'), checkbox = $(this).find('input[type=checkbox]'),
$status = $(this).find('.s_switch_status'), status = $(this).find('.s_switch_status'),
toggle = '<span class="s_switch_toggle"></span>', toggle = '<span class="s_switch_toggle"></span>',
status_on = $status.attr('status-on'), text_on = status.attr('status-on'),
status_off = $status.attr('status-off'), text_off = status.attr('status-off'),
status_on = 'thmc2',
status_off = 'admbg2',
ini, set; ini, set;
ini = ($switcher.hasClass('admbg2')) ? null : $switcher.addClass('admbg2'); ini = switcher.hasClass(status_off) ? null : switcher.addClass(status_off);
ini = ($switcher.find('.s_switch_toggle').length < 1) ? $checkbox.after(toggle) : null; ini = switcher.find('.s_switch_toggle').length < 1 ? checkbox.after(toggle) : null;
set = ($checkbox.is(':checked')) ? $status.text(status_on) : $status.text(status_off); set = checkbox.is(':checked') ? status.text(text_on) : status.text(text_off);
$checkbox.unbind().change(function(){ checkbox.unbind().change(function(){
var v = $(this).attr('checked'); var v = $(this).attr('checked');
switch (v) { switch (v) {
case 'checked': case 'checked':
$switcher.switchClass('admbg2','thmc2'); switcher.switchClass(status_off,status_on);
$status.text(status_on); status.text(text_on);
break; break;
case undefined: case undefined:
$switcher.switchClass('thmc2','admbg2'); switcher.switchClass(status_on,status_off);
$status.text(status_off); status.text(text_off);
break; break;
} }
if(typeof func == "function"){ if(typeof func == "function"){

View File

@ -157,8 +157,6 @@
.st_c { .st_c {
display: none; } display: none; }
.st_c:first-child {
display: block; }
/* simple form */ /* simple form */
.s_form { .s_form {

View File

@ -127,10 +127,6 @@
.stb_v {} .stb_v {}
.st_c { .st_c {
display: none; display: none;
&:first-child {
display: block;
}
} }
/* simple form */ /* simple form */

View File

@ -1,12 +1,12 @@
<div class="s_tab stb_h"> <div class="s_tab stb_h">
<ul> <ul>
<li><a href="#st1" class="hh1 hp thmtxt thmc2">Themes</a></li> <li><a href="#st1" class="hh1 hp admtxt admbg" data-active="true">Themes</a></li>
<li><a href="#st2" class="hh1 hp admtxt admbg">Theme Color</a></li> <li><a href="#st2" class="hh1 hp admtxt admbg">Theme Color</a></li>
<li><a href="#st3" class="hh1 hp admtxt admbg">Wallpaper</a></li> <li><a href="#st3" class="hh1 hp admtxt admbg">Wallpaper</a></li>
</ul> </ul>
</div> </div>
<div class="overview" content-layout="simple"> <div class="overview tab_holder" content-layout="simple">
<div id="st1" class="st_c"> <div id="st1" class="st_c">
<div class="theme_list ssl"> <div class="theme_list ssl">
<% @themes.each do |theme| %> <% @themes.each do |theme| %>