diff --git a/app/controllers/homework_attach_controller.rb b/app/controllers/homework_attach_controller.rb
index 0fb4be400..a143fe4aa 100644
--- a/app/controllers/homework_attach_controller.rb
+++ b/app/controllers/homework_attach_controller.rb
@@ -368,7 +368,7 @@ class HomeworkAttachController < ApplicationController
#@limit = 10
#@jours留言 is null条件用以兼容历史数据
@jours = @homework.journals_for_messages.where("is_comprehensive_evaluation = 3 or is_comprehensive_evaluation is null").order("created_on DESC")
- @jour = paginateHelper @jours,10
+ @jour = paginateHelper @jours,5
#@feedback_count = @jours.count
#@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
#@offset ||= @feedback_pages.offset
@@ -393,12 +393,14 @@ class HomeworkAttachController < ApplicationController
is_student = is_cur_course_student @homework.bid.courses.first
is_teacher = is_course_teacher User.current,@homework.bid.courses.first
- is_anonymous_comments = true #是否开启了匿评
+ @is_anonymous_comments = @homework.bid.comment_status == 1 #是否开启了匿评
if !User.current.member_of_course?(@homework.bid.courses.first)
@is_comprehensive_evaluation = 3 #留言
- elsif is_student && is_anonymous_comments #是学生且开启了匿评
+ elsif is_student && @is_anonymous_comments && !@has_evaluation#是学生且开启了匿评且未进行评分
@is_comprehensive_evaluation = 2 #匿评
- elsif is_student && !is_anonymous_comments #是学生未开启匿评
+ elsif is_student && @is_anonymous_comments && @has_evaluation #是学生且开启了匿评,但已评分
+ @is_comprehensive_evaluation = 3 #留言
+ elsif is_student && !@is_anonymous_comments #是学生未开启匿评
@is_comprehensive_evaluation = 3 #留言
elsif is_teacher
@is_comprehensive_evaluation = 1 #教师评论
@@ -417,7 +419,30 @@ class HomeworkAttachController < ApplicationController
#删除留言
def destroy_jour
- @journal_destroyed = JournalsForMessage.delete_message(params[:object_id])
+
+ @homework = HomeworkAttach.find(params[:jour_id])
+ @journal_destroyed = JournalsForMessage.find(params[:object_id])
+ @is_comprehensive_evaluation = @journal_destroyed.is_comprehensive_evaluation
+ @journal_destroyed.destroy
+ if @is_comprehensive_evaluation == 3
+ @jours = @homework.journals_for_messages.where("is_comprehensive_evaluation = 3 or is_comprehensive_evaluation is null").order("created_on DESC")
+ @jour = paginateHelper @jours,5
+ elsif @is_comprehensive_evaluation == 2
+ annymous_users = @homework.homework_evaluations.map(&:user)
+ unless annymous_users.nil? || annymous_users.count == 0
+ @anonymous_comments = @homework.journals_for_messages.where("is_comprehensive_evaluation = 2 and user_id in #{convert_array(annymous_users)}").order("created_on DESC")
+ end
+ elsif @is_comprehensive_evaluation == 1
+ teachers = searchTeacherAndAssistant @course
+ @comprehensive_evaluation = []
+ teachers.each do|teacher|
+ temp = @homework.journals_for_messages.where("is_comprehensive_evaluation = 1 and user_id = #{teacher.user_id}").order("created_on DESC").first
+ @comprehensive_evaluation << temp if temp
+ end
+ end
+
+
+
respond_to do |format|
format.js
end
@@ -429,6 +454,7 @@ class HomeworkAttachController < ApplicationController
@add_jour = @homework.addjours User.current.id, params[:new_form][:user_message],0,params[:is_comprehensive_evaluation]
if @add_jour.is_comprehensive_evaluation == 3
@jours = @homework.journals_for_messages.where("is_comprehensive_evaluation = 3 or is_comprehensive_evaluation is null").order("created_on DESC")
+ @jour = paginateHelper @jours,5
elsif @add_jour.is_comprehensive_evaluation == 2
annymous_users = @homework.homework_evaluations.map(&:user)
unless annymous_users.nil? || annymous_users.count == 0
diff --git a/app/views/homework_attach/_histoey_new.html.erb b/app/views/homework_attach/_histoey_new.html.erb
index 273e8bd4c..a204f87de 100644
--- a/app/views/homework_attach/_histoey_new.html.erb
+++ b/app/views/homework_attach/_histoey_new.html.erb
@@ -2,11 +2,11 @@
-
- <%= l(:label_teacher_comments) %>(<%= @comprehensive_evaluation.nil? ? 0 : @comprehensive_evaluation.count %>)
+ <%= l(:label_teacher_comments) %>(<%= @comprehensive_evaluation.nil? ? 0 : @comprehensive_evaluation.count %>)
-
- <%= l(:label_anonymous_comments) %>(<%= @anonymous_comments.nil? ? 0 : @anonymous_comments.count %>)
+ <%= l(:label_anonymous_comments) %>(<%= @anonymous_comments.nil? ? 0 : @anonymous_comments.count %>)
-
- <%= l(:label_responses) %>(<%= @jours.nil? ? 0 : @jours.count %>)
+ <%= l(:label_responses) %>(<%= @jours.nil? ? 0 : @jours.count %>)
@@ -19,7 +19,7 @@
<%= render :partial => 'homework_attach/jour',:locals => {:jours => @comprehensive_evaluation,:show_score => true,:show_name => true,:is_jour => false} %>
- <%= render :partial => 'homework_attach/jour',:locals => {:jours => @anonymous_comments,:show_score => true,:show_name => false,:is_jour => false} %>
+ <%= render :partial => 'homework_attach/jour',:locals => {:jours => @anonymous_comments,:show_score => true,:show_name => false,:is_jour => false} %>
\ No newline at end of file
diff --git a/app/views/homework_attach/_jour.html.erb b/app/views/homework_attach/_jour.html.erb
index a9872d357..95892dd78 100644
--- a/app/views/homework_attach/_jour.html.erb
+++ b/app/views/homework_attach/_jour.html.erb
@@ -24,20 +24,31 @@
+
+ <%= render :partial => 'words/new_respond', :locals => {:journal => jour, :m_reply_id => jour} %>
+
+
+
+ <%= render :partial => "words/journal_reply", :locals => {:journal => jour } %>
+
+
+
-
<% end %>
<% if is_jour%>
- <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => true, :flag => true%>
+
+
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => true, :flag => true%>
+
<% end %>
\ No newline at end of file
diff --git a/app/views/homework_attach/_show.html.erb b/app/views/homework_attach/_show.html.erb
index b44380ab9..9a828aa61 100644
--- a/app/views/homework_attach/_show.html.erb
+++ b/app/views/homework_attach/_show.html.erb
@@ -15,18 +15,32 @@
<%= @homework.name %>
- - <%= l(:label_create_person) %>:<%= link_to @homework.user, user_path(@homework.user)%>
+ - <%= l(:label_create_person) %>:
+
+ <% if @is_anonymous_comments && @is_comprehensive_evaluation != 1 %>
+ <%= l(:label_anonymous) %>
+ <% else %>
+ <%= link_to @homework.user, user_path(@homework.user)%>
+ <% end %>
+
+
+
- <%= l(:label_activity_time) %>:<%=format_time @homework.created_at %>
<% if @homework.users.count > 0 %>
<%= l(:label_participation_person) %>:
- <% @homework.users.each do |homework_user| %>
- <%= link_to homework_user, user_path(homework_user)%>
- <% if @homework.users.count > 1 && homework_user != @homework.users.last %>
- 、
+ <% if @is_anonymous_comments && @is_comprehensive_evaluation != 1 %>
+ <%= l(:label_anonymous) %>
+ <%else%>
+ <% @homework.users.each do |homework_user| %>
+ <%= link_to homework_user, user_path(homework_user)%>
+ <% if @homework.users.count > 1 && homework_user != @homework.users.last %>
+ 、
+ <% end %>
<% end %>
<% end %>
+
<% end %>
@@ -52,7 +66,7 @@
<%= render :partial => 'show_star',:locals => {:is_comprehensive_evaluation => @is_comprehensive_evaluation,:totle_score => @totle_score,:has_evaluation => @has_evaluation ,
- :can_anonymous_comments=>can_anonymous_comments,:homework => @homework} %>
+ :homework => @homework} %>
<%= render :partial => 'addjour', :locals => {:homework_attach => @homework, :sta => 0, :is_comprehensive_evaluation => @is_comprehensive_evaluation} %>
diff --git a/app/views/homework_attach/_show_star.html.erb b/app/views/homework_attach/_show_star.html.erb
index bf119dd95..e21b3bc24 100644
--- a/app/views/homework_attach/_show_star.html.erb
+++ b/app/views/homework_attach/_show_star.html.erb
@@ -3,7 +3,7 @@
<%= render :partial => 'show_score', locals: {:stars => totle_score} %>
<% elsif is_comprehensive_evaluation == 2 %>
<%= l(:label_work_rating) %>:
- <% if has_evaluation || !can_anonymous_comments %>
+ <% if has_evaluation %>
<%= render :partial => 'show_score', locals: {:stars => totle_score} %>
<% else %>
<%= rating_for homework, dimension: :quality, class: 'rateable div_inline' %>
diff --git a/app/views/homework_attach/addjours.js.erb b/app/views/homework_attach/addjours.js.erb
index f843e1a1e..fd8453eee 100644
--- a/app/views/homework_attach/addjours.js.erb
+++ b/app/views/homework_attach/addjours.js.erb
@@ -3,17 +3,20 @@
//$('#comprehensive_evaluation').html('<#%= escape_javascript(render(:partial => 'comprehensive_evaluation',
//:locals => {:comprehensive_evaluation => @comprehensive_evaluation,:homework => @homework,:teaher_score => @teaher_score} )) %>');
HoverLi(4);
+ $('#jour_count_4').html('<%= @comprehensive_evaluation.count %>')
$('#tbc_04').html('<%= escape_javascript(render(:partial => 'homework_attach/jour',:locals => {:jours => @comprehensive_evaluation,:show_score => true,:show_name => true,:is_jour => false})) %>')
//匿评
<% elsif @add_jour.is_comprehensive_evaluation == 2 %>
// $('#message').html('<#%= escape_javascript(render(:partial => 'showjour', :locals => {:jour =>@jour, :state => false,:homework => @homework} )) %>');
// $('#pre_show').html('<#%= escape_javascript(render(:partial => 'pre_show', :locals => {:content => nil})) %>');
HoverLi(5);
+ $('#jour_count_5').html('<%= @anonymous_comments.count %>')
$('#tbc_05').html('<%= escape_javascript(render(:partial => 'homework_attach/jour',:locals => {:jours => @anonymous_comments,:show_score => true,:show_name => false,:is_jour => false})) %>')
//留言
<% else %>
HoverLi(3);
- $('#tbc_03').html('<%= escape_javascript(render(:partial => 'homework_attach/jour',:locals => {:jours => @jours,:show_score => false,:show_name => true,:is_jour => true})) %>')
+ $('#jour_count_3').html('<%= @jours.count %>')
+ $('#tbc_03').html('<%= escape_javascript(render(:partial => 'homework_attach/jour',:locals => {:jours => @jour,:show_score => false,:show_name => true,:is_jour => true})) %>')
<% end %>
$('#new_form_user_message').val("");
$('#new_form_reference_user_id').val("");
\ No newline at end of file
diff --git a/app/views/homework_attach/destroy_jour.js.erb b/app/views/homework_attach/destroy_jour.js.erb
index 22f7fc048..b2a8044ba 100644
--- a/app/views/homework_attach/destroy_jour.js.erb
+++ b/app/views/homework_attach/destroy_jour.js.erb
@@ -1,8 +1,24 @@
<% if @journal_destroyed.nil? %>
alert('<%=l(:notice_failed_delete)%>');
<% else %>
- var destroyedItem = $('#word_li_<%=@journal_destroyed.id%>')
- destroyedItem.fadeOut(600,function(){
- destroyedItem.remove();
- });
+//教师评论
+<% if @is_comprehensive_evaluation == 1 %>
+//$('#comprehensive_evaluation').html('<#%= escape_javascript(render(:partial => 'comprehensive_evaluation',
+//:locals => {:comprehensive_evaluation => @comprehensive_evaluation,:homework => @homework,:teaher_score => @teaher_score} )) %>');
+HoverLi(4);
+$('#jour_count_4').html('<%= @comprehensive_evaluation.count %>')
+$('#tbc_04').html('<%= escape_javascript(render(:partial => 'homework_attach/jour',:locals => {:jours => @comprehensive_evaluation,:show_score => true,:show_name => true,:is_jour => false})) %>')
+//匿评
+<% elsif @is_comprehensive_evaluation == 2 %>
+// $('#message').html('<#%= escape_javascript(render(:partial => 'showjour', :locals => {:jour =>@jour, :state => false,:homework => @homework} )) %>');
+// $('#pre_show').html('<#%= escape_javascript(render(:partial => 'pre_show', :locals => {:content => nil})) %>');
+HoverLi(5);
+$('#jour_count_5').html('<%= @anonymous_comments.count %>')
+$('#tbc_05').html('<%= escape_javascript(render(:partial => 'homework_attach/jour',:locals => {:jours => @anonymous_comments,:show_score => true,:show_name => false,:is_jour => false})) %>')
+//留言
+<% else %>
+HoverLi(3);
+$('#jour_count_3').html('<%= @jours.count %>')
+$('#tbc_03').html('<%= escape_javascript(render(:partial => 'homework_attach/jour',:locals => {:jours => @jour,:show_score => false,:show_name => true,:is_jour => true})) %>')
+<% end %>
<% end %>
diff --git a/app/views/homework_attach/show.js.erb b/app/views/homework_attach/show.js.erb
index e1366e1da..66ed277f2 100644
--- a/app/views/homework_attach/show.js.erb
+++ b/app/views/homework_attach/show.js.erb
@@ -1,4 +1,4 @@
-$('#ajax-modal').html('<%= escape_javascript(render :partial => 'show',:locals => {:comprehensive_evaluation => @comprehensive_evaluation,:homework => @homework, :teaher_score => @teaher_score,:can_anonymous_comments => true}) %>');
+$('#ajax-modal').html('<%= escape_javascript(render :partial => 'show',:locals => {:comprehensive_evaluation => @comprehensive_evaluation,:homework => @homework, :teaher_score => @teaher_score}) %>');
showModal('ajax-modal', '503px');
$('#ajax-modal').css('height','569px');