From 36bd04cc7a97afbc59ebb163f266a480b43b35e3 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Mon, 23 Mar 2015 14:09:41 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=9B=BD=E9=99=85=E5=8C=96=E8=AF=BE?= =?UTF-8?q?=E7=A8=8B=E4=BD=9C=E4=B8=9A=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/courses/homework.html.erb | 12 +++++++----- config/locales/zh.yml | 5 +++++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/app/views/courses/homework.html.erb b/app/views/courses/homework.html.erb index 8d79c9607..bc210fcff 100644 --- a/app/views/courses/homework.html.erb +++ b/app/views/courses/homework.html.erb @@ -1,9 +1,11 @@
-

课程作业

+

+ <%= l(:label_homework)%> +

- 共有<%= @obj_count%>个作业 + <%= l(:label_totle)%><%= @obj_count%><%= l(:label_homework_count)%>

<%= link_to( l(:label_course_homework_new), new_homework_course_path(@course), :class => 'problem_new_btn fl c_dorange') if @is_teacher %>
@@ -16,7 +18,7 @@ <%= l(:label_user_create_project_homework) %>: <%= link_to(bid.name, course_for_bid_path(bid), :class => 'problem_tit fl fb c_dblue') %>
-

已提交的作业 ( <%= link_to bid.homeworks.count, course_for_bid_path(bid.id), :class => 'c_red'%> )

+

<%= l(:lebel_homework_commit)%> ( <%= link_to bid.homeworks.count, course_for_bid_path(bid.id), :class => 'c_red'%> )

<% if @is_teacher%> <%= bid_anonymous_comment(bid)%> <%= link_to(l(:button_edit),edit_bid_path(:course_id =>@course.id, :bid_id => bid.id), :class => "fr mr10 work_edit") %> @@ -24,8 +26,8 @@

<%= textilizable bid, :description %> -
创建时间 : <%= format_time bid.created_on%>

-
展开更多信息 +
<%= l(:label_create_time)%> : <%= format_time bid.created_on%>

+
<%= l(:label_expend_information)%>
diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 2618c8b46..205db44ba 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -2081,4 +2081,9 @@ zh: label_input_email: 请输入邮箱地址 project_module_files: 资源库 + label_totle: 共有 + label_homework_count: 个作业 + lebel_homework_commit: 已提交的作业 + + From 5139ac30dc234dce2b9eab48c775084135446623 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Mon, 23 Mar 2015 17:18:58 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=80=81=E5=B8=88?= =?UTF-8?q?=E6=96=B0=E5=BB=BA=E4=BD=9C=E4=B8=9A=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 1 + app/views/attachments/_form.html.erb | 2 +- app/views/bids/_new_homework_form.html.erb | 41 +++++++ app/views/courses/new_homework.html.erb | 121 ++------------------- config/locales/zh.yml | 5 +- public/javascripts/course.js | 83 +++++++++++++- 6 files changed, 132 insertions(+), 121 deletions(-) create mode 100644 app/views/bids/_new_homework_form.html.erb diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 55bac3e46..ff211cde9 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -789,6 +789,7 @@ class CoursesController < ApplicationController @homework = Bid.new @homework.safe_attributes = params[:bid] @homework.open_anonymous_evaluation = 1 + @homework.deadline = (Time.now + 3600 * 24).strftime('%Y-%m-%d') if (User.current.logged? && User.current.member_of_course?(Course.find params[:id] )) render :layout => 'base_courses' else diff --git a/app/views/attachments/_form.html.erb b/app/views/attachments/_form.html.erb index 0949899dd..034cbdf1a 100644 --- a/app/views/attachments/_form.html.erb +++ b/app/views/attachments/_form.html.erb @@ -31,7 +31,7 @@ <%#= button_tag "浏览", :type=>"button", :onclick=>"CompatibleSend();" %> - <%= button_tag "浏览", :type=>"button", :onclick=>"_file.click()",:onmouseover => 'this.focus()' %> + <%= button_tag "文件浏览", :type=>"button", :onclick=>"_file.click()",:onmouseover => 'this.focus()',:class => 'sb' %> <%= file_field_tag 'attachments[dummy][file]', :id => '_file', :class => 'file_selector', diff --git a/app/views/bids/_new_homework_form.html.erb b/app/views/bids/_new_homework_form.html.erb new file mode 100644 index 000000000..3150d6b6a --- /dev/null +++ b/app/views/bids/_new_homework_form.html.erb @@ -0,0 +1,41 @@ +<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', :media => 'all' %> +<%= error_messages_for 'bid' %> +<%= hidden_field_tag 'course_id', @course.id %> +
+

<%= l(:label_course_homework_new)%>

+
+
+
    +
  • + + +

    +
  • +
  • + + +
  • +
    +
  • + + + <%= calendar_for('bid_deadline')%> +
  • +
  • + + +
    +
  • +
  • + + + <%= l(:label_evaluation_description)%> +

    +
  • +
  • + + <%= render :partial => 'attachments/form', :locals => {:container => @homework} %> +
  • +
+
+
diff --git a/app/views/courses/new_homework.html.erb b/app/views/courses/new_homework.html.erb index 2e0b35c6d..04456c4d2 100644 --- a/app/views/courses/new_homework.html.erb +++ b/app/views/courses/new_homework.html.erb @@ -1,115 +1,8 @@ - - -

<%=l(:label_course_new_homework)%>

- <%= labelled_form_for @homework, :url => {:controller => 'bids', :action => 'create_homework',:course_id => "#{params[:id] || params[:course_id]}"} do |f| %> -
- <%= render :partial => 'homework_form', :locals => { :f => f } %> - - <%= l(:button_create)%> - <%= javascript_tag "$('#bid_name').focus();" %> - <% end %> -
\ No newline at end of file + <%= render :partial => 'bids/new_homework_form', :locals => { :f => f } %> +
  • + <%= l(:button_create)%> + <%= link_to l(:button_cancel), homework_course_path(@course), :class => "blue_btn grey_btn fl c_white"%> +
    +
  • +<% end %> \ No newline at end of file diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 205db44ba..373943f05 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -2016,7 +2016,7 @@ zh: label_anonymous_comments: 匿评 label_submit_comments: 提交评论 - field_evaluation_num: 匿评分配数量 + field_evaluation_num: 匿评分配数 label_my_score: 我的评分 field_open_anonymous_evaluation: 是否使用匿评 label_course_empty_select: 尚未选择课程! @@ -2084,6 +2084,9 @@ zh: label_totle: 共有 label_homework_count: 个作业 lebel_homework_commit: 已提交的作业 + label_open_anonymous_evaluation: 是否匿评 + label_evaluation_description: 即每份作业被允许匿评的人数 + label_name_not_null: 名称不能为空 diff --git a/public/javascripts/course.js b/public/javascripts/course.js index 651013973..fdcac6601 100644 --- a/public/javascripts/course.js +++ b/public/javascripts/course.js @@ -1,3 +1,4 @@ +//验证搜索时输入名字 function regexName(content) { var name = $.trim($("#name").val()); @@ -14,26 +15,26 @@ function regexName(content) return true; } } - +//提交搜索 function submitSerch(content) { if(regexName(content)){$("#course_search_form").submit();} } - +//课程描述显示更多信息 function show_more_msg() { $("#course_description").toggleClass("course_description_none"); } - +//作业描述显示更多信息 function bid_show_more_des(id) { $("#bid_description_" + id).toggleClass("news_description_none"); } - +//将右侧的最小高度设置成左侧高度,美化界面 $(document).ready(function () { $("#RSide").css("min-height",$("#LSide").height()-30); }); - +//课程作业结束时间倒计时 function ShowCountDown(year,month,day,divname) { var now = new Date(); @@ -49,4 +50,76 @@ function ShowCountDown(year,month,day,divname) +hour+" 
     " +minute+"  " +second+" "); +} +//验证新建作业的名字 +function regex_bid_name() +{ + var name = $.trim($("#bid_name").val()); + + if(name=="") + { + $("#bid_name_span").text("名称不能为空"); + return false; + } + else + { + $("#bid_name_span").text(""); + return true; + } +} +function regex_evaluation_num() +{ + var evaluation_num = $.trim($("#bid_evaluation_num").val()); + var regex = /^\d+$/; + if($("#bid_open_anonymous_evaluation").attr("checked") == "checked") + { + if(evaluation_num=="") + { + $("#bid_evaluation_num_span").text("匿评分配数量不能为空"); + return false; + } + else if(regex.test(evaluation_num)) + { + if(evaluation_num > 0) + { + $("#bid_evaluation_num_span").text(""); + return true; + } + else + { + $("#bid_evaluation_num_span").text("匿评分配数量必须为大于0"); + return false; + } + } + else + { + $("#bid_evaluation_num_span").text("匿评分配数量只能为数字"); + return false; + } + } + else + { + return true; + } +} + +$(function(){ + $("#bid_open_anonymous_evaluation").click(function(){ + if($("#bid_open_anonymous_evaluation").attr("checked") == "checked") + { + $("#bid_evaluation_num").slideDown(); + } + else + { + $("#bid_evaluation_num").slideUp(); + } + }); +}); + +function submit_new_bid() +{ + if(regex_bid_name()&®ex_evaluation_num()) + { + $("#new_bid").submit(); + } } \ No newline at end of file From 06c57397678781cdd67977c6a4fbd249d518ebaa Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Mon, 23 Mar 2015 17:35:35 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=9B=B4=E6=96=B0css=E4=BB=A5=E5=8F=8A?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E5=9B=BE=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/images/img_floatbox.png | Bin 0 -> 1012 bytes public/stylesheets/courses.css | 122 ++++++++++++++++++++------------ public/stylesheets/leftside.css | 20 +++--- public/stylesheets/public.css | 31 +++++--- 4 files changed, 107 insertions(+), 66 deletions(-) create mode 100644 public/images/img_floatbox.png diff --git a/public/images/img_floatbox.png b/public/images/img_floatbox.png new file mode 100644 index 0000000000000000000000000000000000000000..b2167f5ffffb44e15fa2aa86f6e816dadab940f7 GIT binary patch literal 1012 zcmV(_`g8%^e{{R4h=>PzAFaQARU;qF*m;eA5Z<1fd zMgRZfy+RDBcRZ>YIIFMFfw3b-O#rB zqfK+bbKooRO98b6JOFxuzGnRp+E$Hj8p`y8SU0q-K2jIY0?!msOTeUzOz(M38roKk zZUiM^CS_z|-E<@>zzcc!C-6odx&)M3t(?%dYIIFMh;>8Ts?k;DbryIE90ODGv%YrA zSw^ZxH%e0@Ab=|}Z6^}O_)Bf3MptEY)kQCXhq48{0)Au|{anlR1Ep>ns;GdOk_L`) zdjdR?P(8qDi!f8tz$N)vtZVu~PiR}G=?E<L)Ds8gnaG>`_;KpIE`X`pTaavW#N zahxFcCunuPyL}N6Dt1a(Mz=^*w0>?rKtJ5AT@#i_@ro31MvnltK@-X!T zum_B$p%O5oa?ibnfASs2sR9Tg3T>oqP!6Hd#p6IV1yfF@v{0#3wpuXoR+RG=pvZ!0 zCuL1XO$c!)BNL@B69%9tgc$2o$`Y&E;C+6bT4CTl;0Cavsy-uUm~o(-fI8C>j2vOg zLWo1@n{rl5=wyV}vka_&T5ksEgM78Rz60A?)s%qRmV5Qn4-KS&G>`_;KpN=304nb9 z?<>FXJZ}rAx~{97E{2DP^=#kPnwgo2XM5Lmk210l&-U~4^ZCv8@?sUt#m)9fs07TJ z*}h{yuIr{J)=kgz1{E;nWJ(Lu)6*@@_EFBWR#d&7=hdCTxG87 zj%8FpRSN!Fv%SJI@ocZEJ|kzCGqZgf%E%F>?7Hru^i4UdCFC~SCk?EC%6GO`RZ{{= i&-NNf1O4AXzXt%Mbf5S7A4@j?0000body #ajax-indicator { position: fixed; } padding-left: 26px; vertical-align: bottom; } +/*弹出框*/ +.black_overlay{display:none;position:fixed;top:0px;left:0px;width:100%;height:100%;background-color:black;z-index:1001;-moz-opacity:0.8;opacity:.80;filter:alpha(opacity=80);} +.white_content{display:none;position:fixed;top:15%;left:30%;width:420px;height: auto; margin-bottom:20px;padding:16px;border:3px solid #15bccf;background-color:white;z-index:1002;overflow:auto;} +.floatbox{ width:420px; border:3px solid #15bccf; background:#fff; padding:5px;} +a.box_close{ display:block; float:right; width:16px; height:16px; background:url(../images/img_floatbox.png) 0 0 no-repeat;} +a.box_close{background:url(../images/img_floatbox.png) -22px 0 no-repeat;}