add back buton in relation page
This commit is contained in:
parent
b4a99e58cf
commit
6d08ca996f
|
@ -16,18 +16,18 @@ class Desktop::CoAuthorRelationsController < ApplicationController
|
|||
end
|
||||
|
||||
def new
|
||||
@new_relation = CoAuthorRelation.new
|
||||
@co_author_relation = CoAuthorRelation.new
|
||||
end
|
||||
|
||||
def create
|
||||
@new_relation = CoAuthorRelation.new(params[:co_author_relation])
|
||||
@co_author_relation = CoAuthorRelation.new(params[:co_author_relation])
|
||||
@co_author_relations = CoAuthorRelation.all
|
||||
|
||||
if @new_relation.save
|
||||
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
|
||||
else
|
||||
error_msg = @new_relation.errors.full_messages.join("<br />")
|
||||
error_msg = @co_author_relation.errors.full_messages.join("<br />")
|
||||
render json: {success: false, msg: error_msg}.to_json
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,2 +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" %>
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
<%= form_for(@new_relation , url: desktop_co_author_relations_path, html:{"form-type"=>"ajax_form", "callback-method"=>"coauthorRelationForm"} ) do |f| %>
|
||||
<%= form_for(@co_author_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 %>
|
||||
|
|
Loading…
Reference in New Issue