add back buton in relation page
This commit is contained in:
parent
476041510c
commit
270644a959
|
@ -16,18 +16,18 @@ class Desktop::CoAuthorRelationsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
@new_relation = CoAuthorRelation.new
|
@co_author_relation = CoAuthorRelation.new
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
@new_relation = CoAuthorRelation.new(params[:co_author_relation])
|
@co_author_relation = CoAuthorRelation.new(params[:co_author_relation])
|
||||||
@co_author_relations = CoAuthorRelation.all
|
@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
|
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: newv}.to_json
|
||||||
else
|
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
|
render json: {success: false, msg: error_msg}.to_json
|
||||||
end
|
end
|
||||||
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.text_field :relation %>
|
||||||
<%= f.submit "Save" %>
|
<%= 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}%>
|
<%= render partial: 'desktop/co_author_relations/form' , locals: {:f => f}%>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
Loading…
Reference in New Issue