diff --git a/app/controllers/homework_attach_controller.rb b/app/controllers/homework_attach_controller.rb index a143fe4aa..d601d32a1 100644 --- a/app/controllers/homework_attach_controller.rb +++ b/app/controllers/homework_attach_controller.rb @@ -112,7 +112,7 @@ class HomeworkAttachController < ApplicationController #获取作业的留言列表 def get_homework_jours - #@user = @bid.author + @user = @bid.author @jours = @bid.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC') @jour = paginateHelper @jours,10 @state = false diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index c6a5d2819..8797474ec 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -82,7 +82,12 @@ class WordsController < ApplicationController def destroy @journal_destroyed = JournalsForMessage.delete_message(params[:object_id]) - + if @journal_destroyed.jour_type == "Bid" + @bid = Bid.find(@journal_destroyed.jour_id) + end + if @bid + @jours_count = @bid.journals_for_messages.where('m_parent_id IS NULL').count + end respond_to do |format| format.js #format.api { render_api_ok } diff --git a/app/views/homework_attach/_history.erb b/app/views/homework_attach/_history.erb index 299ba1aa5..c235e0867 100644 --- a/app/views/homework_attach/_history.erb +++ b/app/views/homework_attach/_history.erb @@ -26,7 +26,7 @@
<% ids = 'project_respond_form_'+ journal.id.to_s%> - <% if @user==User.current|| User.current.admin? %> + <% if journal.user == User.current|| User.current.admin? %> <%= link_to(l(:label_bid_respond_delete), {:controller => 'words', :action => 'destroy', :object_id => journal, :user_id => @user}, :remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', diff --git a/app/views/words/destroy.js.erb b/app/views/words/destroy.js.erb index af1740b7a..d00db0695 100644 --- a/app/views/words/destroy.js.erb +++ b/app/views/words/destroy.js.erb @@ -1,10 +1,13 @@ <% if @journal_destroyed.nil? %> alert('<%=l(:notice_failed_delete)%>'); <% elsif (['Principal','Project','Course', 'Bid', 'Contest', 'Softapplication'].include? @journal_destroyed.jour_type)%> - var destroyedItem = $('#word_li_<%=@journal_destroyed.id%>') - destroyedItem.fadeOut(600,function(){ - destroyedItem.remove(); - }); + <% if @jours_count %> + $('#jours_count').html("<%= @jours_count %>"); + <% end %> + var destroyedItem = $('#word_li_<%=@journal_destroyed.id%>') + destroyedItem.fadeOut(600,function(){ + destroyedItem.remove(); + }); <% else %> $('#message').html('<%= escape_javascript(render(:partial => 'words/message', :locals => {:jour => @jour, :state => false, :user => @user, :feedback_pages => @feedback_pages})) %>'); $('#new_form_reference_user_id').val("");