修复作业留言模块先回复留言然后删除回复留言界面不会及时刷新的BUG

This commit is contained in:
sw 2014-05-20 08:48:42 +08:00
parent b80c51475f
commit 9a62fe22c6
4 changed files with 20 additions and 24 deletions

View File

@ -26,13 +26,13 @@ class HomeworkAttachController < ApplicationController
#删除留言 #删除留言
def destroy def destroy
@journal_destroyed = JournalsForMessage.delete_message(params[:object_id]) @journal_destroyed = JournalsForMessage.delete_message(params[:object_id])
@homework = HomeworkAttach.find(params[:id]) #@homework = HomeworkAttach.find(params[:id])
@jours = @homework.journals_for_messages.order("created_on DESC") #@jours = @homework.journals_for_messages.order("created_on DESC")
@limit = 10 #@limit = 10
@feedback_count = @jours.count #@feedback_count = @jours.count
@feedback_pages = Paginator.new @feedback_count, @limit, params['page'] #@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
@offset ||= @feedback_pages.offset #@offset ||= @feedback_pages.offset
@jour = @jours[@offset, @limit] #@jour = @jours[@offset, @limit]
respond_to do |format| respond_to do |format|
format.js format.js
end end
@ -43,11 +43,11 @@ class HomeworkAttachController < ApplicationController
@homework = HomeworkAttach.find(params[:jour_id]) @homework = HomeworkAttach.find(params[:jour_id])
@homework.addjours User.current.id, params[:new_form][:user_message],0 @homework.addjours User.current.id, params[:new_form][:user_message],0
@jours = @homework.journals_for_messages.order("created_on DESC") @jours = @homework.journals_for_messages.order("created_on DESC")
@limit = 10 #@limit = 10
@feedback_count = @jours.count #@feedback_count = @jours.count
@feedback_pages = Paginator.new @feedback_count, @limit, params['page'] #@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
@offset ||= @feedback_pages.offset #@offset ||= @feedback_pages.offset
@jour = @jours[@offset, @limit] #@jour = @jours[@offset, @limit]
respond_to do |format| respond_to do |format|
format.js format.js
end end

View File

@ -1,4 +1,4 @@
$('#message').html('<%= escape_javascript(render(:partial => 'showjour', :locals => {:jour =>@jour, :state => false} )) %>'); $('#message').html('<%= escape_javascript(render(:partial => 'showjour', :locals => {:jour =>@jours, :state => false} )) %>');
$('#pre_show').html('<%= escape_javascript(render(:partial => 'pre_show', :locals => {:content => nil})) %>'); $('#pre_show').html('<%= escape_javascript(render(:partial => 'pre_show', :locals => {:content => nil})) %>');
$('#new_form_user_message').val(""); $('#new_form_user_message').val("");
$('#new_form_reference_user_id').val(""); $('#new_form_reference_user_id').val("");

View File

@ -1,12 +1,8 @@
<% if @journal_destroyed.nil? %> <% if @journal_destroyed.nil? %>
alert('<%=l(:notice_failed_delete)%>'); alert('<%=l(:notice_failed_delete)%>');
<% elsif (['Principal','Project', 'Bid', 'Contest', 'Softapplication','HomeworkAttach'].include? @journal_destroyed.jour_type)%>
var destroyedItem = $('#word_li_<%=@journal_destroyed.id%>')
destroyedItem.fadeOut(600,function(){
destroyedItem.remove();
});
<% else %> <% else %>
var destroyedItem = $('#word_li_<%=@journal_destroyed.id%>')
$('#message').html('<%= escape_javascript(render(:partial => 'showjour', :locals => {:jour => @jours, :state => false})) %>'); destroyedItem.fadeOut(600,function(){
$('#new_form_reference_user_id').val(""); destroyedItem.remove();
});
<% end %> <% end %>

View File

@ -16,9 +16,9 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
RedmineApp::Application.routes.draw do RedmineApp::Application.routes.draw do
resources :homework_users resources :homework_users
resources :no_uses resources :no_uses
delete 'no_uses', :to => 'no_uses#delete' delete 'no_uses', :to => 'no_uses#delete'