fixed new co-author relation bug....
This commit is contained in:
parent
00c8bca957
commit
3e752b94ec
|
@ -14,10 +14,11 @@ class Desktop::CoAuthorRelationsController < ApplicationController
|
||||||
|
|
||||||
def create
|
def create
|
||||||
@new_relation = CoAuthorRelation.new(params[:co_author_relation])
|
@new_relation = CoAuthorRelation.new(params[:co_author_relation])
|
||||||
|
@co_author_relations = CoAuthorRelation.all
|
||||||
|
|
||||||
if @new_relation.save
|
if @new_relation.save
|
||||||
newv = render_to_string :partial=>"show_form", :object=>@new_relation
|
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 = @new_relation.errors.full_messages.join("<br />")
|
||||||
render json: {success: false, msg: error_msg}.to_json
|
render json: {success: false, msg: error_msg}.to_json
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
|
<% @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 '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 %>
|
||||||
|
|
|
@ -12,8 +12,6 @@
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<% @co_author_relations.each do |co_author_relation| %>
|
<%= render :partial => 'show_form'%>
|
||||||
<%= render :partial => 'show_form', locals: {:co_author_relation => co_author_relation} %>
|
|
||||||
<% end %>
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
Loading…
Reference in New Issue