Merge branch 'publication' of https://github.com/Rulingcom/orbit into publication

* 'publication' of https://github.com/Rulingcom/orbit:
  new type fixed
This commit is contained in:
Rueshyna 2012-12-03 15:45:24 +08:00
commit 4ebb274d41
5 changed files with 18 additions and 11 deletions

View File

@ -281,7 +281,7 @@ orbitDesktop.prototype.initializeJournalPapers = function(target,url,cache){ //
}) })
return false; return false;
}) })
$("a.bt-delete").click(function(){ $("div[container=true]").unbind(".delete").on("click.delete","a.bt-delete",function(){
var delurl = $(this).attr("href"); var delurl = $(this).attr("href");
var parent = $(this).parent().parent(); var parent = $(this).parent().parent();
o.confirm({ o.confirm({
@ -346,6 +346,7 @@ orbitDesktop.prototype.initializeJournalPapers = function(target,url,cache){ //
this.initializeJournalPapers.coauthorRelationForm = function(data){ this.initializeJournalPapers.coauthorRelationForm = function(data){
if(data.success){ if(data.success){
o.notify(data.msg,"success"); o.notify(data.msg,"success");
$("#co_author_relation_table tbody").prepend(data.newvalue);
}else{ }else{
o.notify(data.msg,"alert"); o.notify(data.msg,"alert");
} }

View File

@ -16,7 +16,8 @@ class Desktop::CoAuthorRelationsController < ApplicationController
@new_relation = CoAuthorRelation.new(params[:co_author_relation]) @new_relation = CoAuthorRelation.new(params[:co_author_relation])
if @new_relation.save if @new_relation.save
render json: {success:true, msg: "New Relation successfully saved!"}.to_json newv = render_to_string :partial=>"show_form", :object=>@new_relation
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

View File

@ -1,6 +1,6 @@
<% @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><%= show_form.relation %></td>
<td><%= link_to 'Destroy', desktop_co_author_relation_path(co_author_relation), confirm: 'Are you sure?', method: :delete %></td> <td><%= link_to 'Destroy', desktop_co_author_relation_path(show_form), confirm: 'Are you sure?', method: :delete, :class=>"bt-delete" %></td>
</tr> </tr>
<% end %> <%# end %>

View File

@ -2,13 +2,15 @@
<%= render 'form' %> <%= render 'form' %>
<table> <table id="co_author_relation_table">
<thead>
<tr> <tr>
<th>Relation</th> <th>Relation</th>
<th></th> <th></th>
<th></th> <th></th>
</tr> </tr>
</thead>
<%= render 'show_form'%> <tbody>
<%= render :partial => 'show_form', :collection => @co_author_relations %>
</tbody>
</table> </table>

View File

@ -2,6 +2,7 @@
<%= link_to "New Co-Author", new_desktop_co_author_path, :class=>"bt-co-author" %> <%= link_to "New Co-Author", new_desktop_co_author_path, :class=>"bt-co-author" %>
<%= link_to "New Type", desktop_co_author_relations_path, :class=>"bt-new-type" %> <%= link_to "New Type", desktop_co_author_relations_path, :class=>"bt-new-type" %>
<table> <table>
<thead>
<tr> <tr>
<th>Name</th> <th>Name</th>
<th>EMail</th> <th>EMail</th>
@ -10,7 +11,8 @@
<th></th> <th></th>
<th></th> <th></th>
</tr> </tr>
</thead>
<tbody>
<% @co_authors.each do |co_author| %> <% @co_authors.each do |co_author| %>
<tr> <tr>
<td><%= co_author.co_author %></td> <td><%= co_author.co_author %></td>
@ -20,5 +22,6 @@
<td><%= link_to 'Destroy', desktop_co_author_path(co_author), method: :delete, confirm: 'Are you sure?', :class=>"bt-delete" %></td> <td><%= link_to 'Destroy', desktop_co_author_path(co_author), method: :delete, confirm: 'Are you sure?', :class=>"bt-delete" %></td>
</tr> </tr>
<% end %> <% end %>
</tbody>
</table> </table>
<br /> <br />