|
|
|
@ -70,20 +70,22 @@ class WordsController < ApplicationController
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def destroy
|
|
|
|
|
@journal_destroyed = JournalsForMessage.delete_message(params[:object_id])
|
|
|
|
|
if @journal_destroyed.jour_type == "Bid"
|
|
|
|
|
@bid = Bid.find(@journal_destroyed.jour_id)
|
|
|
|
|
@jours_count = @bid.journals_for_messages.where('m_parent_id IS NULL').count
|
|
|
|
|
elsif @journal_destroyed.jour_type == "Course"
|
|
|
|
|
@course = Course.find @journal_destroyed.jour_id
|
|
|
|
|
@jours_count = @course.journals_for_messages.where('m_parent_id IS NULL').count
|
|
|
|
|
elsif @journal_destroyed.jour_type == "Principal"
|
|
|
|
|
@user = User.find(@journal_destroyed.jour_id)
|
|
|
|
|
@jours_count = @user.journals_for_messages.where('m_parent_id IS NULL').count
|
|
|
|
|
@is_user = true
|
|
|
|
|
end
|
|
|
|
|
respond_to do |format|
|
|
|
|
|
format.js
|
|
|
|
|
@journal_destroyed = JournalsForMessage.find params[:object_id]
|
|
|
|
|
if @journal_destroyed.destroy
|
|
|
|
|
if @journal_destroyed.jour_type == "Bid"
|
|
|
|
|
@bid = Bid.find(@journal_destroyed.jour_id)
|
|
|
|
|
@jours_count = @bid.journals_for_messages.where('m_parent_id IS NULL').count
|
|
|
|
|
elsif @journal_destroyed.jour_type == "Course"
|
|
|
|
|
@course = Course.find @journal_destroyed.jour_id
|
|
|
|
|
@jours_count = @course.journals_for_messages.where('m_parent_id IS NULL').count
|
|
|
|
|
elsif @journal_destroyed.jour_type == "Principal"
|
|
|
|
|
@user = User.find(@journal_destroyed.jour_id)
|
|
|
|
|
@jours_count = @user.journals_for_messages.where('m_parent_id IS NULL').count
|
|
|
|
|
@is_user = true
|
|
|
|
|
end
|
|
|
|
|
respond_to do |format|
|
|
|
|
|
format.js
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|