new desktop framework updates

This commit is contained in:
Harry Bomrah 2012-12-27 18:25:54 +08:00
parent ad8273d638
commit 37f8c1637a
12 changed files with 180 additions and 256 deletions

View File

@ -15,3 +15,5 @@
//= require orbitTimeline
//= require orbitdesktop
//= require desktop/journal_pages
//= require desktop/seminar_pages
//= require desktop/books_pages

View File

@ -0,0 +1,33 @@
orbitDesktop.prototype.initializeBooks = function(target,url,cache){
this.initializeBooks.list = function(){
var bindHandlers = function(){
o.simple_drop_down();
o.tinyscrollbar_ext({
main: '.tinycanvas',
fill: '.list_t'
})
}
bindHandlers();
}
this.initializeBooks.addbook = function(){
var bindHandlers = function(){
o.simple_drop_down();
o.tinyscrollbar_ext({
main: '.tinycanvas',
fill: '.s_grid_con'
})
}
bindHandlers();
}
this.initializeBooks.list();
}

View File

@ -49,53 +49,6 @@ orbitDesktop.prototype.initializeJournalPapers = function(target,url,cache){ //
}
return false;
})
$("div[container=true]").unbind(".edit").on("click.edit",".journal_paper_edit",function(){
$.ajax({
url : $(this).attr("href"),
type : "get",
success : function(data){
var prev_data = $("div[container=true]").html();
$("div[container=true]").html(data);
o.tinyscrollbar_ext({
main: '.tinycanvas',
fill: '.s_grid_con'
})
$(".bt-cancel").click(function(){
$("div[container=true]").html(prev_data);
o.tinyscrollbar_ext({
main: '.tinycanvas',
fill: '.list_t'
})
})
}
})
return false;
})
$("div[container=true]").unbind(".delete").on("click.delete",".journal_paper_delete",function(){
var delurl = $(this).attr("href");
var parent = $(this).parent();
o.confirm({
buttons : ["Yes","No"],
highlighted : 2,
message : "Are you sure, you want to delete this paper?"
},function(value){
if(value){
$.ajax({
url : delurl,
type : "DELETE",
success : function(data){
if(data.success){
parent.hide("slide",function(){parent.remove();});
o.notify(data.msg,"success");
}
}
})
}
})
return false;
})
}
var bindSecondaryHandlers = function(){
@ -113,6 +66,7 @@ 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>'),
@ -120,7 +74,7 @@ orbitDesktop.prototype.initializeJournalPapers = function(target,url,cache){ //
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+'">Edit</a> <a class="journal_paper_delete admbg2 admtxt" href="'+paper.url_delete+'">Delete</a></div></li>');
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);
@ -154,7 +108,7 @@ orbitDesktop.prototype.initializeJournalPapers = function(target,url,cache){ //
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+'">Edit</a> <a class="journal_paper_delete admbg2 admtxt" href="'+paper.url_delete+'">Delete</a></div>');
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);
@ -173,7 +127,7 @@ orbitDesktop.prototype.initializeJournalPapers = function(target,url,cache){ //
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+'">Edit</a> <a class="journal_paper_delete admbg2 admtxt" href="'+paper.url_delete+'">Delete</a></div></li>');
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);
@ -193,7 +147,7 @@ orbitDesktop.prototype.initializeJournalPapers = function(target,url,cache){ //
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+'">Edit</a> <a class="journal_paper_delete admbg2 admtxt" href="'+paper.url_delete+'">Delete</a></div></li>');
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);
@ -212,7 +166,7 @@ orbitDesktop.prototype.initializeJournalPapers = function(target,url,cache){ //
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+'">Edit</a> <a class="journal_paper_delete admbg2 admtxt" href="'+paper.url_delete+'">Delete</a></div></li>');
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>');
@ -231,7 +185,13 @@ orbitDesktop.prototype.initializeJournalPapers = function(target,url,cache){ //
}
getData();
}
this.initializeJournalPapers.paperDelete = function(data,dom){
var parent = dom.parent().parent();
if(data.success){
parent.hide("slide",function(){parent.remove();});
o.notify(data.msg,"success");
}
}
this.initializeJournalPapers.addpaper = function(){ // to open add pages in journal papers page
var bindHandlers = function(){ // to bind handlers for add page
o.simple_drop_down();
@ -271,110 +231,7 @@ orbitDesktop.prototype.initializeJournalPapers = function(target,url,cache){ //
main: '.tinycanvas',
fill: '.g_col'
})
$("div[container=true]").unbind(".editcoauthor").on("click.editcoauthor", "a.bt-edit", function(){
$.ajax({
url : $(this).attr("href"),
type : "get",
success : function(data){
var prev_data = $("div[container=true]").html();
$("div[container=true]").html(data);
o.tinyscrollbar_ext({
main: '.tinycanvas',
fill: '.s_grid_con'
})
$(".bt-cancel").click(function(){
$("div[container=true]").html(prev_data);
o.tinyscrollbar_ext({
main: '.tinycanvas',
fill: '.g_col'
})
})
}
})
return false;
})
$("div[container=true]").unbind(".editype").on("click.edittype", "a.bt-edit-type", function(){
var parent = $(this).parent().parent();
parent.find('.list_item_function').hide();
$.ajax({
url : $(this).attr("href"),
type : "get",
success : function(data){
var prev_data = parent.find(".form_space").html();
parent.find(".form_space").html(data);
$(".bt-cancel-type").click(function(){
parent.find(".form_space").html(prev_data);
parent.find('.list_item_function').show();
});
}
})
return false;
})
$("div[container=true]").unbind(".delete").on("click.delete","a.bt-delete",function(){
var delurl = $(this).attr("href");
var parent = $(this).parent().parent();
o.confirm({
buttons : ["Yes","No"],
highlighted : 2,
message : "Are you sure, you want to delete this author?"
},function(value){
if(value){
$.ajax({
url : delurl,
type : "DELETE",
success : function(data){
if(data.success){
parent.hide("slide",function(){parent.remove();});
o.notify(data.msg,"success");
}
}
})
}
})
return false;
})
$("div[container=true]").unbind(".new_type").on("click.new_type","a.bt-new-type",function(){
$.ajax({
url : $(this).attr("href"),
type : "get",
success : function(data){
var prev_data = $("div[container=true]").html();
$("div[container=true]").html(data);
o.tinyscrollbar_ext({
main: '.tinycanvas',
fill: '.s_grid_con'
})
$(".bt-cancel").click(function(){
o.sub_menu_item($("div[content-type=menu] a[custom-load=coauthor]"));
})
}
})
return false;
})
$("div[container=true]").unbind(".bt-co-author").on("click.bt-co-author","a.bt-co-author",function(){
$.ajax({
url : $(this).attr("href"),
type : "get",
success : function(data){
var prev_data = $("div[container=true]").html();
$("div[container=true]").html(data);
o.tinyscrollbar_ext({
main: '.tinycanvas',
fill: '.s_grid_con'
})
$(".bt-cancel").click(function(){
$("div[container=true]").html(prev_data);
o.tinyscrollbar_ext({
main: '.tinycanvas',
fill: '.g_col'
})
})
}
})
return false;
})
}
bindHandlers();
}

View File

@ -0,0 +1,58 @@
orbitDesktop.prototype.initializeSeminar = function(target,url,cache){
this.initializeSeminar.list = function(){
var bindHandlers = function(){
o.tinyscrollbar_ext({
main : ".tinycanvas",
fill : ".list_t"
})
}
bindHandlers();
}
this.initializeSeminar.addseminar = function(){
var bindHandlers = function(){
o.simple_drop_down();
o.tinyscrollbar_ext({
main: '.tinycanvas',
fill: '.s_grid_con'
})
}
bindHandlers();
}
this.initializeSeminar.seminar = function(){
var bindHandlers = function(){
o.simple_drop_down();
o.tinyscrollbar_ext({
main: '.tinycanvas',
fill: '.s_grid_con'
})
}
bindHandlers();
}
this.initializeSeminar.rues = function(){
var bindHandlers = function(){
o.simple_drop_down();
o.tinyscrollbar_ext({
main: '.tinycanvas',
fill: '.s_grid_con'
})
}
bindHandlers();
}
this.initializeSeminar.list();
}

View File

@ -7,6 +7,9 @@
//load = true is used to load the list element by default
//response-type = "json"|"script"|"xml|html" default is json
//autocomplete-list = "listname" an array from which autocomplete will be attached to its respective input or textarea
//ajax-remote="get/delete/post" this will automatically bind the <a> with remote ajax call. By default if the resposne is html, it ll be inserted in container=true
// content-holder = "jquery dom", the returned html of server will be put inside the dom mentioned in content-holder of a tag. this can be used in a tags as attributes
//confirm-message ="Some message", this will prompt user with a confirm box and show the message before ajax call is made.
$.extend($.expr[':'], {
@ -147,6 +150,42 @@ var orbitDesktop = function(dom){
return false;
})
$("body").on("click","*[ajax-remote]",function(){
var $e = $(this);
var exe = $e.attr("callback-method"); // (typeof $e.attr("callback-method") == "function"? $e.attr("callback-method") : "");
var ca = $e.attr("content-holder");
var a = function(){
$.ajax({
type : $e.attr("ajax-remote"),
url : $e.attr("href"),
success : function(data){
if(typeof data == "string"){
if(ca)
$(ca).html(data);
else
$("div[container=true]").html(data);
}
if(exe)
window.o[o.data_method][exe](data,$e);
}
});
}
if($e.attr("confirm-message")){
o.confirm({
buttons : ["Yes","No"],
highlighted : 2,
message : $e.attr("confirm-message")
},function(value){
if(value){
a();
}
})
}else{
a();
}
return false;
})
$(window).resize(function(){
var ww = $(window).width();
$("img#thmbackground").attr({"width":ww});
@ -177,6 +216,7 @@ var orbitDesktop = function(dom){
var extractLast = function( term ) {
return split( term ).pop();
}
var autocompleteListName = null;
$("body").on("keydown","*[autocomplete-list]", function( event ) {
autocompleteListName = $(this).attr("autocomplete-list");
@ -1064,73 +1104,8 @@ var orbitDesktop = function(dom){
this.initializeAppstore.onlinestore();
bindHandlers();
}
this.initializeBooks = function(target,url,cache){
this.initializeBooks.list = function(){
var bindHandlers = function(){
o.simple_drop_down();
o.tinyscrollbar_ext({
main: '.tinycanvas',
fill: '.list_t'
})
}
bindHandlers();
}
this.initializeBooks.addbook = function(){
var bindHandlers = function(){
o.simple_drop_down();
o.tinyscrollbar_ext({
main: '.tinycanvas',
fill: '.s_grid_con'
})
}
bindHandlers();
}
this.initializeBooks.list();
}
this.initializeSeminar = function(target,url,cache){
this.initializeSeminar.list = function(){
var bindHandlers = function(){
o.tinyscrollbar_ext({
main : ".tinycanvas",
fill : ".list_t"
})
}
bindHandlers();
}
this.initializeSeminar.addseminar = function(){
var bindHandlers = function(){
o.simple_drop_down();
o.tinyscrollbar_ext({
main: '.tinycanvas',
fill: '.s_grid_con'
})
}
bindHandlers();
}
this.initializeSeminar.list();
}
this.initializeResearchDomain = function(target,url,cache){
this.initializeResearchDomain.list = function(){

View File

@ -3,7 +3,7 @@ class User
include Mongoid::Document
include Mongoid::Timestamps
devise :database_authenticatable, :recoverable, :rememberable, :trackable, :registerable, :validatable, :timeoutable
devise :database_authenticatable, :recoverable, :rememberable, :trackable, :registerable, :validatable #, :timeoutable
mount_uploader :avatar, AvatarUploader

View File

@ -13,7 +13,7 @@
<div id="panel_l" class="ph">
<div class="s_menu sm_v" content-type="menu">
<ul id='setting_left_nav'>
<li><a href="<%= desktop_publications_books_list_path %>" callback-method="harry"class="hh2 w2 hp active thmc1 thmtxt" onclick='return false;'>List</a></li>
<li><a href="<%= desktop_publications_books_list_path %>" callback-method="list" class="hh2 w2 hp active thmc1 thmtxt" onclick='return false;'>List</a></li>
<li><a href="<%= desktop_publications_books_add_path %>" callback-method="addbook" class="admtxt hh2 w2 hp" onclick='return false;'>Add/Edit</a></li>
<li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Books</a></li>
<li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Co-Authors</a></li>

View File

@ -4,10 +4,10 @@
<ul>
<% end %>
<li class="s_grid_row">
<div class="form_space"><%= co_author_relation.relation %></div>
<div class="form_space" id="form_space_<%= i.to_s %>"><%= co_author_relation.relation %></div>
<div class="list_item_function">
<%= link_to 'Edit', edit_desktop_co_author_relation_path(co_author_relation), :class => "bt-edit-type admbg2 admtxt" %>
<%= link_to 'Destroy', desktop_co_author_relation_path(co_author_relation), confirm: 'Are you sure?', method: :delete, :class=>"bt-delete admbg2 admtxt" %>
<%= link_to 'Edit', edit_desktop_co_author_relation_path(co_author_relation), :class => "bt-edit-type admbg2 admtxt", "content-holder"=>"#form_space_"+i.to_s, "ajax-remote"=>"get" %>
<%= link_to 'Destroy', desktop_co_author_relation_path(co_author_relation), "confirm-message"=>'Are you sure?', "ajax-remote"=>"delete", :class=>"bt-delete admbg2 admtxt" %>
</div>
</li>
<% if ( i % 6 ) == 5 %>

View File

@ -1,7 +1,7 @@
<div class="toolbar hh2">
<div class="fn_g hp">
<%= link_to "New Co-Author", new_desktop_co_author_path, :class=>"bt-co-author fn_btn hp hh2 thmc2 thmtxt" %>
<%= link_to "New Type", desktop_co_author_relations_path, :class=>"bt-new-type fn_btn hp hh2 thmc2 thmtxt" %>
<%= link_to "New Co-Author", new_desktop_co_author_path, :class=>"bt-co-author fn_btn hp hh2 thmc2 thmtxt", "ajax-remote"=>"get" %>
<%= link_to "New Type", desktop_co_author_relations_path, :class=>"bt-new-type fn_btn hp hh2 thmc2 thmtxt", "ajax-remote"=>"get" %>
</div>
</div>
<div id="co_author" class="tinycanvas vp">
@ -20,8 +20,8 @@
<li><div class="relations"><i class="icon-user"></i> <%= @co_author_relations.find(co_author.co_author_relations_id).relation unless co_author.co_author_relations_id.nil?%></div></li>
</ul>
<div class="list_item_function">
<%= link_to 'Edit', edit_desktop_co_author_path(co_author), :class => "bt-edit admbg2 admtxt" %>
<%= link_to 'Destroy', desktop_co_author_path(co_author), method: :delete, confirm: 'Are you sure?', :class=>"bt-delete admbg2 admtxt" %>
<%= link_to 'Edit', edit_desktop_co_author_path(co_author), :class => "bt-edit admbg2 admtxt", "ajax-remote"=>"get" %>
<%= link_to 'Destroy', desktop_co_author_path(co_author), "ajax-remote"=>"delete", "confirm-message"=>'Are you sure?', "callback-method"=>"paperDelete", :class=>"bt-delete admbg2 admtxt" %>
</div>
</li>
<% if ( i % 4 ) == 3 %>

View File

@ -13,11 +13,10 @@
<li class="dock_item"><a callback-method='initializeJournalPapers' href="<%= desktop_publications_journal_p_path %>" class="widget_fn wh3 hh3" id='d_journal_p' custom-load="journal" onclick="return false;"><span class="widget_icon"><img src="" alt="Journal Papers" id="journal_p_icon" width="30" height="30"/></span></a></li>
<li class="dock_item"><a callback-method='initializeSeminar' href="<%= desktop_publications_seminar_p_path %>" class="widget_fn wh3 hh3" id='d_seminar_p' onclick="return false;"><span class="widget_icon"><img src="" alt="Seminar Papers" id="seminar_p_icon" width="30" height="30"/></span></a></li>
<li class="dock_item"><a callback-method='initializeSeminar' href="<%= desktop_publications_seminar_p_path %>" class="widget_fn wh3 hh3" id='d_seminar_p' custom-load="seminar" onclick="return false;"><span class="widget_icon"><img src="" alt="Seminar Papers" id="seminar_p_icon" width="30" height="30"/></span></a></li>
<li class="dock_item"><a callback-method='initializeContact' href="<%= desktop_publications_books_path %>" class="widget_fn wh3 hh3" id='d_books' onclick="return false;"><span class="widget_icon"><img src="" alt="Books" id="books_icon" width="30" height="30"/></span></a></li>
<li class="dock_item"><a callback-method='initializeBooks' href="<%= desktop_publications_books_path %>" class="widget_fn wh3 hh3" id='d_books' onclick="return false;"><span class="widget_icon"><img src="" alt="Books" id="books_icon" width="30" height="30"/></span></a></li>
<li class="dock_item"><a callback-method='initializeContact' href="<%= desktop_publications_books_path %>" class="widget_fn wh3 hh3" id='d_contacts' onclick="return false;"><span class="widget_icon"><img src="" alt="Books" id="books_icon" width="30" height="30"/></span></a></li>
</ul>
</li>
<li class="d_cate"><a callback-method='' href="" class="widget_fn wh3 hh3" id='d_research' onclick="return false;"><span class="widget_icon"><img src="" alt="Research" id="research_icon" width="30" height="30"/></span></a>

View File

@ -14,9 +14,9 @@
<div class="s_menu sm_v" content-type="menu">
<ul id='setting_left_nav'>
<li><a href="<%= desktop_publications_seminar_p_list_path %>" callback-method="list" class="hh2 w2 hp active thmc1 thmtxt" onclick='return false;'>List</a></li>
<li><a href="<%= desktop_publications_seminar_p_add_path %>" callback-method="addseminar" class="admtxt hh2 w2 hp" onclick='return false;'>Add/Edit</a></li>
<li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Seminar</a></li>
<li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Co-Authors</a></li>
<li><a href="<%= desktop_publications_seminar_p_add_path %>" callback-method="addseminar" custom-load="add" class="admtxt hh2 w2 hp" onclick='return false;'>Add/Edit</a></li>
<li><a href="<%= desktop_publications_seminar_p_add_path %>" callback-method="seminar" class="admtxt hh2 w2 hp" onclick='return false;'>Seminar</a></li>
<li><a href="<%= desktop_publications_seminar_p_list_path %>" callback-method="rues" class="admtxt hh2 w2 hp" onclick='return false;'>Co-Authors</a></li>
<li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Tags &amp; Keywords</a></li>
<li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Analysis</a></li>
<li><a href="" class="admtxt hh2 w2 hp" onclick='return false;'>Import</a></li>