insert and remove columns

This commit is contained in:
Harry Bomrah 2013-03-07 19:15:30 +08:00 committed by Matt K. Fu
parent 84dfb44e78
commit d840b82fa9
2 changed files with 51 additions and 31 deletions

View File

@ -334,6 +334,55 @@ var orbitDesktop = function(dom){
})
}
}
this.insert_new_column = function(index){
var column_container = $("div[container=true] div.overview"),layout = column_container.attr("content-layout"),base_width = parseInt(column_container.attr("base-width")),column;
var i = (index == 0? 0 : index-1);
var previous_column = column_container.find(".column").eq(i);
if(previous_column.length == 0)return false;
switch(layout){
case "datalist":
column = $("<div class='column type_column' style='width:"+base_width+"px'></div");
break;
case "column":
column = $("<div class='column type_column' style='width:"+base_width+"px'></div");
break;
default:
return false;
break;
}
if(index == 0){
column.insertBefore(previous_column)
}else{
column.insertAfter(previous_column);
}
var total_columns = column_container.find(".column").length;
o.tinyscrollbar_ext({
main : ".tinycanvas",
fill : base_width * total_columns
})
return column;
}
this.remove_column = function(index){
var column_container = $("div[container=true] div.overview"),layout = column_container.attr("content-layout"),column = column_container.find(".column").eq(index),base_width = parseInt(column_container.attr("base-width"));
if(column.length == 0)return false;
switch(layout){
case "datalist":
case "column":
break;
default:
return false;
break;
}
column.remove();
var total_columns = column_container.find(".column").length;
o.tinyscrollbar_ext({
main : ".tinycanvas",
fill : base_width * total_columns
})
return column;
}
this.menu_item = function(dom,customload,submenuitem){
if(!customload)customload=false;
var target = dom.attr("id");
@ -790,9 +839,6 @@ var orbitDesktop = function(dom){
})
return false;
})
o.tinyscrollbar_ext({
main: '.tinycanvas'
})
}
var loadApps = function(){ //this load apps for sorting and searching
$.getJSON("/desktop/getapplist",{desktopid:o.desktopId},function(appss){
@ -927,17 +973,7 @@ var orbitDesktop = function(dom){
this.initializeSettings.sections = function(){ // this load section page in setting page
var bindHandlers = function(){ // binding handlers in section page
$('.tinycanvas').each(function(){
var h = $(this).parent().height(),
sh = $(this).siblings('.s_tab').height();
o.tinyscrollbar_ext({
main : $(this),
height : h-sh-24,
},{
axis : "y"
})
});
$("a#name_save_btn").click(function(){
var desktopnm = new Array;
$("#desktop_names input").each(function(){
@ -980,19 +1016,6 @@ var orbitDesktop = function(dom){
}
});
});
$('.tinycanvas').each(function(){
var h = $(this).parent().height(),
sh = $(this).siblings('.s_tab').height();
o.tinyscrollbar_ext({
main: $(this),
height: h-sh-24
},{
axis: 'y'
})
});
o.single_select();
o.simple_tab();
@ -1137,9 +1160,6 @@ var orbitDesktop = function(dom){
$('#connection_setting').width(conlist_w);
o.tinyscrollbar_ext({
main: '.tinycanvas'
})
}
var saveaccount = function(usernm,pwd,type,what){

View File

@ -77,7 +77,7 @@
<div class="sdm_t hh1"><span class="icon-question-sign"></span></div>
</div>
</div>
<div class="overview" content-layout="datalist" base-width="300" per-column="5">
<div class="overview" content-layout="datalist" base-width="300" per-column="1">
<% @writing_journals.each do |w| %>
<%= publication_record w, @view_by%>
<% end %>