From 65331b99f5901ddcc9fd7fd2ca2cd02c3d0a0745 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 17 Jul 2017 16:14:09 +0800 Subject: [PATCH 01/13] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=AE=9E=E8=AE=AD?= =?UTF-8?q?=E9=A6=96=E9=A1=B5=E7=9A=84=E2=80=9C=E6=9F=A5=E7=9C=8B=E5=BD=92?= =?UTF-8?q?=E6=A1=A3=E2=80=9D=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 19 ++++++++----- app/views/courses/index.html.erb | 39 ++++++++++++++++++++------- app/views/courses/index.js.erb | 16 ++++++++--- 3 files changed, 54 insertions(+), 20 deletions(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index a230ea47e..53a03715c 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -44,22 +44,29 @@ class CoursesController < ApplicationController @user = User.current @search = params[:search].nil? ? '' : params[:search] @select = params[:select].nil? ? '' : params[:select] - # 全部课堂 + @is_end = params[:is_end].nil? ? 0 : params[:is_end].to_i #是否归档 + @syllabuses_num = Course.where("is_end = 0 and is_delete = 0").count - all_syllabuses = Course.where("is_end = 0 and is_delete = 0 and name like '%#{@search}%'").order("created_at desc") - # 我参与的课堂 - join_syllabuses = @user.courses.where("is_end = 0 and is_delete = 0 and tea_id != #{@user.id} and name like '%#{@search}%'").order("created_at desc") + #@syllabus_count = all_syllabuses.count # 我创建的课堂 - create_syllabuses = Course.where(:tea_id => @user.id).where("is_end = 0 and is_delete = 0 and name like '%#{@search}%'").order("created_at desc") - @syllabus_count = all_syllabuses.count + create_syllabuses = Course.where(:tea_id => @user.id).where("is_end = #{@is_end} and is_delete = 0 and name like '%#{@search}%'") + # 我参与的课堂 + join_syllabuses = @user.courses.where("is_end = #{@is_end} and is_delete = 0 and tea_id != #{@user.id} and name like '%#{@search}%'") @join_syllabuses_count = join_syllabuses.count @create_syllabuses_count = create_syllabuses.count + # 页面筛选的课程 if @select == "create" @syllabuses = create_syllabuses elsif @select == "join" @syllabuses = join_syllabuses + elsif @select == "end" + # 归档的课堂 + end_syllabuses = Course.where("is_end = #{@is_end} and name like '%#{@search}%'") + @syllabuses = end_syllabuses else + # 全部课堂 + all_syllabuses = Course.where("is_end = #{@is_end} and is_delete = 0 and name like '%#{@search}%'") @syllabuses = all_syllabuses end diff --git a/app/views/courses/index.html.erb b/app/views/courses/index.html.erb index 82d6a1405..db5dd17a8 100644 --- a/app/views/courses/index.html.erb +++ b/app/views/courses/index.html.erb @@ -8,15 +8,16 @@
- @search) %>" class="course_filtrate fl course_filtrate_bg" data-tab="all" data-remote="true">全部课堂 - @search) %>" class="course_filtrate fl" data-tab="create" data-remote="true">我管理的 - @search) %>" class="course_filtrate fl" data-tab="join" data-remote="true">我参与的 + @is_end,:search => @search) %>" id="courses_index_syllabuses_1" class="course_filtrate fl course_filtrate_bg" data-tab="all" data-remote="true">全部课堂 + @is_end, :search => @search) %>" id="courses_index_syllabuses_2" class="course_filtrate fl" data-tab="create" data-remote="true">我管理的 + @is_end, :search => @search) %>" id="courses_index_syllabuses_3" class="course_filtrate fl" data-tab="join" data-remote="true">我参与的 -
+ \ No newline at end of file diff --git a/app/views/challenges/_edit_answer.html.erb b/app/views/challenges/_edit_answer.html.erb new file mode 100644 index 000000000..e1027e9a0 --- /dev/null +++ b/app/views/challenges/_edit_answer.html.erb @@ -0,0 +1,88 @@ +
+
+
+

+ <% if @shixun.status == 0 && User.current.manager_of_shixun?(@shixun) %> + 编辑 + <% end %> +

+
+ +
+ +
+ \ No newline at end of file diff --git a/app/views/challenges/_edit_evaluating.html.erb b/app/views/challenges/_edit_evaluating.html.erb new file mode 100644 index 000000000..bbc795b3a --- /dev/null +++ b/app/views/challenges/_edit_evaluating.html.erb @@ -0,0 +1,66 @@ + +
+
"> +
+

+ <% if @shixun.status == 0 && User.current.manager_of_shixun?(@shixun) %> + 编辑 + <% end %> +

+
+ +
+ +
+ \ No newline at end of file diff --git a/app/views/challenges/_edit_scoring.html.erb b/app/views/challenges/_edit_scoring.html.erb new file mode 100644 index 000000000..4c19ce5bd --- /dev/null +++ b/app/views/challenges/_edit_scoring.html.erb @@ -0,0 +1,37 @@ + +
+
"> +
+

+ <% if @shixun.status == 0 && User.current.manager_of_shixun?(@shixun) %> + 编辑 + <% end %> +

+
+ +
+ +
+ \ No newline at end of file diff --git a/app/views/challenges/_edit_skill.html.erb b/app/views/challenges/_edit_skill.html.erb new file mode 100644 index 000000000..2a00676bd --- /dev/null +++ b/app/views/challenges/_edit_skill.html.erb @@ -0,0 +1,36 @@ +
+
"> +
+

+ <% if @shixun.status == 0 && User.current.manager_of_shixun?(@shixun) %> + 编辑 + <% end %> +

+
+ +
+ +
+ diff --git a/app/views/challenges/_edit_task_pass.html.erb b/app/views/challenges/_edit_task_pass.html.erb new file mode 100644 index 000000000..bbaf8f006 --- /dev/null +++ b/app/views/challenges/_edit_task_pass.html.erb @@ -0,0 +1,95 @@ +
+
+
+

+ <% if @shixun.status == 0 && User.current.manager_of_shixun?(@shixun) %> + 编辑 + <% end %> +

+
+ +
+ +
+ \ No newline at end of file diff --git a/app/views/challenges/_evaluating_form.html.erb b/app/views/challenges/_evaluating_form.html.erb new file mode 100644 index 000000000..83fb35cc1 --- /dev/null +++ b/app/views/challenges/_evaluating_form.html.erb @@ -0,0 +1,167 @@ + + +
+
  • + + <%= f.text_field :path, :class => "panel-form-width-690 panel-box-sizing fl", :no_label => true, :placeholder => "进入实训后将默认打开该文件,如:src/test/welcome.java", :maxlength => "256" %> +
  • +
  • + + <%= f.text_field :exec_path, :class => "panel-form-width-690 panel-box-sizing fl", :no_label => true, :placeholder => "输入关卡需要执行的文件路径,如:src/test/main.java", :maxlength => "256" %> +
  • +
  • + + <%= select_tag :evaluation_way, options_for_select([["输入输出", 1]]), :name => 'challenge[evaluation_way]', :class => " fl", :style => "height: 40px; width:200px;" %> + 请选择自动检测学员是否完成本任务的评测标准 +
  • +
  • + <% if params[:action] == "edit" && @challenge.test_sets.count > 0 %> + + + <% else %> + + + <% end %> +
  • +
  • + 保存 + 取消 +
  • +
    + + diff --git a/app/views/challenges/_score_form.html.erb b/app/views/challenges/_score_form.html.erb new file mode 100644 index 000000000..7f8e66622 --- /dev/null +++ b/app/views/challenges/_score_form.html.erb @@ -0,0 +1,81 @@ +
    +
  • + + <%= radio_button_tag("challenge[difficulty]", 1, checked = (@challenge.difficulty ==1 ? true : false)) %>简单 + <%= radio_button_tag("challenge[difficulty]", 2, checked = (@challenge.difficulty ==2 ? true : false)) %>中等 + <%= radio_button_tag("challenge[difficulty]", 3, checked = (@challenge.difficulty ==3 ? true : false)) %>困难 + +
  • + +
  • + + <%#= f.text_field :score, :class => "panel-form-height-30 fl", :no_label => true, :style => "padding:5px;", :placeholder => "请输入分值(只能是数字)" %> + <%= select_tag :challenge_score, options_for_select([100, 200]), :name => 'challenge[score]', :class => " fl", :style => "height: 40px; width:170px;" %> +
    + +
  • + +
    +
      +
    1. 如果学员查看了参考答案,则不能得到相应的经验值
    2. +
    3. 如果学员成功得到经验值,那么将同时获得等值的金币奖励,如:+100经验值、+100金币
    4. +
    +
    + +
  • + 保存 + 取消 +
  • +
    + + diff --git a/app/views/challenges/_skill_form.html.erb b/app/views/challenges/_skill_form.html.erb new file mode 100644 index 000000000..e7f0f81b9 --- /dev/null +++ b/app/views/challenges/_skill_form.html.erb @@ -0,0 +1,63 @@ +
    +
  • + +
    + <% if params[:action] == "edit" && @challenge_tags.count > 0 %> + <% @challenge_tags.each do |tag| %> +
    + + +
    + <% end %> + <% end %> + +
    + + +
    + +添加 +
    +
  • +

    +
    +
      +
    1. 学员为参考答案通过了本阶段的评测时将获得技能,否则不能获得技能
    2. +
    +
    + +
  • + 保存 + 取消 +
  • +
    + + diff --git a/app/views/challenges/_task_pass_form.html.erb b/app/views/challenges/_task_pass_form.html.erb new file mode 100644 index 000000000..e1849fc65 --- /dev/null +++ b/app/views/challenges/_task_pass_form.html.erb @@ -0,0 +1,107 @@ +<%= stylesheet_link_tag '/editormd/css/editormd','/editormd/css/editormd.min.css' %> +<%= javascript_include_tag '/editormd/editormd.min.js','/editormd/examples/js/jquery.min.js' %> + + + +
    +
  • + + <%= f.text_field :subject, :class => "panel-form-width-690 fl panel-box-sizing", :no_label => true, :placeholder => "请输入当前任务的名称(此信息将提前泄露给学员)" %> + +
  • +
  • + +
    + +
    + +
  • +
  • + 保存 + 取消 +
  • +
    + + diff --git a/app/views/challenges/edit.html.erb b/app/views/challenges/edit.html.erb index bf88b7a80..5ca77ad4d 100644 --- a/app/views/challenges/edit.html.erb +++ b/app/views/challenges/edit.html.erb @@ -1,22 +1,54 @@ -<%= content_for(:header_tags) do %> - <%= import_ke(enable_at: true, prettify: false, init_activity: false) %> - <%= javascript_include_tag "/assets/codemirror/codemirror_python_ruby_c" %> - <%= stylesheet_link_tag "/assets/codemirror/codemirror" %> -<% end %> +<%= javascript_include_tag "/assets/codemirror/codemirror_python_ruby_c" %> +<%= stylesheet_link_tag "/assets/codemirror/codemirror" %> + +<%= stylesheet_link_tag '/editormd/css/editormd','/editormd/css/editormd.min.css' %> +<%= javascript_include_tag '/editormd/lib/marked.min.js','/editormd/lib/prettify.min.js','/editormd/lib/raphael.min.js','/editormd/lib/underscore.min.js','/editormd/lib/sequence-diagram.min.js', + '/editormd/lib/flowchart.min.js','/editormd/lib/jquery.flowchart.min.js','/editormd/editormd.js' %> +
    -

    编辑阶段(第<%= @challenge.position %>关)

    +

    阶段编辑(第<%= @challenge.position %>关)

    -
    -
      - <%= labelled_form_for @challenge, :url => shixun_challenge_path(@challenge, :shixun_id => @shixun) do |f| %> - <%= render :partial => "form", :locals => {:f => f} %> - <% end %> -
    -
    - +
    + +
    + <% if @tab == 1 || @tab.blank? %> + <%= render :partial => "edit_task_pass" %> + <% elsif @tab == 2 %> + <%= render :partial => "edit_evaluating" %> + <% elsif @tab == 3 %> + <%= render :partial => "edit_answer" %> + <% elsif @tab == 4 %> + <%= render :partial => "edit_scoring" %> + <% elsif @tab == 5 %> + <%= render :partial => "edit_skill" %> + <% end %>
    - diff --git a/app/views/challenges/new.html.erb b/app/views/challenges/new.html.erb index a5234ce72..a01035538 100644 --- a/app/views/challenges/new.html.erb +++ b/app/views/challenges/new.html.erb @@ -1,5 +1,24 @@ <%= javascript_include_tag "/assets/codemirror/codemirror_python_ruby_c" %> <%= stylesheet_link_tag "/assets/codemirror/codemirror" %> + + +
    +
    +

    新建阶段

    +
    +
    + +
    +
    + + + + +<% if false %>

    新建阶段

    @@ -12,6 +31,6 @@
    - +<% end %> diff --git a/config/routes.rb b/config/routes.rb index f7f5da845..87ecd788b 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -92,6 +92,7 @@ RedmineApp::Application.routes.draw do match 'game_build_result', :via => [:get, :post] get 'index_up' get 'index_down' + match 'update_evaluation', :via => [:get, :post, :put] end end diff --git a/public/stylesheets/css/edu-common.css b/public/stylesheets/css/edu-common.css index fda3ebc33..d143301bf 100644 --- a/public/stylesheets/css/edu-common.css +++ b/public/stylesheets/css/edu-common.css @@ -161,6 +161,7 @@ a.course-bth-blue{cursor: pointer;background-color:#199ed8 ;color: #ffffff;displ .pr {position:relative;} .w100{width: 100px;} .w150{width: 150px;} +.w850{width: 850px;} .with10{ width: 10%;}.with15{ width: 15%;} .with20{ width: 20%;}.with25{ width: 25%;} .with30{ width: 30%;}.with35{ width: 35%;} diff --git a/public/stylesheets/css/edu-public.css b/public/stylesheets/css/edu-public.css index 235a68806..f7dd72849 100644 --- a/public/stylesheets/css/edu-public.css +++ b/public/stylesheets/css/edu-public.css @@ -269,3 +269,6 @@ a:hover.task-btn-line{ border:1px solid #3498db;background:#3498db;color: #fff;} /*新增的公用样式*/ .box-boxshadow{box-shadow: 3px 3px 10px rgba(146, 153, 169, 0.2);} +.prop-notice-info{padding: 10px;border:1px solid #F3DDB3;background-color: #FFFEF4;} +.prop-notice-info ol{list-style-type: disc;list-style-position:inside} +.prop-notice-info ol li{list-style-type: disc;color: #ff6532;margin-bottom:0!important;} \ No newline at end of file From 8f5111c3a0bb3fbaa35f17ce25d0d726eee25135 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 21 Jul 2017 09:12:42 +0800 Subject: [PATCH 11/13] =?UTF-8?q?5=E4=B8=AAtab?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/challenges_controller.rb | 3 +- app/views/challenges/_answer_form.html.erb | 54 ++++++++- app/views/challenges/_edit_answer.html.erb | 97 ++++------------ app/views/challenges/_edit_task_pass.html.erb | 109 +++++------------- app/views/challenges/edit.html.erb | 12 +- public/stylesheets/css/edu-common.css | 1 + 6 files changed, 115 insertions(+), 161 deletions(-) diff --git a/app/controllers/challenges_controller.rb b/app/controllers/challenges_controller.rb index ca5944f40..953a3575f 100644 --- a/app/controllers/challenges_controller.rb +++ b/app/controllers/challenges_controller.rb @@ -92,7 +92,8 @@ class ChallengesController < ApplicationController end def edit - @tab = params[:tab].blank? ? 1 : params[:tab].to_i + @tab = params[:tab].blank? ? 1 : params[:tab].to_i + @editor = params[:editor] # 编辑模式 end def destroy diff --git a/app/views/challenges/_answer_form.html.erb b/app/views/challenges/_answer_form.html.erb index d3be65ee3..9e7ed5cde 100644 --- a/app/views/challenges/_answer_form.html.erb +++ b/app/views/challenges/_answer_form.html.erb @@ -24,8 +24,54 @@ \ No newline at end of file diff --git a/app/views/challenges/_edit_answer.html.erb b/app/views/challenges/_edit_answer.html.erb index e1027e9a0..1d4df206e 100644 --- a/app/views/challenges/_edit_answer.html.erb +++ b/app/views/challenges/_edit_answer.html.erb @@ -1,26 +1,30 @@
    -
    -
    -

    - <% if @shixun.status == 0 && User.current.manager_of_shixun?(@shixun) %> - 编辑 - <% end %> -

    -
    - -
    - + +
    + <% end %> + <% if @challenge.answer.blank? || !@editor.blank? %> + + <% end %> \ No newline at end of file diff --git a/app/views/challenges/_edit_task_pass.html.erb b/app/views/challenges/_edit_task_pass.html.erb index bbaf8f006..65409d177 100644 --- a/app/views/challenges/_edit_task_pass.html.erb +++ b/app/views/challenges/_edit_task_pass.html.erb @@ -1,32 +1,36 @@
    -
    -
    -

    - <% if @shixun.status == 0 && User.current.manager_of_shixun?(@shixun) %> - 编辑 + <% if @editor.blank? && @challenge.subject %> +

    +
    +

    + <% if @shixun.status == 0 && User.current.manager_of_shixun?(@shixun) %> + 编辑 + <% end %> +

    +
    +
      +
    • + +
      + <%= @challenge.subject %> +
      +
    • +
    • + +
      + +
      +
    • +
    +
    + <% end %> + <% if @challenge.subject.blank? || !@editor.blank? %> +
      + <%= labelled_form_for @challenge, :url => shixun_challenge_path(@challenge, :shixun_id => @shixun, :tab => 1), :html => {:id => "challenge_shixun_update"} do |f| %> + <%= render :partial => "task_pass_form", :locals => {:f => f} %> <% end %> -

      -
    - -
    - + + <% end %>
    \ No newline at end of file diff --git a/app/views/challenges/edit.html.erb b/app/views/challenges/edit.html.erb index 5ca77ad4d..55bae7a68 100644 --- a/app/views/challenges/edit.html.erb +++ b/app/views/challenges/edit.html.erb @@ -22,20 +22,20 @@
    diff --git a/public/stylesheets/css/edu-common.css b/public/stylesheets/css/edu-common.css index d143301bf..c516295b8 100644 --- a/public/stylesheets/css/edu-common.css +++ b/public/stylesheets/css/edu-common.css @@ -38,6 +38,7 @@ textarea{resize: none;} /*通用文字功能样式*/ .font-bd{ font-weight: bold;} .color-red{ color:#d2322d!important;} +.color-black{color:#333!important;} .color-green{color:#51a74f!important;} .color-light-green{color:#29bd8b!important;} .color-blue{color:#3498db!important;} From 1af54cf724f210e6566afb18135d42541d5f8c31 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 21 Jul 2017 09:34:52 +0800 Subject: [PATCH 12/13] =?UTF-8?q?=E5=9C=A8=E6=B2=A1=E6=9C=89=E6=9D=83?= =?UTF-8?q?=E9=99=90=E8=AE=BF=E9=97=AE=E7=9A=84=E9=A1=B5=E9=9D=A2=E5=92=8C?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E9=A1=B5=E9=9D=A2=E5=88=A0=E9=99=A4=E4=BA=86?= =?UTF-8?q?=E7=9A=84=E9=A1=B5=E9=9D=A2=EF=BC=8C=E5=BA=95=E9=83=A8=E5=8A=A0?= =?UTF-8?q?=E5=85=A5QQ=E8=AE=A8=E8=AE=BA=E7=BE=A4=E7=9A=84=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E5=8F=98=E7=AA=84=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/stylesheets/application.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index 6f471eb50..3903e369c 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -2835,7 +2835,7 @@ div.repos_explain{ .upload_img img{max-width: 100%;} #activity .upload_img img{max-width: 580px;} -img,embed{max-width: 100%;} +/*img,embed{max-width: 100%;}*/ img.school_avatar { background: rgb(245, 245, 245); From de4c84be003a9c65e76ceaae929720773d2f33da Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 21 Jul 2017 09:54:51 +0800 Subject: [PATCH 13/13] =?UTF-8?q?=E6=96=B0=E5=BB=BA=E5=AE=9E=E8=AE=AD?= =?UTF-8?q?=E8=B7=B3=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/shixuns/_form.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/shixuns/_form.html.erb b/app/views/shixuns/_form.html.erb index 196533db1..c5fc79b5f 100644 --- a/app/views/shixuns/_form.html.erb +++ b/app/views/shixuns/_form.html.erb @@ -60,7 +60,7 @@
  • 提交 - <%= link_to "取消", shixuns_path,:class => "task-btn fr mr10" %> + <%= link_to "取消", shixuns_path, :class => "task-btn fr mr10" %>
  • <% end %>