diff --git a/app/assets/javascripts/desktop/journal_pages.js.erb b/app/assets/javascripts/desktop/journal_pages.js.erb index b0e52677..56aed19d 100644 --- a/app/assets/javascripts/desktop/journal_pages.js.erb +++ b/app/assets/javascripts/desktop/journal_pages.js.erb @@ -322,7 +322,32 @@ orbitDesktop.prototype.initializeJournalPapers = function(target,url,cache){ // }) return false; }) + $("a.bt-co-author").click(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); + }) + } + }) + return false; + }) } bindHandlers(); } + this.initializeJournalPapers.coauthorRelationForm = function(data){ + if(data.success){ + o.notify(data.msg,"success"); + }else{ + o.notify(data.msg,"alert"); + } + } }; diff --git a/app/views/desktop/co_author_relations/_form.html.erb b/app/views/desktop/co_author_relations/_form.html.erb index 33cb53e7..a6d2b68e 100644 --- a/app/views/desktop/co_author_relations/_form.html.erb +++ b/app/views/desktop/co_author_relations/_form.html.erb @@ -1,4 +1,4 @@ -<%= form_for(@new_relation , url: desktop_co_author_relations_path ) do |f| %> +<%= form_for(@new_relation , url: desktop_co_author_relations_path, html:{"form-type"=>"ajax_form", "callback-method"=>"coauthorRelationForm"} ) do |f| %> <%= f.text_field :relation %> <%= f.submit "Save" %> <% end %> diff --git a/app/views/desktop/co_authors/index.html.erb b/app/views/desktop/co_authors/index.html.erb index 0326d5e4..faf789c6 100644 --- a/app/views/desktop/co_authors/index.html.erb +++ b/app/views/desktop/co_authors/index.html.erb @@ -1,5 +1,5 @@