1、重新进入留言界面后,不能删除自己的留言bug。2、删除留言后留言数量未变问题

This commit is contained in:
z9hang 2014-11-04 10:07:15 +08:00
parent c3152b55de
commit 1ec82a923e
4 changed files with 15 additions and 7 deletions

View File

@ -112,7 +112,7 @@ class HomeworkAttachController < ApplicationController
#获取作业的留言列表 #获取作业的留言列表
def get_homework_jours 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') @jours = @bid.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
@jour = paginateHelper @jours,10 @jour = paginateHelper @jours,10
@state = false @state = false

View File

@ -82,7 +82,12 @@ class WordsController < ApplicationController
def destroy def destroy
@journal_destroyed = JournalsForMessage.delete_message(params[:object_id]) @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| respond_to do |format|
format.js format.js
#format.api { render_api_ok } #format.api { render_api_ok }

View File

@ -26,7 +26,7 @@
<div class="ping_disfoot"> <div class="ping_disfoot">
<% ids = 'project_respond_form_'+ journal.id.to_s%> <% ids = 'project_respond_form_'+ journal.id.to_s%>
<span style="float: right"> <span style="float: right">
<% if @user==User.current|| User.current.admin? %> <% if journal.user == User.current|| User.current.admin? %>
<%= link_to(l(:label_bid_respond_delete), <%= link_to(l(:label_bid_respond_delete),
{:controller => 'words', :action => 'destroy', :object_id => journal, :user_id => @user}, {:controller => 'words', :action => 'destroy', :object_id => journal, :user_id => @user},
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :remote => true, :confirm => l(:text_are_you_sure), :method => 'delete',

View File

@ -1,10 +1,13 @@
<% if @journal_destroyed.nil? %> <% if @journal_destroyed.nil? %>
alert('<%=l(:notice_failed_delete)%>'); alert('<%=l(:notice_failed_delete)%>');
<% elsif (['Principal','Project','Course', 'Bid', 'Contest', 'Softapplication'].include? @journal_destroyed.jour_type)%> <% elsif (['Principal','Project','Course', 'Bid', 'Contest', 'Softapplication'].include? @journal_destroyed.jour_type)%>
var destroyedItem = $('#word_li_<%=@journal_destroyed.id%>') <% if @jours_count %>
destroyedItem.fadeOut(600,function(){ $('#jours_count').html("<%= @jours_count %>");
destroyedItem.remove(); <% end %>
}); var destroyedItem = $('#word_li_<%=@journal_destroyed.id%>')
destroyedItem.fadeOut(600,function(){
destroyedItem.remove();
});
<% else %> <% else %>
$('#message').html('<%= escape_javascript(render(:partial => 'words/message', :locals => {:jour => @jour, :state => false, :user => @user, :feedback_pages => @feedback_pages})) %>'); $('#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(""); $('#new_form_reference_user_id').val("");