diff --git a/app/controllers/homework_attach_controller.rb b/app/controllers/homework_attach_controller.rb index 7f61ab15e..12aa5860f 100644 --- a/app/controllers/homework_attach_controller.rb +++ b/app/controllers/homework_attach_controller.rb @@ -512,6 +512,26 @@ class HomeworkAttachController < ApplicationController @totle_score = score_for_homework @homework @teaher_score = teacher_score_for_homework @homework + stars_reates = @homework. rates(:quality) + is_student = is_cur_course_student @homework.bid.courses.first + is_teacher = is_course_teacher User.current,@homework.bid.courses.first + @has_evaluation = stars_reates.where("rater_id = ?",User.current).count > 0 + @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 && !@has_evaluation#是学生且开启了匿评且未进行评分 + @is_comprehensive_evaluation = 2 #匿评 + 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 #教师评论 + else + @is_comprehensive_evaluation = 3 + end + + respond_to do |format| format.js end diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index 8797474ec..b4bc52eab 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -56,6 +56,7 @@ class WordsController < ApplicationController reply_user_id = params[:reference_user_id] reply_id = params[:reference_message_id] # 暂时不实现 content = params[:user_notes] + @show_name = params[:show_name] == "true" options = {:user_id => author_id, :status => true, :m_parent_id => parent_id, diff --git a/app/helpers/homework_attach_helper.rb b/app/helpers/homework_attach_helper.rb index d8d418da5..750a71f6a 100644 --- a/app/helpers/homework_attach_helper.rb +++ b/app/helpers/homework_attach_helper.rb @@ -96,13 +96,22 @@ module HomeworkAttachHelper if array.nil? || array.count == 0 return "()" end - array.each do |member| - if member == array.last - ary += member.id.to_s + ")" + array.length.times do |i| + if i == array.length - 1 + ary += array[i].id.to_s + ")" else - ary += member.id.to_s + "," + if !(array[i].nil? || array[i].id.nil? || array[i].id.to_s == "") + ary += array[i].id.to_s + "," + end end end + #array.each do |member| + # if member == array.last + # ary += member.id.to_s + ")" + # else + # ary += member.id.to_s + "," + # end + #end ary end end \ No newline at end of file diff --git a/app/views/bids/_history.html.erb b/app/views/bids/_history.html.erb index 8273c4b04..633037ba9 100644 --- a/app/views/bids/_history.html.erb +++ b/app/views/bids/_history.html.erb @@ -62,12 +62,12 @@ <% ids = 'project_respond_form_'+ journal.id.to_s%> <% if reply_allow %>
- <%= render :partial => 'words/new_respond', :locals => {:journal => journal, :m_reply_id => journal} %> + <%= render :partial => 'words/new_respond', :locals => {:journal => journal, :m_reply_id => journal,:show_name => true} %>
<% end %>
- <%= render :partial => "words/journal_reply", :locals => {:journal => journal } %> + <%= render :partial => "words/journal_reply", :locals => {:journal => journal,:show_name => true } %>
<% end %> diff --git a/app/views/homework_attach/_history.erb b/app/views/homework_attach/_history.erb index 3376d696f..53de7d33f 100644 --- a/app/views/homework_attach/_history.erb +++ b/app/views/homework_attach/_history.erb @@ -49,12 +49,12 @@ <% ids = 'project_respond_form_'+ journal.id.to_s%> <% if reply_allow %>
- <%= render :partial => 'words/new_respond', :locals => {:journal => journal, :m_reply_id => journal} %> + <%= render :partial => 'words/new_respond', :locals => {:journal => journal, :m_reply_id => journal,:show_name => true} %>
<% end %>
- <%= render :partial => "words/journal_reply", :locals => {:journal => journal } %> + <%= render :partial => "words/journal_reply", :locals => {:journal => journal, :show_name => true} %>
diff --git a/app/views/homework_attach/_jour.html.erb b/app/views/homework_attach/_jour.html.erb index 53dfa412b..f18245f7e 100644 --- a/app/views/homework_attach/_jour.html.erb +++ b/app/views/homework_attach/_jour.html.erb @@ -5,13 +5,18 @@ <%= link_to image_tag(url_to_avatar(jour.user)) , user_path(jour.user), :target =>"_blank" %> <% else %> <%= image_tag(url_to_avatar(nil))%> - <%= l(:label_anonymous) %> <% end %>
- <%= link_to jour.user, user_path(jour.user),:style => " font-weight:bold; color:#15bccf; margin-right:30px; background:none;", :target => "_blank"%> - <%= format_time(jour.created_on) %> + + <% if show_name %> + <%= link_to jour.user, user_path(jour.user),:style => " font-weight:bold; color:#15bccf; margin-right:30px; background:none;", :target => "_blank"%> + <% else%> + <%= l(:label_anonymous) %> + <% end %> + + <%= format_time(jour.created_on) %> <% if show_score %> <%= l(:label_work_rating) %>: @@ -24,22 +29,22 @@
<% ids = 'project_respond_form_'+ jour.id.to_s%> - <% if jour.user==User.current|| User.current.admin? %> + <% if (jour.user==User.current|| User.current.admin?) && show_name %> <%= 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;"} + {:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea'), ''); $('##{ids} textarea') ;return false;"} ##{l(:label_reply_plural)} #{jour.user.name}: %>
- <%= render :partial => 'words/new_respond', :locals => {:journal => jour, :m_reply_id => jour} %> + <%= render :partial => 'words/new_respond', :locals => {:journal => jour, :m_reply_id => jour,:show_name=> show_name} %>
- <%= render :partial => "words/journal_reply", :locals => {:journal => jour } %> + <%= render :partial => "words/journal_reply", :locals => {:journal => jour,:show_name=> show_name } %>
diff --git a/app/views/homework_attach/_show.html.erb b/app/views/homework_attach/_show.html.erb index 6dc06cfe4..f754a7424 100644 --- a/app/views/homework_attach/_show.html.erb +++ b/app/views/homework_attach/_show.html.erb @@ -69,7 +69,9 @@ :homework => @homework} %>
- <%= render :partial => 'addjour', :locals => {:homework_attach => @homework, :sta => 0, :is_comprehensive_evaluation => @is_comprehensive_evaluation} %> +
+ <%= 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 e21b3bc24..6dc82e238 100644 --- a/app/views/homework_attach/_show_star.html.erb +++ b/app/views/homework_attach/_show_star.html.erb @@ -1,4 +1,4 @@ -<% if is_comprehensive_evaluation == 3 %> +<% if is_comprehensive_evaluation == 3 || User.current == homework.user%> <%= l(:label_work_rating) %>: <%= render :partial => 'show_score', locals: {:stars => totle_score} %> <% elsif is_comprehensive_evaluation == 2 %> diff --git a/app/views/homework_attach/addjours.js.erb b/app/views/homework_attach/addjours.js.erb index fd8453eee..1e34bdc3e 100644 --- a/app/views/homework_attach/addjours.js.erb +++ b/app/views/homework_attach/addjours.js.erb @@ -9,6 +9,7 @@ <% 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})) %>'); + $('#add_jour').html('<%= escape_javascript(render(:partial => 'addjour', :locals => {:homework_attach => @homework, :sta => 0, :is_comprehensive_evaluation => @is_comprehensive_evaluation})) %>') 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})) %>') diff --git a/app/views/words/_journal_reply.html.erb b/app/views/words/_journal_reply.html.erb index 51de1d539..eb22091a6 100644 --- a/app/views/words/_journal_reply.html.erb +++ b/app/views/words/_journal_reply.html.erb @@ -2,6 +2,6 @@ <% id = "journal_reply_ul_" + journal.id.to_s%>
<% fetch_user_leaveWord_reply(journal).each do |reply|%> - <%= render :partial => "words/journal_reply_items", :locals => {:reply => reply, :journal => journal, :m_reply_id => reply} %> + <%= render :partial => "words/journal_reply_items", :locals => {:reply => reply, :journal => journal, :m_reply_id => reply,:show_name=> show_name} %> <% end %>
diff --git a/app/views/words/_journal_reply_items.html.erb b/app/views/words/_journal_reply_items.html.erb index 3b018ddb5..7b7bd359c 100644 --- a/app/views/words/_journal_reply_items.html.erb +++ b/app/views/words/_journal_reply_items.html.erb @@ -2,13 +2,22 @@ <% ids_r = 'reply_respond_form_'+ reply.id.to_s %>
+ <% if show_name %> <%= image_tag url_to_avatar(reply.user) %> + <% else %> + <%= image_tag url_to_avatar(nil) %> + <% end %>
<% id = 'project_respond_form_'+ reply.id.to_s %> <%= link_to reply.user.name, user_path(reply.user) %> - 回复 - <%= link_to reply.at_user.name,user_path(reply.at_user) %> + 回复 + <% if show_name %> + <%= link_to reply.at_user.name,user_path(reply.at_user) %> + <% else %> + <%= l(:label_anonymous) %> + <% end %> +

<%= reply.notes %> @@ -25,14 +34,14 @@ <% end %> <% if reply_allow %> <%= link_to l(:label_projects_feedback_respond),'', - {:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{id}'), $('##{id} textarea'), '#{l(:label_reply_plural)} #{m_reply_id.user.name}: '); return false;"} %> - <% end %> + {:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{id}'), $('##{id} textarea'), ''); return false;"} %> + <% end %>

<% if reply_allow %> - <%= render :partial => "words/new_respond", :locals => {:journal => journal, :m_reply_id => m_reply_id} %> + <%= render :partial => "words/new_respond", :locals => {:journal => journal, :m_reply_id => m_reply_id,:show_name => show_name} %> <% end %>
diff --git a/app/views/words/_new_respond.html.erb b/app/views/words/_new_respond.html.erb index 5671bcfa5..db5e9f4da 100644 --- a/app/views/words/_new_respond.html.erb +++ b/app/views/words/_new_respond.html.erb @@ -8,6 +8,7 @@ <%= hidden_field_tag 'reference_id', params[:reference_id], :value => journal.id %> <%= hidden_field_tag 'reference_user_id', params[:reference_user_id], :value => m_reply_id.user.id %> <%= hidden_field_tag 'reference_message_id', params[:reference_message_id], :value => m_reply_id.id %> + <%= hidden_field_tag 'show_name',params[:show_name],:value => show_name.nil? ? true : show_name %> <%= submit_tag l(:button_projects_feedback_respond), :name => nil , :class => "enterprise", :style => "float: right; margin-top: 1px; margin-right: 4px;"%> diff --git a/app/views/words/create_reply.js.erb b/app/views/words/create_reply.js.erb index b24f46641..eeb4e3ef6 100644 --- a/app/views/words/create_reply.js.erb +++ b/app/views/words/create_reply.js.erb @@ -1,7 +1,7 @@ <% if @save_succ %> var pre_append = $('<%= j( render :partial => "words/journal_reply_items", - :locals => {:reply => @jfm, :journal => @jfm.parent, :m_reply_id => @jfm} + :locals => {:reply => @jfm, :journal => @jfm.parent, :m_reply_id => @jfm,:show_name => @show_name} ) %>').hide(); $('#journal_reply_ul_<%=@jfm.m_parent_id%>').append(pre_append); pre_append.fadeIn(600);