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/bids/_new.html.erb b/app/views/bids/_new.html.erb index 80fa1781f..ef81d8f64 100644 --- a/app/views/bids/_new.html.erb +++ b/app/views/bids/_new.html.erb @@ -13,13 +13,17 @@ $('#' + id).val(content); } } + function submit1(button) + { + $('#jours_submit').parent().submit(); + } -<%= form_for('bid_message', :remote => true, :method => :post, +<%= form_for('bid_message', :id=>"bid_message_form",:remote => true, :method => :post, :url => {:controller => 'bids', :action => 'create', :id => bid, -:sta => sta}) do |f|%> +:sta => sta}) do |f|%>
<%= render :partial => 'pre_show', :locals => {:content => @content} %> @@ -34,16 +38,16 @@ <%= f.text_area 'message', :rows => 3, :cols => 65, :placeholder => l(:label_max_length), :style => "resize: none;", :class => 'noline'%> <% end %> + + <%= f.text_field :reference_user_id, :style=>"display:none"%> + <%= l(:button_clear_meassge) %> + <%= l(:label_responses) %> + -<%= f.text_field :reference_user_id, :style=>"display:none"%> - - - - -
<%= submit_tag l(:button_leave_meassge), :name => nil , :class => "bid_btn", :onmouseout => "this.style.backgroundPosition = 'left top'", :onmouseover => "this.style.backgroundPosition = 'left -31px'"%> - <%= submit_tag l(:button_clear_meassge), :name => nil, :onclick => "clearMessage('bid_message_message');", :type => 'button', :class => "bid_btn", :onmouseout => "this.style.backgroundPosition = 'left top'", :onmouseover => "this.style.backgroundPosition = 'left -31px'" %>
+ + <% else %> diff --git a/app/views/homework_attach/_addjour.html.erb b/app/views/homework_attach/_addjour.html.erb index 2519f6a15..cbc189ef5 100644 --- a/app/views/homework_attach/_addjour.html.erb +++ b/app/views/homework_attach/_addjour.html.erb @@ -49,6 +49,11 @@ $('#' + id).val(content); } } + + function submit1(button) + { + $('#jours_submit').parent().submit(); + } <%= form_for('new_form', :remote => true, :method => :post, @@ -67,14 +72,8 @@ :style => "resize: none;", :class => 'noline', :placeholder => l(:text_caracters_maximum,:count=>250)%> <%= f.text_field :reference_user_id, :style=>"display:none"%>
- <%= submit_tag l(:button_leave_meassge), - :name => nil , :class => "enterprise", - :onmouseout => "this.style.backgroundPosition = 'left top'", - :onmouseover => "this.style.backgroundPosition = 'left -31px'"%> - <%= submit_tag l(:button_clear_meassge), :name => nil, :class => "enterprise", - :onclick => "clearMessage('new_form_user_message');", - :onmouseout => "this.style.backgroundPosition = 'left top'", - :onmouseover => "this.style.backgroundPosition = 'left -31px'" %> + <%= l(:label_submit_comments) %> +
<% else %>
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 @@
<% ids = 'project_respond_form_'+ jour.id.to_s%> - <%= link_to l(:label_projects_feedback_respond),'', - {:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea'), '#{l(:label_reply_plural)} #{jour.user.name}: '); $('##{ids} textarea') ;return false;"} - %> <% if jour.user==User.current|| User.current.admin? %> - <%= link_to(l(:label_bid_respond_delete), {:controller => 'homework_attach', :action => 'destroy_jour', :object_id => jour, :user_id => jour.user}, + <%= link_to(l(:label_bid_respond_delete), {:controller => 'homework_attach', :action => 'destroy_jour', :object_id => jour, :user_id => jour.user,:jour_id =>@homework.id }, :remote => true, :confirm => l(:text_are_you_sure), :title => l(:button_delete)) %> <% end %> + <%= link_to l(:label_projects_feedback_respond),'', + {:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea'), '#{l(:label_reply_plural)} #{jour.user.name}: '); $('##{ids} textarea') ;return false;"} + %> +
+
+ <%= render :partial => 'words/new_respond', :locals => {:journal => jour, :m_reply_id => jour} %> +
+
+
+ <%= render :partial => "words/journal_reply", :locals => {:journal => jour } %> +
+ +
- <% end %> <% if is_jour%> - +
+ +
<% 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..6dc06cfe4 100644 --- a/app/views/homework_attach/_show.html.erb +++ b/app/views/homework_attach/_show.html.erb @@ -15,18 +15,32 @@

<%= @homework.name %>

<% 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,12 +66,10 @@

<%= 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 072ae317d..22b89d52a 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'); $('#ajax-modal').siblings().remove(); diff --git a/config/locales/en.yml b/config/locales/en.yml index 18a4819c5..94272b1fd 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1850,4 +1850,5 @@ en: label_homework_without_description: The homework without any description! label_teacher_comments: Teacher comments label_anonymous_comments: Anonymous comments - label_anonymous: Anonymous \ No newline at end of file + label_anonymous: Anonymous + label_submit_comments: Submit_comments \ No newline at end of file diff --git a/config/locales/zh.yml b/config/locales/zh.yml index a92832065..a11ded73a 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -2182,4 +2182,5 @@ zh: label_sure_exit_homework: 是否确认退出该作业 label_teacher_comments: 教师评论 label_anonymous_comments: 匿评 - label_anonymous: 匿名 \ No newline at end of file + label_anonymous: 匿名 + label_submit_comments: 提交评论 \ No newline at end of file diff --git a/public/stylesheets/css.css b/public/stylesheets/css.css index 345b6a186..490dab1b7 100644 --- a/public/stylesheets/css.css +++ b/public/stylesheets/css.css @@ -83,7 +83,8 @@ a.wzan_visited{background:url(images/pic_zan.png) 0 0 no-repeat;} .ping_star span a{ float:right; width:20px; height:20px; background:url(images/star.png) -2px 0 no-repeat; margin-right:3px;} .ping_star span a:hover{background:url(images/star.png) -24px 0 no-repeat;} .ping_con textarea{ width:455px; height:76px; border:1px solid #15bccf; margin-bottom:5px; color:#666; font-size:12px;} -a.ping_sub{ float:right; height:22px; width:60px; background:#15bccf; color:#fff; text-align:center;} +a.ping_sub{ float:right; height:22px; width:60px; margin-right:20px; background:#15bccf; color:#fff; text-align:center;} +a.ping_sub1{ float:right; height:22px; width:60px; background:#15bccf; color:#fff; text-align:center;} a:hover.ping_sub{ background:#14a8b9;} .recall{ border-top:1px solid #CCC; padding:5px 0;} .recall_head{ float:left;}