gridster, url code fixed, views removed.

This commit is contained in:
Harry Bomrah 2013-02-23 15:23:24 +08:00 committed by chris
parent 3572856486
commit 9f362d9ae6
9 changed files with 3629 additions and 282 deletions

View File

@ -24,7 +24,7 @@ gem 'mongoid-tree', :require => 'mongoid/tree'
gem "mongo_session_store-rails3", '3.0.6'
gem 'nokogiri'
gem 'fb_graph'
gem 'radius'
gem 'rake'
# gem 'remotipart'

View File

@ -45,6 +45,7 @@ GEM
i18n (~> 0.6)
multi_json (~> 1.0)
arel (3.0.2)
attr_required (0.0.5)
bcrypt-ruby (3.0.0)
binding_of_caller (0.7.1)
debug_inspector (>= 0.0.1)
@ -121,6 +122,11 @@ GEM
i18n (~> 0.5)
fastercsv (1.5.5)
fattr (2.2.1)
fb_graph (2.6.4)
httpclient (>= 2.2.0.2)
multi_json (>= 1.3)
rack-oauth2 (>= 0.14.4)
tzinfo
ffi (1.4.0)
haml (3.1.8)
highline (1.6.15)
@ -188,6 +194,13 @@ GEM
rack (1.4.5)
rack-cache (1.2)
rack (>= 0.4)
rack-oauth2 (1.0.0)
activesupport (>= 2.3)
attr_required (>= 0.0.5)
httpclient (>= 2.2.0.2)
i18n
multi_json (>= 1.3.6)
rack (>= 1.1)
rack-protection (1.3.2)
rack
rack-ssl (1.3.3)
@ -339,6 +352,7 @@ DEPENDENCIES
execjs
factory_girl_rails
faker
fb_graph
impressionist!
jquery-rails (= 2.1.4)
jquery-ui-rails

View File

@ -14,4 +14,5 @@
//= require orbitdesktopAPI
//= require orbitTimeline
//= require orbitdesktop
//= require jquery.gridster
//= require desktop/books_pages

File diff suppressed because it is too large Load Diff

View File

@ -328,156 +328,191 @@ var orbitDesktop = function(dom){
this.initializeDesktop = function(target,url,cache){ //this is for initializing main desktops that are sections and tiles
if(!target)target = "desktop";
var bindHandlers = function(){ // this function will bind all the handlers in the desktop
var groupWrapperWidth = 0;
$("div#desktop .group").each(function(){groupWrapperWidth+=$(this).outerWidth(true);});
var grps = new Array;
$("div#desktop #group_wrapper").css("width",groupWrapperWidth);
var first = true;
$("div#desktop .g_col").sortable({
connectWith: ".g_col",
tolerance: 'pointer' ,
revert: 300,
containment: '#group_wrapper',
helper: 'clone',
stop:function(){
first = true;
var grpwidth = 0;
for(i in grps){
var grp = grps[i];
if(grp.find(".element").length == 0){
grp.animate({"width":"0px"},500,function(){$(this).remove();});
grpwidth+=225;
}
}
grps = [];
$("#group_wrapper").width($("#group_wrapper").width()-grpwidth);
},
start:function(){
$("#group_wrapper").find("div.group").each(function(i,par){
var nextnumber = $(this).find("ul").length;
$newcol = $('<ul class="g_col g_col_w2 col'+nextnumber+' ui-sortable">');
$(this).append($newcol);
$newcol.sortable({connectWith: '.g_col'});
grps.push($newcol);
$("#group_wrapper").width($("#group_wrapper").width()+225);
});
$("div#desktop .g_col").sortable('refresh');
},
update:function(){
if(first){
first = false;
var newpostitions = new Array;
var groupids = new Array;
$.each($("div#desktop .group"),function(i,grp){
var groupone = new Array;
groupids.push($(grp).attr("id"));
$ul = $(grp).find(".g_col .element");
$.each($ul,function(){
groupone.push($(this).attr("id"));
})
newpostitions.push(groupone);
});
$.post("/desktop/newpositions",{"sectionid":o.sectionId,"newpos":newpostitions,"groupids":groupids});
}
var s = $(this).find('.element').length;
if(s!=0){
last = $(this).find('.element').eq(s-1).position(),
lasth = $(this).find('.element').eq(s-1).outerHeight(true);
if ((last.top+lasth)>528){
$(this).sortable('cancel');
}
}
$("#group_wrapper ul").each(function(){
if($(this).find('.element').length == 0)
$(this).animate({"width":"0px"},500,function(){$(this).remove();});
})
},
receive: function(event, ui){
var s = $(this).find('.element').length,
last = $(this).find('.element').eq(s-1).position(),
lasth = $(this).find('.element').eq(s-1).outerHeight(true);
if ((last.top+lasth)>528){
$(ui.sender).sortable('cancel');
}
}
});
// var groupWrapperWidth = 0;
// $("div#desktop .group").each(function(){groupWrapperWidth+=$(this).outerWidth(true);});
// var grps = new Array;
// $("div#desktop #group_wrapper").css("width",groupWrapperWidth);
// var first = true;
// $("div#desktop .g_col").sortable({
// connectWith: ".g_col",
// tolerance: 'pointer' ,
// revert: 300,
// containment: '#group_wrapper',
// helper: 'clone',
// stop:function(){
// first = true;
// var grpwidth = 0;
// for(i in grps){
// var grp = grps[i];
// if(grp.find(".element").length == 0){
// grp.animate({"width":"0px"},500,function(){$(this).remove();});
// grpwidth+=225;
// }
// }
// grps = [];
// $("#group_wrapper").width($("#group_wrapper").width()-grpwidth);
// },
// start:function(){
// $("#group_wrapper").find("div.group").each(function(i,par){
// var nextnumber = $(this).find("ul").length;
// $newcol = $('<ul class="g_col g_col_w2 col'+nextnumber+' ui-sortable">');
// $(this).append($newcol);
// $newcol.sortable({connectWith: '.g_col'});
// grps.push($newcol);
// $("#group_wrapper").width($("#group_wrapper").width()+225);
// });
// $("div#desktop .g_col").sortable('refresh');
// },
// update:function(){
// if(first){
// first = false;
// var newpostitions = new Array;
// var groupids = new Array;
// $.each($("div#desktop .group"),function(i,grp){
// var groupone = new Array;
// groupids.push($(grp).attr("id"));
// $ul = $(grp).find(".g_col .element");
// $.each($ul,function(){
// groupone.push($(this).attr("id"));
// })
// newpostitions.push(groupone);
// });
// $.post("/desktop/newpositions",{"sectionid":o.sectionId,"newpos":newpostitions,"groupids":groupids});
// }
// var s = $(this).find('.element').length;
// if(s!=0){
// last = $(this).find('.element').eq(s-1).position(),
// lasth = $(this).find('.element').eq(s-1).outerHeight(true);
// if ((last.top+lasth)>528){
// $(this).sortable('cancel');
// }
// }
// $("#group_wrapper ul").each(function(){
// if($(this).find('.element').length == 0)
// $(this).animate({"width":"0px"},500,function(){$(this).remove();});
// })
// },
// receive: function(event, ui){
// var s = $(this).find('.element').length,
// last = $(this).find('.element').eq(s-1).position(),
// lasth = $(this).find('.element').eq(s-1).outerHeight(true);
// if ((last.top+lasth)>528){
// $(ui.sender).sortable('cancel');
// }
// }
// });
o.tinyscrollbar_ext({
main: '.tinycanvas'
})
o.simple_drop_down();
$("div#group_wrapper ul li[data-category=app]").click(function(){
o.appWindow({
title : $(this).find("a").attr("href"),
appid : $(this).find("a").attr("href")
});
});
// $("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(groups){
$.getJSON("/desktop/getgroups",{sectionid:id},function(tiles){
tiles.sort(o.sortJSON("position",true,parseInt));
var tilecolors = o.themesettings.tilecolor;
var opacity = ["op05","op06","op07","op08","op09"];
$.each(groups,function(i,group){
group.sort(o.sortJSON("position",true,parseInt));
// var $group = $('<div class="group"><ul class="grp ui-sortable"></ul></div>'),
var colindex = 0,
$group = $('<div class="group"></div>'),
$col = $('<ul class="g_col g_col_w2 col'+ colindex +'"/>'),
$li,
bdsum = 0,
bwsum = 0,
bhsum = 0,
small = 0,
single = false;
$group.append($col);
for(j=0;j<group.length;j++){
var tile = group[j];
var brick = tile.shape.replace(' holder_f','').split(' '),
bw = parseInt(brick[0].substr(1)),
bh = parseInt(brick[1].substr(1)),
bd = bw * bh;
if(bh==1 && bw==1){
small++;
}else if(bh!=1 && bw!=1){
single = true;
}
var row = 1,col = 1,x = 1,y = 1;
var $group = $('<div class="grid"></div>');
var $ul = $('<ul style="margin: -6px 0 0 -6px;"></ul>');
$.each(tiles,function(i,tile){
if(row >= 4){
row = 1;
col++;
}
if(small==2){
small=0;
single=false;
}else if(small==1 && single==true){
bh++;
small=0;
single=false;
}else{small=0;single=false;}
bdsum+=bd;
bwsum+=bw;
bhsum+=bh;
if(bdsum > 8 || bhsum > 6){
bdsum = 0, bhsum = 0, colindex++,j--;
$group.append('<ul class="g_col g_col_w2 col'+ colindex +'"/>');
}else{
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(j==0)$group.attr("id",tile.group_id);
if(tile.data_category == "app")
$li = $('<li data-id="'+tile.id+'" class="element '+tile.shape+' hp vp" 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>');
$li = $('<li data-id="'+tile.id+'" class="tile '+tilecolor+' '+op+'" data-row="'+row+'" data-col="'+col+'" data-sizex="'+x+'" data-sizey="'+y+'" data-category="'+tile.data_category+'" data-content="'+tile.data_content+'"><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="element '+tile.shape+' hp vp" 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><h1 class="appname thmtxt">'+tile.title+'</h1><div class="appholder">Loading...</div></li>');
$li = $('<li data-id="'+tile.id+'" class="tile '+tilecolor+' '+op+'" 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+'"><div class="appholder">Loading...</div><h1 class="appname thmtxt">'+tile.title+'</h1></li>');
$group.find('.col'+colindex).append($li);
}
}
$("div#desktop div#group_wrapper").append($group);
row = row + y;
$ul.append($li);
})
bindHandlers();
o.initializeWidgets();
$group.append($ul);
console.log($group);
$("div#desktop div#group_wrapper").append($group);
$(".grid ul").gridster({
widget_margins: [6, 6],
widget_base_dimensions: [120, 120]
});
bindHandlers();
o.initializeWidgets();
})
// var tilecolors = o.themesettings.tilecolor;
// var opacity = ["op05","op06","op07","op08","op09"];
// $.each(groups,function(i,group){
// group.sort(o.sortJSON("position",true,parseInt));
// // var $group = $('<div class="group"><ul class="grp ui-sortable"></ul></div>'),
// var colindex = 0,
// $group = $('<div class="group"></div>'),
// $col = $('<ul class="g_col g_col_w2 col'+ colindex +'"/>'),
// $li,
// bdsum = 0,
// bwsum = 0,
// bhsum = 0,
// small = 0,
// single = false;
// $group.append($col);
// for(j=0;j<group.length;j++){
// var tile = group[j];
// var brick = tile.shape.replace(' holder_f','').split(' '),
// bw = parseInt(brick[0].substr(1)),
// bh = parseInt(brick[1].substr(1)),
// bd = bw * bh;
// if(bh==1 && bw==1){
// small++;
// }else if(bh!=1 && bw!=1){
// single = true;
// }
// if(small==2){
// small=0;
// single=false;
// }else if(small==1 && single==true){
// bh++;
// small=0;
// single=false;
// }else{small=0;single=false;}
// bdsum+=bd;
// bwsum+=bw;
// bhsum+=bh;
// if(bdsum > 8 || bhsum > 6){
// bdsum = 0, bhsum = 0, colindex++,j--;
// $group.append('<ul class="g_col g_col_w2 col'+ colindex +'"/>');
// }else{
// var tilecolor = tilecolors[Math.floor(Math.random()*tilecolors.length)];
// var op = opacity[Math.floor(Math.random()*opacity.length)];
// if(j==0)$group.attr("id",tile.group_id);
// if(tile.data_category == "app")
// $li = $('<li data-id="'+tile.id+'" class="element '+tile.shape+' hp vp" 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="element '+tile.shape+' hp vp" 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><h1 class="appname thmtxt">'+tile.title+'</h1><div class="appholder">Loading...</div></li>');
// $group.find('.col'+colindex).append($li);
// }
// }
// $("div#desktop div#group_wrapper").append($group);
// })
// })
}
var loadSectionList = function(){ //This will load the section list from the db
$.getJSON("/desktop/getsectionlist",{desktopid:o.desktopId},function(sectionlist){
@ -1183,7 +1218,7 @@ var orbitDesktop = function(dom){
})
};
this.initializeWidgets = function(){ // this function will initialize all the widgets in the desktop
var elements = $("#group_wrapper li.element");
var elements = $("#group_wrapper li.tile");
$.each(elements,function(){
var widget = $(this);
if(widget.attr("data-category")=="widget"){

View File

@ -12,5 +12,6 @@
*= require desktopmedia
*= require orbitTimeline
*= require orbit-bar
*= require jquery.gridster
*= require icons
*/

View File

@ -0,0 +1,64 @@
/*! gridster.js - v0.1.0 - 2012-10-20
* http://gridster.net/
* Copyright (c) 2012 ducksboard; Licensed MIT */
.gridster {
position:relative;
}
.gridster > * {
margin: 0 auto;
-webkit-transition: height .4s;
-moz-transition: height .4s;
-o-transition: height .4s;
-ms-transition: height .4s;
transition: height .4s;
}
.gridster .gs_w{
z-index: 2;
position: absolute;
}
.ready .gs_w:not(.preview-holder) {
-webkit-transition: opacity .3s, left .3s, top .3s;
-moz-transition: opacity .3s, left .3s, top .3s;
-o-transition: opacity .3s, left .3s, top .3s;
transition: opacity .3s, left .3s, top .3s;
}
.ready .gs_w:not(.preview-holder) {
-webkit-transition: opacity .3s, left .3s, top .3s, width .3s, height .3s;
-moz-transition: opacity .3s, left .3s, top .3s, width .3s, height .3s;
-o-transition: opacity .3s, left .3s, top .3s, width .3s, height .3s;
transition: opacity .3s, left .3s, top .3s, width .3s, height .3s;
}
.gridster .preview-holder {
z-index: 1;
position: absolute;
background-color: #fff;
border-color: #fff;
opacity: 0.3;
}
.gridster .player-revert {
z-index: 10!important;
-webkit-transition: left .3s, top .3s!important;
-moz-transition: left .3s, top .3s!important;
-o-transition: left .3s, top .3s!important;
transition: left .3s, top .3s!important;
}
.gridster .dragging {
z-index: 10!important;
-webkit-transition: all 0s !important;
-moz-transition: all 0s !important;
-o-transition: all 0s !important;
transition: all 0s !important;
}
/* Uncomment this if you set helper : "clone" in draggable options */
/*.gridster .player {
opacity:0;
}*/

View File

@ -125,9 +125,9 @@ class DesktopController< ApplicationController
data_content = tile.data_content
title = tile.title
end
a << {"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}
end
gr << a
# gr << a
end
render :json =>gr.to_json
end

View File

@ -18,37 +18,37 @@ orbitDesktop.prototype.initializeJournalPapers = function(target,url,cache){ //
fill: '.list_t'
})
$("#journal_selection_options a").click(function(){
switch($(this).attr("href")){
case "all":
$(".list_item_action > .icon-check-empty").switchClass("icon-check-empty","icon-check",0);
break;
case "none":
$(".list_item_action > .icon-check").switchClass("icon-check","icon-check-empty",0);
break;
}
return false;
})
$("#journal_view_selection a").click(function(){
switch($(this).attr("href")){
case "journal":
journalview();
break;
case "keywords":
keywordsview();
break;
case "title":
titleview();
break;
case "abstract":
abstractview();
break;
case "file":
fileview();
break;
}
return false;
})
// $("#journal_selection_options a").click(function(){
// switch($(this).attr("href")){
// case "all":
// $(".list_item_action > .icon-check-empty").switchClass("icon-check-empty","icon-check",0);
// break;
// case "none":
// $(".list_item_action > .icon-check").switchClass("icon-check","icon-check-empty",0);
// break;
// }
// return false;
// })
// $("#journal_view_selection a").click(function(){
// switch($(this).attr("href")){
// case "journal":
// journalview();
// break;
// case "keywords":
// keywordsview();
// break;
// case "title":
// titleview();
// break;
// case "abstract":
// abstractview();
// break;
// case "file":
// fileview();
// break;
// }
// return false;
// })
}
var bindSecondaryHandlers = function(){
@ -67,123 +67,123 @@ orbitDesktop.prototype.initializeJournalPapers = function(target,url,cache){ //
}
var journalview = function(){
$("#journal_p div#paper_list div.overview").empty();
var column = $('<div class="g_col list_t"><ul></ul></div>'),
counter = 1,
li;
$.each(journalData,function(i,journal){
$.each(journal.papers,function(j,paper){
li = $('<li class="list_t_item"><div class="list_item_action"><a href="" class="icon-check-empty"></a><a href="" class="icon-star-empty"></a></div><div class="list_t_title">'+journal.title+'</div><div class="list_t_des">'+paper.title+'</div><div class="list_item_function"><a class="journal_paper_edit admbg2 admtxt" href="'+paper.url_edit+'" ajax-remote="get" >Edit</a> <a ajax-remote="delete" confirm-message="Are you sure?" callback-method="paperDelete" class="journal_paper_delete admbg2 admtxt" href="'+paper.url_delete+'">Delete</a></div></li>');
column.find("ul").append(li);
if(counter%5==0){
$("#journal_p div#paper_list div.overview").append(column);
column = $('<div class="g_col list_t"><ul></ul></div>');
}
counter++;
})
})
$("#journal_p div#paper_list div.overview").append(column);
bindSecondaryHandlers();
}
var fileview = function(){
$("#journal_p div#paper_list div.overview").empty();
var column = $('<div class="g_col list_t"><ul></ul></div>'),
counter = 1,
li = null;
$.each(journalData,function(i,journal){
$.each(journal.papers,function(j,paper){
li = null;
li = $('<li class="list_t_item file_view"></li>');
li.append('<div class="list_item_action"><a href="" class="icon-check-empty"></a><a href="" class="icon-star-empty"></a></div><div class="list_t_title">'+journal.title+'</div><div class="list_t_des"></div>');
var file_list = li.find('.list_t_des');
$.each(paper.files,function(k,file){
var thistitle = file.title;
if(!thistitle)
thistitle = "";
thistitle = ( thistitle.length > 8 )? thistitle.substring(0,8)+'...' : thistitle;
if(!file.title){
thistitle = "Untitled File";
}
var img = $('<a class="file" href="'+file.url+'" target="_blank" ><img src="'+file.icon+'" /><span class="filetitle">'+thistitle+'</span></a>');
file_list.append(img);
})
li.append('<div class="list_item_function"><a class="journal_paper_edit admbg2 admtxt" href="'+paper.url_edit+'" ajax-remote="get" >Edit</a> <a ajax-remote="delete" confirm-message="Are you sure?" callback-method="paperDelete" class="journal_paper_delete admbg2 admtxt" href="'+paper.url_delete+'">Delete</a></div>');
column.find("ul").append(li);
if(counter%3==0){
$("#journal_p div#paper_list div.overview").append(column);
column = $('<div class="g_col list_t"><ul></ul></div>');
}
counter++;
})
})
$("#journal_p div#paper_list div.overview").append(column);
bindSecondaryHandlers();
}
var keywordsview = function(){
$("#journal_p div#paper_list div.overview").empty();
var column = $('<div class="g_col list_t"><ul></ul></div>'),
counter = 1,
li;
$.each(journalData,function(i,journal){
$.each(journal.papers,function(j,paper){
li = $('<li class="list_t_item"><div class="list_item_action"><a href="" class="icon-check-empty"></a><a href="" class="icon-star-empty"></a></div><div class="list_t_title">'+paper.title+'</div><div class="list_t_des">'+paper.keywords+'</div><div class="list_item_function"><a class="journal_paper_edit admbg2 admtxt" href="'+paper.url_edit+'" ajax-remote="get" >Edit</a> <a ajax-remote="delete" confirm-message="Are you sure?" callback-method="paperDelete" class="journal_paper_delete admbg2 admtxt" href="'+paper.url_delete+'">Delete</a></div></li>');
column.find("ul").append(li);
if(counter%5==0){
$("#journal_p div#paper_list div.overview").append(column);
column = $('<div class="g_col list_t"><ul></ul></div>');
}
counter++;
})
})
$("#journal_p div#paper_list div.overview").append(column);
bindSecondaryHandlers();
}
// var journalview = function(){
// $("#journal_p div#paper_list div.overview").empty();
// var column = $('<div class="g_col list_t"><ul></ul></div>'),
// counter = 1,
// li;
// $.each(journalData,function(i,journal){
// $.each(journal.papers,function(j,paper){
// li = $('<li class="list_t_item"><div class="list_item_action"><a href="" class="icon-check-empty"></a><a href="" class="icon-star-empty"></a></div><div class="list_t_title">'+journal.title+'</div><div class="list_t_des">'+paper.title+'</div><div class="list_item_function"><a class="journal_paper_edit admbg2 admtxt" href="'+paper.url_edit+'" ajax-remote="get" >Edit</a> <a ajax-remote="delete" confirm-message="Are you sure?" callback-method="paperDelete" class="journal_paper_delete admbg2 admtxt" href="'+paper.url_delete+'">Delete</a></div></li>');
// column.find("ul").append(li);
// if(counter%5==0){
// $("#journal_p div#paper_list div.overview").append(column);
// column = $('<div class="g_col list_t"><ul></ul></div>');
// }
// counter++;
// })
// })
// $("#journal_p div#paper_list div.overview").append(column);
// bindSecondaryHandlers();
// }
// var fileview = function(){
// $("#journal_p div#paper_list div.overview").empty();
// var column = $('<div class="g_col list_t"><ul></ul></div>'),
// counter = 1,
// li = null;
// $.each(journalData,function(i,journal){
// $.each(journal.papers,function(j,paper){
// li = null;
// li = $('<li class="list_t_item file_view"></li>');
// li.append('<div class="list_item_action"><a href="" class="icon-check-empty"></a><a href="" class="icon-star-empty"></a></div><div class="list_t_title">'+journal.title+'</div><div class="list_t_des"></div>');
// var file_list = li.find('.list_t_des');
// $.each(paper.files,function(k,file){
// var thistitle = file.title;
// if(!thistitle)
// thistitle = "";
// thistitle = ( thistitle.length > 8 )? thistitle.substring(0,8)+'...' : thistitle;
// if(!file.title){
// thistitle = "Untitled File";
// }
// var img = $('<a class="file" href="'+file.url+'" target="_blank" ><img src="'+file.icon+'" /><span class="filetitle">'+thistitle+'</span></a>');
// file_list.append(img);
// })
// li.append('<div class="list_item_function"><a class="journal_paper_edit admbg2 admtxt" href="'+paper.url_edit+'" ajax-remote="get" >Edit</a> <a ajax-remote="delete" confirm-message="Are you sure?" callback-method="paperDelete" class="journal_paper_delete admbg2 admtxt" href="'+paper.url_delete+'">Delete</a></div>');
// column.find("ul").append(li);
// if(counter%3==0){
// $("#journal_p div#paper_list div.overview").append(column);
// column = $('<div class="g_col list_t"><ul></ul></div>');
// }
// counter++;
// })
// })
// $("#journal_p div#paper_list div.overview").append(column);
// bindSecondaryHandlers();
// }
// var keywordsview = function(){
// $("#journal_p div#paper_list div.overview").empty();
// var column = $('<div class="g_col list_t"><ul></ul></div>'),
// counter = 1,
// li;
// $.each(journalData,function(i,journal){
// $.each(journal.papers,function(j,paper){
// li = $('<li class="list_t_item"><div class="list_item_action"><a href="" class="icon-check-empty"></a><a href="" class="icon-star-empty"></a></div><div class="list_t_title">'+paper.title+'</div><div class="list_t_des">'+paper.keywords+'</div><div class="list_item_function"><a class="journal_paper_edit admbg2 admtxt" href="'+paper.url_edit+'" ajax-remote="get" >Edit</a> <a ajax-remote="delete" confirm-message="Are you sure?" callback-method="paperDelete" class="journal_paper_delete admbg2 admtxt" href="'+paper.url_delete+'">Delete</a></div></li>');
// column.find("ul").append(li);
// if(counter%5==0){
// $("#journal_p div#paper_list div.overview").append(column);
// column = $('<div class="g_col list_t"><ul></ul></div>');
// }
// counter++;
// })
// })
// $("#journal_p div#paper_list div.overview").append(column);
// bindSecondaryHandlers();
// }
var titleview = function(){
$("#journal_p div#paper_list div.overview").empty();
var column = $('<div class="g_col list_t"><ul></ul></div>'),
counter = 1,
li;
$.each(journalData,function(i,journal){
$.each(journal.papers,function(j,paper){
li = $('<li class="list_t_item"><div class="list_item_action"><a href="" class="icon-check-empty"></a><a href="" class="icon-star-empty"></a></div><div class="list_t_title">'+paper.title+'</div><div class="list_item_function"><a class="journal_paper_edit admbg2 admtxt" href="'+paper.url_edit+'" ajax-remote="get" >Edit</a> <a ajax-remote="delete" confirm-message="Are you sure?" callback-method="paperDelete" class="journal_paper_delete admbg2 admtxt" href="'+paper.url_delete+'">Delete</a></div></li>');
column.find("ul").append(li);
if(counter%5==0){
$("#journal_p div#paper_list div.overview").append(column);
column = $('<div class="g_col list_t"><ul></ul></div>');
}
counter++;
})
})
$("#journal_p div#paper_list div.overview").append(column);
bindSecondaryHandlers();
}
// var titleview = function(){
// $("#journal_p div#paper_list div.overview").empty();
// var column = $('<div class="g_col list_t"><ul></ul></div>'),
// counter = 1,
// li;
// $.each(journalData,function(i,journal){
// $.each(journal.papers,function(j,paper){
// li = $('<li class="list_t_item"><div class="list_item_action"><a href="" class="icon-check-empty"></a><a href="" class="icon-star-empty"></a></div><div class="list_t_title">'+paper.title+'</div><div class="list_item_function"><a class="journal_paper_edit admbg2 admtxt" href="'+paper.url_edit+'" ajax-remote="get" >Edit</a> <a ajax-remote="delete" confirm-message="Are you sure?" callback-method="paperDelete" class="journal_paper_delete admbg2 admtxt" href="'+paper.url_delete+'">Delete</a></div></li>');
// column.find("ul").append(li);
// if(counter%5==0){
// $("#journal_p div#paper_list div.overview").append(column);
// column = $('<div class="g_col list_t"><ul></ul></div>');
// }
// counter++;
// })
// })
// $("#journal_p div#paper_list div.overview").append(column);
// bindSecondaryHandlers();
// }
var abstractview = function(){
$("#journal_p div#paper_list div.overview").empty();
var column = $('<div class="g_col list_t"><ul></ul></div>'),
li;
$.each(journalData,function(i,journal){
$.each(journal.papers,function(j,paper){
li = $('<li class="list_t_item" style="height:auto;"><div class="list_item_action"><a href="" class="icon-check-empty"></a><a href="" class="icon-star-empty"></a></div><div class="list_t_title">'+paper.title+'</div><div class="list_t_des">'+paper.abstract+'</div><div class="list_item_function"><a class="journal_paper_edit admbg2 admtxt" href="'+paper.url_edit+'" ajax-remote="get" >Edit</a> <a ajax-remote="delete" confirm-message="Are you sure?" callback-method="paperDelete" class="journal_paper_delete admbg2 admtxt" href="'+paper.url_delete+'">Delete</a></div></li>');
column.find("ul").append(li);
$("#journal_p div#paper_list div.overview").append(column);
column = $('<div class="g_col list_t"><ul></ul></div>');
})
})
$("#journal_p div#paper_list div.overview").append(column);
bindSecondaryHandlers();
}
// var abstractview = function(){
// $("#journal_p div#paper_list div.overview").empty();
// var column = $('<div class="g_col list_t"><ul></ul></div>'),
// li;
// $.each(journalData,function(i,journal){
// $.each(journal.papers,function(j,paper){
// li = $('<li class="list_t_item" style="height:auto;"><div class="list_item_action"><a href="" class="icon-check-empty"></a><a href="" class="icon-star-empty"></a></div><div class="list_t_title">'+paper.title+'</div><div class="list_t_des">'+paper.abstract+'</div><div class="list_item_function"><a class="journal_paper_edit admbg2 admtxt" href="'+paper.url_edit+'" ajax-remote="get" >Edit</a> <a ajax-remote="delete" confirm-message="Are you sure?" callback-method="paperDelete" class="journal_paper_delete admbg2 admtxt" href="'+paper.url_delete+'">Delete</a></div></li>');
// column.find("ul").append(li);
// $("#journal_p div#paper_list div.overview").append(column);
// column = $('<div class="g_col list_t"><ul></ul></div>');
// })
// })
// $("#journal_p div#paper_list div.overview").append(column);
// bindSecondaryHandlers();
// }
var getData = function(){
$.getJSON("/panel/personal_journal/desktop/get_journals_json",function(journals){
journalData = eval(journals);
journalview();
bindHandlers();
})
}
getData();
// var getData = function(){
// $.getJSON("/panel/personal_journal/desktop/get_journals_json",function(journals){
// journalData = eval(journals);
// journalview();
// bindHandlers();
// })
// }
// getData();
}
this.initializeJournalPapers.paperDelete = function(data,dom){
var parent = dom.parent().parent();