diff --git a/app/assets/javascripts/desktop/journal_pages.js.erb b/app/assets/javascripts/desktop/journal_pages.js.erb
index 02406c73..dceffd3f 100644
--- a/app/assets/javascripts/desktop/journal_pages.js.erb
+++ b/app/assets/javascripts/desktop/journal_pages.js.erb
@@ -280,6 +280,21 @@ orbitDesktop.prototype.initializeJournalPapers = function(target,url,cache){ //
})
return false;
})
+ $("div[container=true]").unbind(".editype").on("click.edittype", "a.bt-edit-type", function(){
+ var parent = $(this).parent().parent();
+ $.ajax({
+ url : $(this).attr("href"),
+ type : "get",
+ success : function(data){
+ var prev_data = parent.find("td.form_space").html();
+ parent.find("td.form_space").html(data);
+ $(".bt-cancel-type").click(function(){
+ parent.find("td.form_space").html(prev_data);
+ })
+ }
+ })
+ return false;
+ })
$("div[container=true]").unbind(".delete").on("click.delete","a.bt-delete",function(){
var delurl = $(this).attr("href");
@@ -351,4 +366,12 @@ orbitDesktop.prototype.initializeJournalPapers = function(target,url,cache){ //
o.notify(data.msg,"alert");
}
}
+ this.initializeJournalPapers.coauthorRelationEditForm = function(data){
+ if(data.success){
+ o.notify(data.msg,"success");
+ $("#co_author_relation_table tbody").html(data.newvalue);
+ }else{
+ o.notify(data.msg,"alert");
+ }
+ }
};
diff --git a/app/controllers/desktop/co_author_relations_controller.rb b/app/controllers/desktop/co_author_relations_controller.rb
index 6ee8bce1..bc3eb451 100644
--- a/app/controllers/desktop/co_author_relations_controller.rb
+++ b/app/controllers/desktop/co_author_relations_controller.rb
@@ -25,7 +25,7 @@ class Desktop::CoAuthorRelationsController < ApplicationController
if @co_author_relation.save
newv = render_to_string partial: "show_form", object: @co_author_relations
- render json: {success: true, msg: "New Relation successfully saved!", newvalue: newv}.to_json
+ render json: {success: true, msg: "New Relation successfully saved!", newvalue: newvm}.to_json
else
error_msg = @co_author_relation.errors.full_messages.join("
")
render json: {success: false, msg: error_msg}.to_json
@@ -34,9 +34,10 @@ class Desktop::CoAuthorRelationsController < ApplicationController
def update
@co_author_relation = CoAuthorRelation.find(params[:id])
-
if @co_author_relation.update_attributes(params[:co_author_relation])
- render json: {success:true, msg: t('update.sucess.co_author')}.to_json
+ @co_author_relations = CoAuthorRelation.all
+ newv = render_to_string partial: "show_form", object: @co_author_relations
+ render json: {success: true, msg: "New Relation successfully updated!", newvalue: newv}.to_json
else
error_msg = @co_author.errors.full_messages.join("
")
render json: {success: false, msg: error_msg}.to_json
diff --git a/app/views/desktop/co_author_relations/_form.html.erb b/app/views/desktop/co_author_relations/_form.html.erb
index 37d49006..11a2944f 100644
--- a/app/views/desktop/co_author_relations/_form.html.erb
+++ b/app/views/desktop/co_author_relations/_form.html.erb
@@ -1,5 +1,5 @@
-<% if not @co_author_relation.new_record? %>
- <%= submit_tag "Cancel", :type => "button", class: "bt-cancel ini_input hp hh2 thmadm thmtxt" %>
-<% end %>
<%= f.text_field :relation %>
<%= f.submit "Save" %>
+<% if not @co_author_relation.new_record? %>
+ <%= submit_tag "Cancel", :type => "button", class: "bt-cancel-type" %>
+<% end %>
\ No newline at end of file
diff --git a/app/views/desktop/co_author_relations/_show_form.html.erb b/app/views/desktop/co_author_relations/_show_form.html.erb
index 36c9728a..9b478f90 100644
--- a/app/views/desktop/co_author_relations/_show_form.html.erb
+++ b/app/views/desktop/co_author_relations/_show_form.html.erb
@@ -1,7 +1,7 @@
<% @co_author_relations.each do |co_author_relation| %>