diff --git a/app/assets/javascripts/desktop.js b/app/assets/javascripts/desktop.js index de5f7f71..a0fad151 100644 --- a/app/assets/javascripts/desktop.js +++ b/app/assets/javascripts/desktop.js @@ -14,4 +14,6 @@ //= require orbitdesktopAPI //= require orbitTimeline //= require orbitdesktop -//= require desktop/journal_pages \ No newline at end of file +//= require desktop/journal_pages +//= require desktop/seminar_pages +//= require desktop/books_pages \ No newline at end of file diff --git a/app/assets/javascripts/desktop/books_pages.js.erb b/app/assets/javascripts/desktop/books_pages.js.erb new file mode 100644 index 00000000..48833ff8 --- /dev/null +++ b/app/assets/javascripts/desktop/books_pages.js.erb @@ -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(); + +} diff --git a/app/assets/javascripts/desktop/journal_pages.js.erb b/app/assets/javascripts/desktop/journal_pages.js.erb index e2ed7bd6..79f1d17e 100644 --- a/app/assets/javascripts/desktop/journal_pages.js.erb +++ b/app/assets/javascripts/desktop/journal_pages.js.erb @@ -49,55 +49,8 @@ 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(){ $("#journal_p div#paper_list a.icon-check-empty").click(function(){ if($(this).hasClass("icon-check-empty")){ @@ -113,6 +66,7 @@ orbitDesktop.prototype.initializeJournalPapers = function(target,url,cache){ // }) } + var journalview = function(){ $("#journal_p div#paper_list div.overview").empty(); var column = $('
'), @@ -120,7 +74,7 @@ orbitDesktop.prototype.initializeJournalPapers = function(target,url,cache){ // li; $.each(journalData,function(i,journal){ $.each(journal.papers,function(j,paper){ - li = $('
  • '+journal.title+'
    '+paper.title+'
    Edit Delete
  • '); + li = $('
  • '+journal.title+'
    '+paper.title+'
    Edit Delete
  • '); 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 = $(''+thistitle+''); file_list.append(img); }) - li.append('
    Edit Delete
    '); + li.append('
    Edit Delete
    '); 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 = $('
  • '+paper.title+'
    '+paper.keywords+'
    Edit Delete
  • '); + li = $('
  • '+paper.title+'
    '+paper.keywords+'
    Edit Delete
  • '); 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 = $('
  • '+paper.title+'
    Edit Delete
  • '); + li = $('
  • '+paper.title+'
    Edit Delete
  • '); 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 = $('
  • '+paper.title+'
    '+paper.abstract+'
    Edit Delete
  • '); + li = $('
  • '+paper.title+'
    '+paper.abstract+'
    Edit Delete
  • '); column.find("ul").append(li); $("#journal_p div#paper_list div.overview").append(column); column = $('
    '); @@ -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(); } diff --git a/app/assets/javascripts/desktop/seminar_pages.js.erb b/app/assets/javascripts/desktop/seminar_pages.js.erb new file mode 100644 index 00000000..ebe62c18 --- /dev/null +++ b/app/assets/javascripts/desktop/seminar_pages.js.erb @@ -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(); + + } \ No newline at end of file diff --git a/app/assets/javascripts/orbitdesktop.js b/app/assets/javascripts/orbitdesktop.js index e10a6604..7ae36978 100755 --- a/app/assets/javascripts/orbitdesktop.js +++ b/app/assets/javascripts/orbitdesktop.js @@ -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 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(){ diff --git a/app/models/user/user.rb b/app/models/user/user.rb index 42254d10..966fe5ce 100644 --- a/app/models/user/user.rb +++ b/app/models/user/user.rb @@ -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 diff --git a/app/views/desktop/books.html.erb b/app/views/desktop/books.html.erb index b2c703ea..80990dc9 100644 --- a/app/views/desktop/books.html.erb +++ b/app/views/desktop/books.html.erb @@ -13,8 +13,8 @@
    - <%= 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" %>
    <% if ( i % 4 ) == 3 %> diff --git a/app/views/desktop/index.html.erb b/app/views/desktop/index.html.erb index 3559dc35..9ce9df2f 100644 --- a/app/views/desktop/index.html.erb +++ b/app/views/desktop/index.html.erb @@ -13,11 +13,10 @@
  • Journal Papers
  • -
  • Seminar Papers
  • +
  • Seminar Papers
  • -
  • Books
  • +
  • Books
  • -
  • Books
  • Research diff --git a/app/views/desktop/journal_p.html.erb b/app/views/desktop/journal_p.html.erb index 37a0aed1..d5526450 100644 --- a/app/views/desktop/journal_p.html.erb +++ b/app/views/desktop/journal_p.html.erb @@ -16,7 +16,7 @@
  • List
  • Add/Edit
  • Journals
  • -
  • Co-Authors
  • +
  • Co-Authors
  • Tags & Keywords
  • Analysis
  • Import
  • diff --git a/app/views/desktop/seminar_p.html.erb b/app/views/desktop/seminar_p.html.erb index c79939cf..80875dc9 100644 --- a/app/views/desktop/seminar_p.html.erb +++ b/app/views/desktop/seminar_p.html.erb @@ -14,9 +14,9 @@