diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 9e3a4b836..7793ef097 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -6,8 +6,8 @@ class HomeworkCommonController < ApplicationController include StudentWorkHelper before_filter :find_course, :only => [:index,:new,:create] - before_filter :find_homework, :only => [:edit,:update,:alert_anonymous_comment,:start_anonymous_comment,:stop_anonymous_comment,:destroy,:start_evaluation_set,:set_evaluation_attr] - before_filter :teacher_of_course, :only => [:new, :create, :edit, :update, :destroy, :start_anonymous_comment, :stop_anonymous_comment, :alert_anonymous_comment,:start_evaluation_set,:set_evaluation_attr] + before_filter :find_homework, :only => [:edit,:update,:alert_anonymous_comment,:start_anonymous_comment,:stop_anonymous_comment,:destroy,:start_evaluation_set,:set_evaluation_attr,:score_rule_set] + before_filter :teacher_of_course, :only => [:new, :create, :edit, :update, :destroy, :start_anonymous_comment, :stop_anonymous_comment, :alert_anonymous_comment,:start_evaluation_set,:set_evaluation_attr,:score_rule_set] before_filter :member_of_course, :only => [:index] def index @@ -215,6 +215,11 @@ class HomeworkCommonController < ApplicationController end end + #评分设置 + def score_rule_set + + end + private #获取课程 def find_course diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index e5e1bf391..529c5ea72 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -457,7 +457,13 @@ class StudentWorkController < ApplicationController end end respond_to do |format| - format.html{redirect_to student_work_index_url(:homework => @homework.id)} + format.html{ + if params[:student_path] + redirect_to student_work_index_url(:homework => @homework.id) + else + redirect_to user_homeworks_user_path(User.current.id) + end + } end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index ce11bded8..7289d534b 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2357,8 +2357,10 @@ module ApplicationHelper if work.nil? link_to "提交作品", new_student_work_path(:homework => homework.id),:class => 'c_blue' else - if homework.homework_detail_manual && homework.homework_detail_manual.comment_status != 1 #匿评作业,且作业状态不是在开启匿评之前 + if homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 2 #匿评作业,且作业状态不是在开启匿评之前 link_to "作品匿评", student_work_index_path(:homework => homework.id), :class => 'c_blue', :title => "开启匿评后不可修改作品" + elsif homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 3 + link_to "匿评结束", student_work_index_path(:homework => homework.id), :class => 'c_blue', :title => "匿评已结束" elsif homework.homework_type == 2 #编程作业不能修改作品 link_to "修改作品", new_student_work_path(:homework => homework.id),:class => 'c_blue' else diff --git a/app/views/courses/_course_activity.html.erb b/app/views/courses/_course_activity.html.erb index aa99236df..4a7cb900d 100644 --- a/app/views/courses/_course_activity.html.erb +++ b/app/views/courses/_course_activity.html.erb @@ -68,13 +68,24 @@ } } - function expand_reply_input(id) { - $(id).toggle(); - } - $(function () { init_activity_KindEditor_data(<%= activity.id%>, null, "87%"); showNormalImage('activity_description_<%= activity.id %>'); + if($("#intro_content_<%= activity.id %>").height() > 360) { + $("#intro_content_show_<%= activity.id %>").show(); + } + $("#intro_content_show_<%= activity.id %>").click(function(){ + $("#activity_description_<%= activity.id %>").toggleClass("maxh360"); + $("#activity_description_<%= activity.id%>").toggleClass("lh18"); + $("#intro_content_show_<%= activity.id %>").hide(); + $("#intro_content_hide_<%= activity.id %>").show(); + }); + $("#intro_content_hide_<%= activity.id %>").click(function(){ + $("#activity_description_<%= activity.id %>").toggleClass("maxh360"); + $("#activity_description_<%= activity.id%>").toggleClass("lh18"); + $("#intro_content_hide_<%= activity.id %>").hide(); + $("#intro_content_show_<%= activity.id %>").show(); + }); }); <% if activity && activity.course_act%> diff --git a/app/views/homework_common/score_rule_set.js.erb b/app/views/homework_common/score_rule_set.js.erb new file mode 100644 index 000000000..5ff42dff7 --- /dev/null +++ b/app/views/homework_common/score_rule_set.js.erb @@ -0,0 +1,6 @@ +$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/set_score_rule',:locals => {:homework => @homework, :student_path => false}) %>'); +showModal('ajax-modal', '350px'); +$('#ajax-modal').siblings().remove(); +$('#ajax-modal').before("" + + ""); +$('#ajax-modal').parent().css("top","25%").css("left","35%").css("position","fixed"); \ No newline at end of file diff --git a/app/views/student_work/_set_score_rule.html.erb b/app/views/student_work/_set_score_rule.html.erb index 7deed7fb8..508b89a1c 100644 --- a/app/views/student_work/_set_score_rule.html.erb +++ b/app/views/student_work/_set_score_rule.html.erb @@ -1,4 +1,7 @@ <%= form_for('new_form',:url => {:controller => 'student_work',:action => 'set_score_rule',:homework => homework.id},:method => "post") do |f|%> + <% if student_path %> + <%=hidden_field_tag 'student_path', params[:student_path], :value => student_path %> + <% end %>
评分设置
diff --git a/app/views/student_work/_student_work_attachment_form.html.erb b/app/views/student_work/_student_work_attachment_form.html.erb index 7802f6eb6..265ff9be7 100644 --- a/app/views/student_work/_student_work_attachment_form.html.erb +++ b/app/views/student_work/_student_work_attachment_form.html.erb @@ -1,35 +1,35 @@ -
- - -
- - <%= button_tag "文件浏览", :type=>"button", :onclick=>"$('#_file#{work.id}').click();",:onmouseover => 'this.focus()',:class => 'sub_btn' %> - <%= file_field_tag 'attachments[dummy][file]', - :id => "_file#{work.id}", - :class => 'file_selector', - :multiple => true, - :onchange => "addInputFiles_board(this, '#{work.id}');", - :style => 'display:none', - :data => { - :max_file_size => Setting.attachment_max_size.to_i.kilobytes, - :max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)), - :max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i, - :upload_path => uploads_path(:format => 'js'), - :description_placeholder => l(:label_optional_description), - :field_is_public => l(:field_is_public), - :are_you_sure => l(:text_are_you_sure), - :file_count => l(:label_file_count), - :delete_all_files => l(:text_are_you_sure_all), - :containerid => "#{work.id}" - } %> - - <%= l(:label_no_file_uploaded) %> - - (<%= l(:label_max_size) %>: - <%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>) - - <% content_for :header_tags do %> - <%= javascript_include_tag 'attachments' %> - <% end %> -
- +
+ + +
+ + <%= button_tag "文件浏览", :type=>"button", :onclick=>"$('#_file#{work.id}').click();",:onmouseover => 'this.focus()',:class => 'sub_btn mb0' %> + <%= file_field_tag 'attachments[dummy][file]', + :id => "_file#{work.id}", + :class => 'file_selector', + :multiple => true, + :onchange => "addInputFiles_board(this, '#{work.id}');", + :style => 'display:none', + :data => { + :max_file_size => Setting.attachment_max_size.to_i.kilobytes, + :max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)), + :max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i, + :upload_path => uploads_path(:format => 'js'), + :description_placeholder => l(:label_optional_description), + :field_is_public => l(:field_is_public), + :are_you_sure => l(:text_are_you_sure), + :file_count => l(:label_file_count), + :delete_all_files => l(:text_are_you_sure_all), + :containerid => "#{work.id}" + } %> + + <%= l(:label_no_file_uploaded) %> + + (<%= l(:label_max_size) %>: + <%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>) + + <% content_for :header_tags do %> + <%= javascript_include_tag 'attachments' %> + <% end %> +
+ diff --git a/app/views/student_work/_student_work_list.html.erb b/app/views/student_work/_student_work_list.html.erb index 197fecac9..2d0e9220c 100644 --- a/app/views/student_work/_student_work_list.html.erb +++ b/app/views/student_work/_student_work_list.html.erb @@ -12,6 +12,7 @@
<%= select_tag(:student_work_in_group,options_for_select(course_group_list(@course),@group), {:class => "classSplit"}) unless course_group_list(@course).empty? %> <% end%> +
diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb index e28cdb1e2..0ea5e7055 100644 --- a/app/views/student_work/index.html.erb +++ b/app/views/student_work/index.html.erb @@ -20,7 +20,7 @@ //设置评分规则 function set_score_rule(){ - $('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/set_score_rule',:locals => {:homework => @homework}) %>'); + $('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/set_score_rule',:locals => {:homework => @homework,:student_path => true}) %>'); showModal('ajax-modal', '350px'); $('#ajax-modal').siblings().remove(); $('#ajax-modal').before("" + @@ -28,6 +28,33 @@ $('#ajax-modal').parent().css("top","25%").css("left","35%").css("position","fixed"); } + $(function(){ + $("#homework_info_hidden").click(function(){ + $("#homeworkInformation").hide(); + $("#homework_info_hidden").hide(); + $("#homework_info_show").show(); + }); + $("#homework_info_show").click(function(){ + $("#homework_info_show").hide(); + $("#homeworkInformation").show(); + $("#homework_info_hidden").show(); + }); + + if($("#homework_description").height() > 54) { + $("#homeworkDetailShow").show(); + } + $("#homeworkDetailShow").click(function(){ + $("#homeworkDetail").toggleClass("max_h54"); + $("#homeworkDetailShow").hide(); + $("#homeworkDetailHide").show(); + }); + $("#homeworkDetailHide").click(function(){ + $("#homeworkDetail").toggleClass("max_h54"); + $("#homeworkDetailHide").hide(); + $("#homeworkDetailShow").show(); + }); + }); +
@@ -91,6 +118,55 @@
+
+
+ + <% if @homework.homework_detail_manual%> + <% if @homework.homework_detail_manual.comment_status == 1%> + 未开启匿评 + <% elsif @homework.homework_detail_manual.comment_status == 2%> + 匿评中 + <% elsif @homework.homework_detail_manual.comment_status == 3%> + 匿评已结束 + <% end%> + <% end%> + [ 隐藏作业信息 ] +
+
发布者:<%= @homework.user.show_name %>
+
+
<%= @homework.description.html_safe %>
+
+ + +
+
+
截止时间:<%= @homework.end_time %>
+ <% if @homework.homework_detail_manual%> + <% if @homework.homework_detail_manual.comment_status == 1%> + <% end_time = @homework.end_time.to_time.to_i + 24*60*60 - 1 %> + <% if end_time >= Time.now.to_i %> +
提交剩余时间: <%= (end_time - Time.now.to_i) / (24*60*60) %> 天 + <%= ((end_time - Time.now.to_i) % (24*60*60)) / (60*60)%> 小时 + <%= (((end_time - Time.now.to_i) % (24*60*60)) % (60*60)) / 60%>
+ <% else %> +
提交已截止
+ <% end %> + <% elsif @homework.homework_detail_manual.comment_status == 2%> + <% end_time = @homework.homework_detail_manual.evaluation_end.to_time.to_i + 24*60*60 - 1 %> + <% if end_time >= Time.now.to_i %> +
匿评剩余时间: <%= (end_time - Time.now.to_i) / (24*60*60)%> 天 + <%= ((end_time - Time.now.to_i) % (24*60*60)) / (60*60)%> 小时 + <%= (((end_time - Time.now.to_i) % (24*60*60)) % (60*60)) / 60%>
+ <% else %> +
匿评已截止
+ <% end %> + <% end%> + <% end%> +
+
+
+
+
diff --git a/app/views/users/_course_homework.html.erb b/app/views/users/_course_homework.html.erb index df42f6ee9..4bde4476d 100644 --- a/app/views/users/_course_homework.html.erb +++ b/app/views/users/_course_homework.html.erb @@ -43,9 +43,15 @@
截止时间:<%= activity.end_time.to_s %>
-
- <%= activity.description.html_safe %> +
+
+ <%= activity.description.html_safe %> +
+
+ + +
<%# if is_teacher%>
diff --git a/app/views/users/_user_activities.html.erb b/app/views/users/_user_activities.html.erb index cc8a6c0f2..b7981bdbc 100644 --- a/app/views/users/_user_activities.html.erb +++ b/app/views/users/_user_activities.html.erb @@ -39,6 +39,21 @@ $(function() { init_activity_KindEditor_data(<%= user_activity.id%>, null, "87%"); showNormalImage('activity_description_<%= user_activity.id %>'); + if($("#intro_content_<%= user_activity.id %>").height() > 360) { + $("#intro_content_show_<%= user_activity.id %>").show(); + } + $("#intro_content_show_<%= user_activity.id %>").click(function(){ + $("#activity_description_<%= user_activity.id %>").toggleClass("maxh360"); + $("#activity_description_<%= user_activity.id%>").toggleClass("lh18"); + $("#intro_content_show_<%= user_activity.id %>").hide(); + $("#intro_content_hide_<%= user_activity.id %>").show(); + }); + $("#intro_content_hide_<%= user_activity.id %>").click(function(){ + $("#activity_description_<%= user_activity.id %>").toggleClass("maxh360"); + $("#activity_description_<%= user_activity.id%>").toggleClass("lh18"); + $("#intro_content_hide_<%= user_activity.id %>").hide(); + $("#intro_content_show_<%= user_activity.id %>").show(); + }); }); <% unless user_activity.act_type == "ProjectCreateInfo" %> diff --git a/app/views/users/_user_homework_detail.html.erb b/app/views/users/_user_homework_detail.html.erb index 40400c71e..b4beb7aa3 100644 --- a/app/views/users/_user_homework_detail.html.erb +++ b/app/views/users/_user_homework_detail.html.erb @@ -43,9 +43,15 @@ <%= l(:label_end_time)%>:<%= homework_common.end_time%>
-
- <%= homework_common.description.html_safe %> +
+
+ <%= homework_common.description.html_safe %> +
+
+ + +
<%= render :partial => 'student_work/work_attachments', :locals => {:attachments => homework_common.attachments} %>
@@ -62,6 +68,9 @@
  • <%= link_to(l(:label_bid_respond_delete), homework_common_path(homework_common,:is_in_course => is_in_course),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "postOptionLink") %>
  • +
  • + <%= link_to("评分设置", score_rule_set_homework_common_path(homework_common),:class => "postOptionLink", :remote => true) %> +
  • <%= link_to("匿评设置", start_evaluation_set_homework_common_path(homework_common),:class => "postOptionLink", :remote => true) if homework_common.homework_detail_manual.comment_status == 1%>
  • diff --git a/app/views/users/_user_homework_list.html.erb b/app/views/users/_user_homework_list.html.erb index ad39ad14f..2e530d489 100644 --- a/app/views/users/_user_homework_list.html.erb +++ b/app/views/users/_user_homework_list.html.erb @@ -1,21 +1,36 @@ <%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg',"init_activity_KindEditor" %> <% homework_commons.each do |homework_common|%>