From e7a1e9b325e7756297bfe632b782ef01accae738 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 4 Nov 2014 14:23:24 +0800 Subject: [PATCH 01/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BC=B9=E5=87=BA?= =?UTF-8?q?=E6=A1=86=E6=A0=B7=E5=BC=8F=EF=BC=8C=E4=BD=BF=E5=85=B6=E4=BD=8D?= =?UTF-8?q?=E4=BA=8E=E5=B1=8F=E5=B9=95=E4=B8=AD=E9=97=B4=EF=BC=8C=E4=B8=94?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=BE=B9=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/bids/_homework.html.erb | 4 +++- app/views/homework_attach/show.js.erb | 6 ++++-- public/stylesheets/css.css | 3 ++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/app/views/bids/_homework.html.erb b/app/views/bids/_homework.html.erb index 458ed68cc..673ea2674 100644 --- a/app/views/bids/_homework.html.erb +++ b/app/views/bids/_homework.html.erb @@ -35,8 +35,10 @@ $('#ajax-modal').html('<%= escape_javascript(render :partial => 'homework_attach/praise_alert') %>'); showModal('ajax-modal', '480px'); $('#ajax-modal').css('height','240px'); - $('#ajax-modal').before("" + + $('#ajax-modal').before("" + ""); + $('#ajax-modal').parent().css("top","").css("left","").css("width","511"); + $('#ajax-modal').parent().addClass("alert_praise"); <% end %> } diff --git a/app/views/homework_attach/show.js.erb b/app/views/homework_attach/show.js.erb index 33cb3cc47..f22c5d149 100644 --- a/app/views/homework_attach/show.js.erb +++ b/app/views/homework_attach/show.js.erb @@ -1,9 +1,11 @@ $('#ajax-modal').html('<%= escape_javascript(render :partial => 'show',:locals => {:comprehensive_evaluation => @comprehensive_evaluation,:homework => @homework, :teaher_score => @teaher_score}) %>'); -showModal('ajax-modal', '503px'); +showModal('ajax-modal', '513px'); $('#ajax-modal').css('height','569px'); $('#ajax-modal').siblings().remove(); -$('#ajax-modal').before("" + +$('#ajax-modal').before("" + ""); +$('#ajax-modal').parent().css("top","").css("left",""); +$('#ajax-modal').parent().addClass("alert_box"); diff --git a/public/stylesheets/css.css b/public/stylesheets/css.css index 490dab1b7..a8fee8b67 100644 --- a/public/stylesheets/css.css +++ b/public/stylesheets/css.css @@ -69,7 +69,7 @@ a.wzan_visited{background:url(images/pic_zan.png) 0 0 no-repeat;} /****评分弹框****/ - +.alert_box {width:488px;height:550px;position:absolute;z-index:1002;left:50%;top:40%;margin:-215px 0 0 -300px; background:#fff; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; box-shadow:0px 0px 8px #194a81; padding:5px; overflow:auto; } .alert .close{width:26px;height:26px;overflow:hidden;position:absolute;top:-10px;right:-502px;background:url(images/close.png) no-repeat;cursor:pointer;} .alert .C{width:476px;height:296px;position:absolute;left:5px;top:5px; } @@ -143,6 +143,7 @@ a:hover.tijiao{ background:#0f99a9 !important;} .N_search{ height:20px !important; border:1px solid #999 !important;} /* 匿名评分弹框 */ +.alert_praise{width:480px;height:200px;position:absolute;z-index:100;left:50%;top:50%;margin:-215px 0 0 -300px; background:#fff; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; box-shadow:0px 0px 8px #194a81; overflow:auto;} .alert .close02{width:26px;height:26px;overflow:hidden;position:absolute;top:-10px;right:-490px;background:url(images/close.png) no-repeat;cursor:pointer;} .ni_con { width:425px; margin:25px 30px;} .ni_con h2{ display:block; height:40px; width:188px; margin:0 auto;} From b506a961a1d9803cd43d8ababc7c5daa9eef9877 Mon Sep 17 00:00:00 2001 From: z9hang Date: Tue, 4 Nov 2014 14:49:36 +0800 Subject: [PATCH 02/11] =?UTF-8?q?1=E3=80=81=E5=9B=9E=E5=A4=8D=E5=8C=BF?= =?UTF-8?q?=E5=90=8D=E8=AF=84=E8=AE=BA=E6=97=B6=E6=98=BE=E7=A4=BA=E5=87=BA?= =?UTF-8?q?=E4=BA=86=E5=90=8D=E5=AD=97bug=E3=80=822=E3=80=81=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_attach_controller.rb | 20 +++++++++++++++++++ app/controllers/words_controller.rb | 1 + app/views/bids/_history.html.erb | 4 ++-- app/views/homework_attach/_jour.html.erb | 19 +++++++++++------- app/views/homework_attach/_show.html.erb | 4 +++- app/views/homework_attach/addjours.js.erb | 1 + app/views/words/_journal_reply.html.erb | 2 +- app/views/words/_journal_reply_items.html.erb | 19 +++++++++++++----- app/views/words/_new_respond.html.erb | 1 + app/views/words/create_reply.js.erb | 2 +- 10 files changed, 56 insertions(+), 17 deletions(-) diff --git a/app/controllers/homework_attach_controller.rb b/app/controllers/homework_attach_controller.rb index 72450f2fe..ff98475ae 100644 --- a/app/controllers/homework_attach_controller.rb +++ b/app/controllers/homework_attach_controller.rb @@ -496,6 +496,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/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/_jour.html.erb b/app/views/homework_attach/_jour.html.erb index 53dfa412b..0b8b0d04e 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/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); From 0f14fbef985f8a9badb210119d32394beb132034 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 4 Nov 2014 14:53:49 +0800 Subject: [PATCH 03/11] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=88=A4=E6=96=AD?= =?UTF-8?q?=EF=BC=9A=E4=BD=9C=E4=B8=9A=E6=80=BB=E6=95=B0=E5=A4=A7=E4=BA=8E?= =?UTF-8?q?4=E4=BB=BD=E6=97=B6=E6=89=8D=E5=8F=AF=E4=BB=A5=E5=BC=80?= =?UTF-8?q?=E5=90=AF=E5=8C=BF=E8=AF=84=20=E5=A2=9E=E5=8A=A0=E4=B8=8D?= =?UTF-8?q?=E5=8F=AF=E9=87=8D=E5=A4=8D=E5=BC=80=E5=90=AF=E5=8C=BF=E8=AF=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/bids_controller.rb | 44 ++++++++++++------- app/views/bids/start_anonymous_comment.js.erb | 10 ++++- 2 files changed, 35 insertions(+), 19 deletions(-) diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb index 8eaf20716..000752d2b 100644 --- a/app/controllers/bids_controller.rb +++ b/app/controllers/bids_controller.rb @@ -1004,27 +1004,37 @@ class BidsController < ApplicationController # 启动匿评 def start_anonymous_comment @bid = Bid.find(params[:id]) - homeworks = @bid.homeworks - users = homeworks.map { |h| h.user } - - @start_index = rand(homeworks.size) - while users[0] == homeworks[@start_index].user - @start_index = rand(homeworks.size) - end + if(@bid.comment_status == 1) + homeworks = @bid.homeworks + if(homeworks && homeworks.count >= 4) + @bid.update_column('comment_status', 1) + users = homeworks.map { |h| h.user } - 3.times do |i| - homework_start_index = @start_index + i - users.each_with_index do |user, index| - actual_index = homework_start_index + index - actual_index = (actual_index < homeworks.size ? actual_index : actual_index - homeworks.size) - if user != homeworks[actual_index] - @homework_evaluation = HomeworkEvaluation.new(user_id: user.id, homework_attach_id: homeworks[actual_index].id) - @homework_evaluation.save + @start_index = rand(homeworks.size) + while users[0] == homeworks[@start_index].user + @start_index = rand(homeworks.size) end + + 3.times do |i| + homework_start_index = @start_index + i + users.each_with_index do |user, index| + actual_index = homework_start_index + index + actual_index = (actual_index < homeworks.size ? actual_index : actual_index - homeworks.size) + if user != homeworks[actual_index] + @homework_evaluation = HomeworkEvaluation.new(user_id: user.id, homework_attach_id: homeworks[actual_index].id) + @homework_evaluation.save + end + end + end + # 修改状态为 '启动匿评' + #@bid.update_column('comment_status', 1) + @statue = 1 + else + @statue = 2 end + else + @statue = 3 end - # 修改状态为 '启动匿评' - @bid.update_column('comment_status', 1) respond_to do |format| format.js diff --git a/app/views/bids/start_anonymous_comment.js.erb b/app/views/bids/start_anonymous_comment.js.erb index 84cd65a7d..a6e24285b 100644 --- a/app/views/bids/start_anonymous_comment.js.erb +++ b/app/views/bids/start_anonymous_comment.js.erb @@ -1,2 +1,8 @@ -alert('启动成功') -$("#<%= @bid.id %>_start_anonymous_comment").html('<%= link_to "关闭匿评", stop_anonymous_comment_bid_path(@bid), remote: true %>') +<% if @statue == 1%> + alert('启动成功'); + $("#<%= @bid.id %>_start_anonymous_comment").html('<%= link_to "关闭匿评", stop_anonymous_comment_bid_path(@bid), remote: true %>'); +<% elsif @statue == 2 %> + alert('启动失败\n作业总数大于4份时才能启动匿评'); +<% elsif @statue == 3%> + alert("已开启匿评,请务重复开启"); +<% end %> From 334a99bcefcd1f85eab40a51bbcb3a2143560fbb Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 4 Nov 2014 15:41:10 +0800 Subject: [PATCH 04/11] =?UTF-8?q?1.=E5=8F=96=E6=B6=88=E8=80=81=E5=B8=88?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BD=9C=E4=B8=9A=E6=97=B6=E5=90=AF=E5=8A=A8?= =?UTF-8?q?=E4=BA=92=E8=AF=84=E6=8C=89=E9=92=AE=E6=98=BE=E7=A4=BA=202?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E4=BD=9C=E4=B8=9A=E6=94=B9=E4=B8=BA=E6=8F=90?= =?UTF-8?q?=E4=BA=A4=E4=BD=9C=E4=B8=9A=203.=E4=BF=AE=E6=94=B9=E4=B8=8D?= =?UTF-8?q?=E8=83=BD=E8=AF=84=E5=88=86=E6=97=B6=E7=9A=84=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/bids_controller.rb | 2 +- app/views/bids/_homework_form.html.erb | 4 ++-- app/views/homework_attach/_homework.html.erb | 4 ++-- app/views/homework_attach/_homeworks_list.html.erb | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb index 000752d2b..cbe81c54f 100644 --- a/app/controllers/bids_controller.rb +++ b/app/controllers/bids_controller.rb @@ -1004,7 +1004,7 @@ class BidsController < ApplicationController # 启动匿评 def start_anonymous_comment @bid = Bid.find(params[:id]) - if(@bid.comment_status == 1) + if(@bid.comment_status == 0) homeworks = @bid.homeworks if(homeworks && homeworks.count >= 4) @bid.update_column('comment_status', 1) diff --git a/app/views/bids/_homework_form.html.erb b/app/views/bids/_homework_form.html.erb index 063daa12c..de4c16960 100644 --- a/app/views/bids/_homework_form.html.erb +++ b/app/views/bids/_homework_form.html.erb @@ -37,10 +37,10 @@

-

+

<%= f.select :is_evaluation, is_evaluation_option %>

-

+

<%= f.select :proportion, proportion_option %>

diff --git a/app/views/homework_attach/_homework.html.erb b/app/views/homework_attach/_homework.html.erb index 63e398877..be83a93ae 100644 --- a/app/views/homework_attach/_homework.html.erb +++ b/app/views/homework_attach/_homework.html.erb @@ -78,7 +78,7 @@ <% if @bid.comment_status == 1 %>

  • - <%= link_to l(:label_work_rating),homework_attach_path(homework,:cur_page => @cur_page,:cur_type => @cur_type),:remote => true %> + <%= link_to l(:label_anonymous_comments),homework_attach_path(homework,:cur_page => @cur_page,:cur_type => @cur_type),:remote => true %> <% if Time.parse(@bid.deadline.to_s).strftime("%Y-%m-%d") < Time.parse(homework.created_at.to_s).strftime("%Y-%m-%d") %>   迟交! <% end %> @@ -86,7 +86,7 @@ <% elsif @bid.comment_status == 2%>
  • - 评分 + <%= l(:label_anonymous_comments) %> <% if Time.parse(@bid.deadline.to_s).strftime("%Y-%m-%d") < Time.parse(homework.created_at.to_s).strftime("%Y-%m-%d") %>   迟交! <% end %> diff --git a/app/views/homework_attach/_homeworks_list.html.erb b/app/views/homework_attach/_homeworks_list.html.erb index 514820fdd..90710a1ac 100644 --- a/app/views/homework_attach/_homeworks_list.html.erb +++ b/app/views/homework_attach/_homeworks_list.html.erb @@ -35,11 +35,11 @@ <% if @bid.comment_status == 0 %>
  • - <%= link_to "创建作业", new_exercise_book_path(@bid), :style => "width:80px; margin:20px 0 0 350px;" %> + <%= link_to "提交作业", new_exercise_book_path(@bid), :style => "width:80px; margin:20px 0 0 350px;" %>
  • <% else %> -
  • - 创建作业 +
  • + 提交作业
  • <% end %> From fced7dcb911ca34da3afa9a6060489b2d534aa6c Mon Sep 17 00:00:00 2001 From: z9hang Date: Tue, 4 Nov 2014 15:46:24 +0800 Subject: [PATCH 05/11] =?UTF-8?q?=E8=BF=9B=E5=85=A5=E8=87=AA=E5=B7=B1?= =?UTF-8?q?=E7=9A=84=E4=BD=9C=E4=B8=9A=E4=B8=8D=E8=AE=A9=E8=AF=84=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/homework_attach_helper.rb | 17 +++++++++++++---- app/views/homework_attach/_history.erb | 4 ++-- app/views/homework_attach/_show_star.html.erb | 2 +- 3 files changed, 16 insertions(+), 7 deletions(-) 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/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/_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 %> From def7a7f5e30d467dc4fc7531d289041b5c23f1e4 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 4 Nov 2014 16:01:55 +0800 Subject: [PATCH 06/11] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E6=8C=89=E6=95=99=E5=B8=88=E8=AF=84=E5=88=86/=E5=8C=BF?= =?UTF-8?q?=E8=AF=84/=E6=97=B6=E9=97=B4=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/bids_controller.rb | 2 +- app/controllers/homework_attach_controller.rb | 34 ++++++++++++++----- .../homework_attach/_homeworks_list.html.erb | 4 ++- 3 files changed, 29 insertions(+), 11 deletions(-) diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb index cbe81c54f..17a20b0d5 100644 --- a/app/controllers/bids_controller.rb +++ b/app/controllers/bids_controller.rb @@ -514,7 +514,7 @@ class BidsController < ApplicationController (SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id = 3123) AS m_score FROM homework_attaches INNER JOIN homework_evaluations ON homework_evaluations.homework_attach_id = homework_attaches.id - WHERE homework_attaches.bid_id = #{@bid.id} AND homework_evaluations.user_id = #{User.current.id}) AS table1 + WHERE homework_attaches.bid_id = #{@bid.id} AND homework_evaluations.user_id = #{User.current.id} ORDER BY s_score DESC) AS table1 WHERE table1.m_score IS NULL") @is_student_batch_homework = true @cur_type = 4 diff --git a/app/controllers/homework_attach_controller.rb b/app/controllers/homework_attach_controller.rb index 72450f2fe..7f61ab15e 100644 --- a/app/controllers/homework_attach_controller.rb +++ b/app/controllers/homework_attach_controller.rb @@ -21,8 +21,14 @@ class HomeworkAttachController < ApplicationController #获取未批作业列表 def get_not_batch_homework - sort, direction = params[:sort], params[:direction] - order_by = sort == 'socre'? "s_score #{direction}" : "created_at #{direction}" + sort, direction = params[:sort] || "s_socre", params[:direction] || "desc" + if sort == 't_socre' + order_by = "t_score #{direction}" + elsif sort == 's_socre' + order_by = "s_score #{direction}" + elsif sort == 'time' + order_by = "created_at #{direction}" + end teachers = find_course_teachers @course all_homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT * FROM (SELECT homework_attaches.*, (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id IN #{teachers}) AS t_score, @@ -41,9 +47,14 @@ class HomeworkAttachController < ApplicationController #获取已评作业列表 def get_batch_homeworks - sort, direction = params[:sort], params[:direction] - teacher_proportion = get_teacher_proportion @bid - order_by = sort == 'socre'? "(CASE WHEN t_score IS NULL THEN 0 ELSE t_score * #{teacher_proportion} END + CASE WHEN s_score IS NULL THEN 0 ELSE s_score * #{1 - teacher_proportion} END) #{direction}" : "created_at #{direction}" + sort, direction = params[:sort] || "s_socre", params[:direction] || "desc" + if sort == 't_socre' + order_by = "t_score #{direction}" + elsif sort == 's_socre' + order_by = "s_score #{direction}" + elsif sort == 'time' + order_by = "created_at #{direction}" + end teachers = find_course_teachers @course all_homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT * FROM (SELECT homework_attaches.*, (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id IN #{teachers} and stars IS NOT NULL) AS t_score, @@ -62,9 +73,14 @@ class HomeworkAttachController < ApplicationController #获取所有作业列表 def get_homeworks - sort, direction = params[:sort], params[:direction] - teacher_proportion = get_teacher_proportion @bid - order_by = sort == 'socre'? "(CASE WHEN t_score IS NULL THEN 0 ELSE t_score * #{teacher_proportion} END + CASE WHEN s_score IS NULL THEN 0 ELSE s_score * #{1 - teacher_proportion} END) #{direction}" : "created_at #{direction}" + sort, direction = params[:sort] || "s_socre", params[:direction] || "desc" + if sort == 't_socre' + order_by = "t_score #{direction}" + elsif sort == 's_socre' + order_by = "s_score #{direction}" + elsif sort == 'time' + order_by = "created_at #{direction}" + end teachers = find_course_teachers @course all_homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT homework_attaches.*, (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id in #{teachers}) AS t_score, @@ -90,7 +106,7 @@ class HomeworkAttachController < ApplicationController (SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id = 3123) AS m_score FROM homework_attaches INNER JOIN homework_evaluations ON homework_evaluations.homework_attach_id = homework_attaches.id - WHERE homework_attaches.bid_id = #{@bid.id} AND homework_evaluations.user_id = #{User.current.id}) AS table1 + WHERE homework_attaches.bid_id = #{@bid.id} AND homework_evaluations.user_id = #{User.current.id} ORDER BY s_score DESC) AS table1 WHERE table1.m_score IS NULL") @cur_page = params[:page] || 1 @cur_type = 4 diff --git a/app/views/homework_attach/_homeworks_list.html.erb b/app/views/homework_attach/_homeworks_list.html.erb index 90710a1ac..e26c73195 100644 --- a/app/views/homework_attach/_homeworks_list.html.erb +++ b/app/views/homework_attach/_homeworks_list.html.erb @@ -11,7 +11,9 @@ )
    按  - <%= link_to l(:label_work_rating), sort_homework_path(@bid, 'socre', @direction), {:remote => true}%> + <%= link_to l(:label_teacher_score), sort_homework_path(@bid, 't_socre', @direction), {:remote => true}%> +  /  + <%= link_to l(:label_anonymous_comments), sort_homework_path(@bid, 's_socre', @direction), {:remote => true}%>  /  <%= link_to l(:label_time), sort_homework_path(@bid, 'time', @direction), {:remote => true}%>  <%= l(:label_sort) %> From ff343b437c47cbaf9cd52575ba128ed156359a00 Mon Sep 17 00:00:00 2001 From: z9hang Date: Tue, 4 Nov 2014 16:05:08 +0800 Subject: [PATCH 07/11] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=8C=BF=E8=AF=84?= =?UTF-8?q?=E8=AF=84=E8=AE=BA=E7=9A=84=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/homework_attach/_jour.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/homework_attach/_jour.html.erb b/app/views/homework_attach/_jour.html.erb index 0b8b0d04e..f18245f7e 100644 --- a/app/views/homework_attach/_jour.html.erb +++ b/app/views/homework_attach/_jour.html.erb @@ -16,7 +16,7 @@ <%= l(:label_anonymous) %> <% end %> - <%= format_time(jour.created_on) %> + <%= format_time(jour.created_on) %> <% if show_score %> <%= l(:label_work_rating) %>: From cc69b06616119caa4b17cb05abef16725f21dc19 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 4 Nov 2014 16:15:36 +0800 Subject: [PATCH 08/11] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E5=B7=A6=E4=BE=A7?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=BC=80=E5=90=AF/=E5=85=B3=E9=97=AD?= =?UTF-8?q?=E5=8C=BF=E8=AF=84=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/base_homework.html.erb | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/app/views/layouts/base_homework.html.erb b/app/views/layouts/base_homework.html.erb index db9d0e1d7..c70e6ae40 100644 --- a/app/views/layouts/base_homework.html.erb +++ b/app/views/layouts/base_homework.html.erb @@ -76,7 +76,7 @@ - -
    + <%= link_to course.name.to_s, homework_course_path(course) if course %> @@ -85,7 +85,7 @@
    + <%=link_to(@bid.name, course_for_bid_path(@bid)) %> @@ -101,8 +101,25 @@
    + <% if (User.current.admin?||User.current.id==@bid.author_id) %> + + + + <% end %> + -
    + + <% case @bid.comment_status %> + <% when 0 %> + <%= link_to '启动匿评', start_anonymous_comment_bid_path(@bid), id: "#{@bid.id}_start_anonymous_comment", remote: true %> + <% when 1 %> + <%= link_to '关闭匿评', stop_anonymous_comment_bid_path(@bid), id: "#{@bid.id}_stop_anonymous_comment", remote: true %> + <% when 2 %> + 匿评结束 + <% end %> + +
    + <%= l(:label_homework_description) %> : @@ -118,7 +135,6 @@
    <%= l(:label_limit_time) %>: - <%= @bid.deadline %> From 13c362b08dfedfc0375403472ece532c89a9c37f Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 4 Nov 2014 16:19:52 +0800 Subject: [PATCH 09/11] =?UTF-8?q?1.=E4=BD=9C=E4=B8=9A=E6=8E=92=E5=BA=8F?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E6=98=BE=E7=A4=BA=E9=A1=BA=E5=BA=8F=202.?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E8=AF=BE=E7=A8=8B->=E9=85=8D=E7=BD=AE=20=20?= =?UTF-8?q?=20=E5=85=B3=E9=97=AD=E8=AF=BE=E7=A8=8B=20->=20=E5=85=B3?= =?UTF-8?q?=E9=97=AD=20=20=E5=8A=A0=E5=85=A5=E8=AF=BE=E7=A8=8B->=E5=8A=A0?= =?UTF-8?q?=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/watchers_helper.rb | 2 +- .../homework_attach/_homeworks_list.html.erb | 15 ++++++++------- app/views/layouts/base_courses.html.erb | 2 +- config/locales/zh.yml | 2 +- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/app/helpers/watchers_helper.rb b/app/helpers/watchers_helper.rb index 166dfd0ec..298331c69 100644 --- a/app/helpers/watchers_helper.rb +++ b/app/helpers/watchers_helper.rb @@ -99,7 +99,7 @@ module WatchersHelper # 主讲教师不允许退出课程 return '' if user.id == course.tea_id || course.is_public == 0 joined = user.member_of_course?(course) - text = joined ? l(:label_exit_course) : l(:label_join_course) + text = joined ? l(:label_exit_course) : l(:label_new_join) url_t = join_path(:object_id => course.id) url_f = try_join_path(:object_id => course.id) method = joined ? 'delete' : 'post' diff --git a/app/views/homework_attach/_homeworks_list.html.erb b/app/views/homework_attach/_homeworks_list.html.erb index e26c73195..b67e91d84 100644 --- a/app/views/homework_attach/_homeworks_list.html.erb +++ b/app/views/homework_attach/_homeworks_list.html.erb @@ -9,14 +9,15 @@ ( <%= homework_count%> ) - + + 按  - <%= link_to l(:label_teacher_score), sort_homework_path(@bid, 't_socre', @direction), {:remote => true}%> -  /  - <%= link_to l(:label_anonymous_comments), sort_homework_path(@bid, 's_socre', @direction), {:remote => true}%> -  /  - <%= link_to l(:label_time), sort_homework_path(@bid, 'time', @direction), {:remote => true}%> -  <%= l(:label_sort) %> + <%= link_to l(:label_anonymous_comments), sort_homework_path(@bid, 's_socre', @direction), {:remote => true}%> +  /  + <%= link_to l(:label_teacher_score), sort_homework_path(@bid, 't_socre', @direction), {:remote => true}%> +  /  + <%= link_to l(:label_time), sort_homework_path(@bid, 'time', @direction), {:remote => true}%> +  <%= l(:label_sort) %> <% end %> diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index 929c06846..bb1647a96 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -88,7 +88,7 @@
    <% if User.current.logged? %> <% if User.current.allowed_to?(:as_teacher,@course) %> - <%= link_to l(:label_course_modify_settings), {:controller => 'courses', :action => 'settings', :id => @course} %> + <%= link_to l(:button_configure), {:controller => 'courses', :action => 'settings', :id => @course} %> <%= render :partial => 'courses/set_course_time', :locals => {:course => @course} %> <% else %> <%= join_in_course(@course, User.current) %> diff --git a/config/locales/zh.yml b/config/locales/zh.yml index a11ded73a..ddde5ccb7 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -1886,7 +1886,7 @@ zh: label_bids_task_list: 作业列表 label_join_course: 加入课程 - label_exit_course: 退出课程 + label_exit_course: 退出 label_new_join: 加入 label_new_course_password: 课程密码 label_new_course_school: 开课学校 From d520f1cdb4d9cc2a261fbf54d2af5170d341f299 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 4 Nov 2014 16:27:34 +0800 Subject: [PATCH 10/11] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=92=8C=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E4=BD=9C=E4=B8=9A=E5=A2=9E=E5=8A=A0js=E9=AA=8C?= =?UTF-8?q?=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/homework_attach/edit.html.erb | 22 ++++++++++++++++++++-- app/views/homework_attach/new.html.erb | 24 ++++++++++++++++++++---- 2 files changed, 40 insertions(+), 6 deletions(-) diff --git a/app/views/homework_attach/edit.html.erb b/app/views/homework_attach/edit.html.erb index 9f81a3d19..5530b8cff 100644 --- a/app/views/homework_attach/edit.html.erb +++ b/app/views/homework_attach/edit.html.erb @@ -14,7 +14,24 @@ } function submit_homework_form() { - $('#edit_homework_attach_<%= @homework.id%>').submit(); + if(regexName()){$('#edit_homework_attach_<%= @homework.id%>').submit();} + } + function regexName() + { + var name = $("#homework_attach_name").val(); + + if(name=="") + { + $("#homework_attach_name_span").text("名称不能为空"); + $("#homework_attach_name_span").css('color','#ff0000'); + return false; + } + else + { + $("#homework_attach_name_span").text("填写正确"); + $("#homework_attach_name_span").css('color','#008000'); + return true; + } } @@ -44,7 +61,8 @@ <%= form_for(@homework) do |f|%>

    - <%= f.text_field :name, :required => true, :name => "homework_name", :class => "w430 bo", :maxlength => 254, :placeholder => "作品名称"%> + <%= f.text_field :name, :required => true, :name => "homework_name", :class => "w430 bo", :maxlength => 254, :placeholder => "作品名称", :onblur => "regexName();"%> +

    @@ -36,7 +51,8 @@   作品名称    : - <%= f.text_field "name", :required => true, :size => 60, :class => "w430 bo", :maxlength => 254, :placeholder => "作品名称" %> + <%= f.text_field "name", :required => true, :size => 60, :class => "w430 bo", :maxlength => 254, :placeholder => "作品名称", :onblur => "regexName();" %> +