make coauthor relation can be edit
This commit is contained in:
parent
8d110cce91
commit
e7fdac1d23
|
@ -8,6 +8,10 @@ class Desktop::CoAuthorRelationsController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def edit
|
||||||
|
@co_author_relation = CoAuthorRelation.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
@new_relation = CoAuthorRelation.new
|
@new_relation = CoAuthorRelation.new
|
||||||
end
|
end
|
||||||
|
@ -25,6 +29,17 @@ class Desktop::CoAuthorRelationsController < ApplicationController
|
||||||
end
|
end
|
||||||
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("<br />")
|
||||||
|
render json: {success: false, msg: error_msg}.to_json
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
@co_author_relation = CoAuthorRelation.find(params[:id])
|
@co_author_relation = CoAuthorRelation.find(params[:id])
|
||||||
@co_author_relation.destroy
|
@co_author_relation.destroy
|
||||||
|
|
|
@ -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.text_field :relation %>
|
<%= f.submit "Save" %>
|
||||||
<%= f.submit "Save" %>
|
|
||||||
<% end %>
|
|
||||||
|
|
|
@ -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 %>
|
|
@ -1,6 +1,7 @@
|
||||||
<% @co_author_relations.each do |co_author_relation| %>
|
<% @co_author_relations.each do |co_author_relation| %>
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= co_author_relation.relation %></td>
|
<td><%= co_author_relation.relation %></td>
|
||||||
|
<td><%= link_to 'Edit', edit_desktop_co_author_relation_path(co_author_relation), :class => "bt-edit" %></td>
|
||||||
<td><%= link_to 'Destroy', desktop_co_author_relation_path(co_author_relation), confirm: 'Are you sure?', method: :delete, :class=>"bt-delete" %></td>
|
<td><%= link_to 'Destroy', desktop_co_author_relation_path(co_author_relation), confirm: 'Are you sure?', method: :delete, :class=>"bt-delete" %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
<%= form_for(@co_author_relations, url: desktop_co_author_relation_path(@co_author_relations), html:{"form-type"=>"ajax_form", "callback-method"=>"coauthorRelationForm"} ) do |f| %>
|
||||||
|
<%= render partial: 'desktop/co_author_relations/form' , locals: {:f => f}%>
|
||||||
|
<% end %>
|
|
@ -1,7 +1,7 @@
|
||||||
<h1>Listing co_author_relations</h1>
|
<h1>Listing co_author_relations</h1>
|
||||||
|
|
||||||
<%= submit_tag "Back", :type => "button", class: "bt-cancel fn_btn hh2 thmc2 thmtxt" %>
|
<%= submit_tag "Back", :type => "button", class: "bt-cancel fn_btn hh2 thmc2 thmtxt" %>
|
||||||
<%= render 'form' %>
|
<%= render 'new' %>
|
||||||
|
|
||||||
<table id="co_author_relation_table">
|
<table id="co_author_relation_table">
|
||||||
<thead>
|
<thead>
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
<%= form_for @co_author, html: { multipart: true ,"form-type"=>"ajax_form", "callback-method"=>"coAuthorformCallback"} , url: desktop_co_author_path(@co_author) do |f| %>
|
<%= form_for @co_author_relation, html: { multipart: true ,"form-type"=>"ajax_form", "callback-method"=>"coAuthorformCallback"} , url: desktop_co_author_path(@co_author_relation) do |f| %>
|
||||||
<%= render partial: 'desktop/co_authors/form', locals: {:f => f} %>
|
<%= render partial: 'desktop/co_authors/form', locals: {:f => f} %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
<%= form_for @co_author, html: { multipart: true ,"form-type"=>"ajax_form", "callback-method"=>"coAuthorformCallback"} , url: desktop_co_authors_path do |f| %>
|
<%= form_for @co_author, html: { multipart: true ,"form-type"=>"ajax_form", "callback-method"=>"coAuthorformCallback"} , url: desktop_co_authors_path do |f| %>
|
||||||
<%= render partial: 'desktop/co_authors/form', locals: {:f => f} %>
|
<%= render partial: 'desktop/co_author_relations/form', locals: {:f => f} %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
Loading…
Reference in New Issue