diff --git a/app/controllers/desktop/co_author_relations_controller.rb b/app/controllers/desktop/co_author_relations_controller.rb
index cb01915e..d5f9d614 100644
--- a/app/controllers/desktop/co_author_relations_controller.rb
+++ b/app/controllers/desktop/co_author_relations_controller.rb
@@ -8,6 +8,10 @@ class Desktop::CoAuthorRelationsController < ApplicationController
end
end
+ def edit
+ @co_author_relation = CoAuthorRelation.find(params[:id])
+ end
+
def new
@new_relation = CoAuthorRelation.new
end
@@ -25,6 +29,17 @@ class Desktop::CoAuthorRelationsController < ApplicationController
end
end
+ 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
+ else
+ error_msg = @co_author.errors.full_messages.join("
")
+ render json: {success: false, msg: error_msg}.to_json
+ end
+ end
+
def destroy
@co_author_relation = CoAuthorRelation.find(params[:id])
@co_author_relation.destroy
diff --git a/app/views/desktop/co_author_relations/_form.html.erb b/app/views/desktop/co_author_relations/_form.html.erb
index a6d2b68e..04ebe5ed 100644
--- a/app/views/desktop/co_author_relations/_form.html.erb
+++ b/app/views/desktop/co_author_relations/_form.html.erb
@@ -1,4 +1,2 @@
-<%= 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 %>
+<%= f.text_field :relation %>
+<%= f.submit "Save" %>
diff --git a/app/views/desktop/co_author_relations/_new.html.erb b/app/views/desktop/co_author_relations/_new.html.erb
new file mode 100644
index 00000000..6e137c88
--- /dev/null
+++ b/app/views/desktop/co_author_relations/_new.html.erb
@@ -0,0 +1,3 @@
+<%= form_for(@new_relation , url: desktop_co_author_relations_path, html:{"form-type"=>"ajax_form", "callback-method"=>"coauthorRelationForm"} ) do |f| %>
+ <%= render partial: 'desktop/co_author_relations/form' , locals: {:f => f}%>
+<% end %>
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 d3c803d3..36c9728a 100644
--- a/app/views/desktop/co_author_relations/_show_form.html.erb
+++ b/app/views/desktop/co_author_relations/_show_form.html.erb
@@ -1,6 +1,7 @@
<% @co_author_relations.each do |co_author_relation| %>