Merge branch 'publication' of https://github.com/Rulingcom/orbit into publication
* 'publication' of https://github.com/Rulingcom/orbit: edit coauthor relation done
This commit is contained in:
commit
9db3b382b8
|
@ -280,6 +280,21 @@ orbitDesktop.prototype.initializeJournalPapers = function(target,url,cache){ //
|
|||
})
|
||||
return false;
|
||||
})
|
||||
$("div[container=true]").unbind(".editype").on("click.edittype", "a.bt-edit-type", function(){
|
||||
var parent = $(this).parent().parent();
|
||||
$.ajax({
|
||||
url : $(this).attr("href"),
|
||||
type : "get",
|
||||
success : function(data){
|
||||
var prev_data = parent.find("td.form_space").html();
|
||||
parent.find("td.form_space").html(data);
|
||||
$(".bt-cancel-type").click(function(){
|
||||
parent.find("td.form_space").html(prev_data);
|
||||
})
|
||||
}
|
||||
})
|
||||
return false;
|
||||
})
|
||||
$("div[container=true]").unbind(".delete").on("click.delete","a.bt-delete",function(){
|
||||
|
||||
var delurl = $(this).attr("href");
|
||||
|
@ -351,4 +366,12 @@ orbitDesktop.prototype.initializeJournalPapers = function(target,url,cache){ //
|
|||
o.notify(data.msg,"alert");
|
||||
}
|
||||
}
|
||||
this.initializeJournalPapers.coauthorRelationEditForm = function(data){
|
||||
if(data.success){
|
||||
o.notify(data.msg,"success");
|
||||
$("#co_author_relation_table tbody").html(data.newvalue);
|
||||
}else{
|
||||
o.notify(data.msg,"alert");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -25,7 +25,7 @@ class Desktop::CoAuthorRelationsController < ApplicationController
|
|||
|
||||
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
|
||||
render json: {success: true, msg: "New Relation successfully saved!", newvalue: newvm}.to_json
|
||||
else
|
||||
error_msg = @co_author_relation.errors.full_messages.join("<br />")
|
||||
render json: {success: false, msg: error_msg}.to_json
|
||||
|
@ -34,9 +34,10 @@ class Desktop::CoAuthorRelationsController < ApplicationController
|
|||
|
||||
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
|
||||
@co_author_relations = CoAuthorRelation.all
|
||||
newv = render_to_string partial: "show_form", object: @co_author_relations
|
||||
render json: {success: true, msg: "New Relation successfully updated!", newvalue: newv}.to_json
|
||||
else
|
||||
error_msg = @co_author.errors.full_messages.join("<br />")
|
||||
render json: {success: false, msg: error_msg}.to_json
|
||||
|
|
|
@ -1,5 +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" %>
|
||||
<% if not @co_author_relation.new_record? %>
|
||||
<%= submit_tag "Cancel", :type => "button", class: "bt-cancel-type" %>
|
||||
<% end %>
|
|
@ -1,7 +1,7 @@
|
|||
<% @co_author_relations.each do |co_author_relation| %>
|
||||
<tr>
|
||||
<td><%= co_author_relation.relation %></td>
|
||||
<td><%= link_to 'Edit', edit_desktop_co_author_relation_path(co_author_relation), :class => "bt-edit" %></td>
|
||||
<td class="form_space"><%= co_author_relation.relation %></td>
|
||||
<td><%= link_to 'Edit', edit_desktop_co_author_relation_path(co_author_relation), :class => "bt-edit-type" %></td>
|
||||
<td><%= link_to 'Destroy', desktop_co_author_relation_path(co_author_relation), confirm: 'Are you sure?', method: :delete, :class=>"bt-delete" %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
<%= form_for(@co_author_relation, url: desktop_co_author_relation_path(@co_author_relation), html:{"form-type"=>"ajax_form", "callback-method"=>"coauthorRelationForm"} ) do |f| %>
|
||||
<%= form_for(@co_author_relation, url: desktop_co_author_relation_path(@co_author_relation), html:{"form-type"=>"ajax_form", "callback-method"=>"coauthorRelationEditForm"} ) do |f| %>
|
||||
<%= render partial: 'desktop/co_author_relations/form' , locals: {:f => f}%>
|
||||
<% end %>
|
||||
|
|
Reference in New Issue