From 8439e73c7c1e3b672c1351d0c6784f79fa24953f Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 10 Apr 2017 11:23:49 +0800 Subject: [PATCH 01/74] =?UTF-8?q?ignore=E6=96=87=E4=BB=B6=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..bb4b68554 --- /dev/null +++ b/.gitignore @@ -0,0 +1,39 @@ +*.swp +/.project +/.idea +/.bundle +*.swp +/config/database.yml +/config/configuration.yml +/config/additional_environment.rb +/config/oneapm.yml +/config/environments/production.rb + + +/files/* +/log/* +/public/tmp/* +/tmp/* +/public/cache/* +/config/newrelic.yml +/public/images/avatars/* +/db/schema.rb +/Gemfile.lock +/lib/plugins/acts_as_versioned/test/debug.log +.rbenv-gemsets +.DS_Store +public/api_doc/ +/.metadata +vendor/cache +/files +/public/images/avatars +/public/files +/tags +/config/initializers/gitlab_config.rb +1234567 +public/javascripts/wechat/node_modules/ +.ruby-version +.access_token +tmux*.log +config/wechat.yml +config/oneapm.yml From e7aaf0941006a1ee0236fb2dd550e45523f886d4 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 10 Apr 2017 16:19:17 +0800 Subject: [PATCH 02/74] =?UTF-8?q?editorMD=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/challenges/_form.html.erb | 28 +++++++++++++++++----------- app/views/challenges/show.html.erb | 2 +- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/app/views/challenges/_form.html.erb b/app/views/challenges/_form.html.erb index ababe3b8e..d06791a90 100644 --- a/app/views/challenges/_form.html.erb +++ b/app/views/challenges/_form.html.erb @@ -7,17 +7,23 @@ @@ -57,7 +63,7 @@
<%#= f.text_area :ready_knowledge, :placeholder => "请输入完成当前任务依赖的知识点或者其它相关信息,指导学员完成任务" %> - +
<%#= f.kindeditor :ready_knowledge, :placeholder => "请输入完成当前任务依赖的知识点或者其它相关信息,指导学员完成任务", :width=>'87.5%', :height => 159, :resizeType => 0, :no_label => true %> diff --git a/app/views/challenges/show.html.erb b/app/views/challenges/show.html.erb index 0e3e60090..1364e7414 100644 --- a/app/views/challenges/show.html.erb +++ b/app/views/challenges/show.html.erb @@ -48,7 +48,7 @@
  • -
    +
    <%#= @challenge.ready_knowledge.blank? ? "无" : (h @challenge.ready_knowledge.html_safe) %> From 0aec565f5eaec2396529d327ffc8f3dd0cdb5cfd Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 10 Apr 2017 16:33:34 +0800 Subject: [PATCH 03/74] =?UTF-8?q?editorMD=E4=B8=8A=E4=BC=A0=E5=9B=BE?= =?UTF-8?q?=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/challenges/_form.html.erb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/views/challenges/_form.html.erb b/app/views/challenges/_form.html.erb index d06791a90..ec025c3f7 100644 --- a/app/views/challenges/_form.html.erb +++ b/app/views/challenges/_form.html.erb @@ -21,7 +21,18 @@ //这个配置在simple.html中并没有,但是为了能够提交表单,使用这个配置可以让构造出来的HTML代码直接在第二个隐藏的textarea域中,方便post提交表单。 saveHTMLToTextarea : true, // 用于增加自定义工具栏的功能,可以直接插入HTML标签,不使用默认的元素创建图标 - placeholder: "请输入完成当前任务依赖的知识点或者其它相关信息" + placeholder: "请输入完成当前任务依赖的知识点或者其它相关信息", + imageUpload : true, + imageFormats : ["jpg", "jpeg", "gif", "png", "bmp", "webp"], + imageUploadURL : "" //url + /* + 上传的后台只需要返回一个 JSON 数据,结构如下: + { + success : 0 | 1, // 0 表示上传失败,1 表示上传成功 + message : "提示的信息,上传成功或上传失败及错误信息等。", + url : "图片地址" // 上传成功时才返回 + } + */ }); }); From fa21ceb07b86624c30fce9309b815ceeeebbbb92 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 10 Apr 2017 16:58:24 +0800 Subject: [PATCH 04/74] =?UTF-8?q?Codemirror=E6=A0=B7=E5=BC=8F=E5=BD=B1?= =?UTF-8?q?=E5=93=8DeditorMD=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/challenges/_form.html.erb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/views/challenges/_form.html.erb b/app/views/challenges/_form.html.erb index ec025c3f7..26004ac79 100644 --- a/app/views/challenges/_form.html.erb +++ b/app/views/challenges/_form.html.erb @@ -4,7 +4,17 @@ <%= stylesheet_link_tag '/editormd/css/editormd','/editormd/css/editormd.min' %> <%= javascript_include_tag '/editormd/editormd.min.js','/editormd/examples/js/jquery.min.js' %> - + <% end %> From 7a59b013a007e391da1547f5d9ca38fc831480b6 Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 11 Apr 2017 11:09:06 +0800 Subject: [PATCH 09/74] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E5=BC=80=E5=90=AF?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E4=BF=AE=E6=94=B9=EF=BC=8C=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E6=9D=83=E9=99=90=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/shixuns_controller.rb | 9 +++++++-- app/helpers/application_helper.rb | 2 +- app/views/repositories/_shixun_dir_list_content.html.erb | 1 - app/views/shixuns/_shixun_top.html.erb | 5 ++--- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index bd92c6b9e..0511f8375 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -22,11 +22,16 @@ class ShixunsController < ApplicationController # copy_shixun:复制一个新的实训模块包括版本库 # copy_myshixun自动创建系列game,game中只包含状态等信息,公共信息从Challeges中读取 - # + # 开启过实训的则直接跳入my实训页面 def shixun_exec - if has_exec_cur_shixun(@shixun) || User.current.id == @shixun.user_id + unless allow_shixun_exec(@shixun) render_403 end + myshixun = Myshixun.where(:user_id => User.current.id, :shixun_id => @shixun.id).first + unless myshixun.blank? + redirect_to myshixun_game_path(myshixun.current_task, :myshixun_id => myshixun.id) + return + end repository = @shixun.repository ActiveRecord::Base.transaction do begin diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index e9de11325..1799122c7 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -276,7 +276,7 @@ module ApplicationHelper end def allow_shixun_exec shixun - (User.current.logged? && User.current.id != shixun.user_id && shixun.status == 1) + (User.current.logged? && User.current.id != shixun.user_id && shixun.challenges.count > 0 && !shixun.repository.blank?) end # 通过系统外部邮箱查找用户,如果用户不存在则用邮箱替换 diff --git a/app/views/repositories/_shixun_dir_list_content.html.erb b/app/views/repositories/_shixun_dir_list_content.html.erb index 79a9d1512..ab6493cfa 100644 --- a/app/views/repositories/_shixun_dir_list_content.html.erb +++ b/app/views/repositories/_shixun_dir_list_content.html.erb @@ -16,7 +16,6 @@ :repository_id => @repository.identifier_param, :path => to_path_param(ent_path), :rev => @rev, - :depth => (depth + 1), :parent_id => tr_id)) %>');">  <% end %> diff --git a/app/views/shixuns/_shixun_top.html.erb b/app/views/shixuns/_shixun_top.html.erb index c61030f1e..7f95a51b6 100644 --- a/app/views/shixuns/_shixun_top.html.erb +++ b/app/views/shixuns/_shixun_top.html.erb @@ -6,10 +6,9 @@ /

    <%= @shixun.name %>

    <% if allow_shixun_exec(@shixun) %> - <%= link_to "开始挑战", shixun_monitor_shixun_path(@shixun), + <%= link_to "开始挑战", shixun_exec_shixun_path(@shixun), :class => "fr task-btn task-btn-orange", - :id => "challenge_begin", - :remote => true %> + :id => "challenge_begin" %> <% end %>
    From ca2e7a9c6c3e2d481d655f17245f416a661fe2a4 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 11 Apr 2017 13:53:01 +0800 Subject: [PATCH 10/74] =?UTF-8?q?=E5=AE=9E=E8=AE=ADTPM=E8=BF=87=E5=85=B3?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E4=BD=BF=E7=94=A8MD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/challenges/_form.html.erb | 46 ++++++++++++++++++++++++----- 1 file changed, 39 insertions(+), 7 deletions(-) diff --git a/app/views/challenges/_form.html.erb b/app/views/challenges/_form.html.erb index 138a93fd2..7c65026c2 100644 --- a/app/views/challenges/_form.html.erb +++ b/app/views/challenges/_form.html.erb @@ -45,6 +45,34 @@ } */ }); + taskpass_editormd = editormd("challenge_task_pass", { + width : "89.6%", + height : 300, + syncScrolling : "single", + //你的lib目录的路径,我这边用JSP做测试的 + path : "/editormd/lib/", + toolbarIcons : function() { + // Or return editormd.toolbarModes[name]; // full, simple, mini + // Using "||" set icons align right. + return ["bold", "italic", "|", "h1", "h2", "h3", "|", "list-ul", "list-ol", "|", "image", "code", "code-block", "|", "watch", "clear"] + }, + //这个配置在simple.html中并没有,但是为了能够提交表单,使用这个配置可以让构造出来的HTML代码直接在第二个隐藏的textarea域中,方便post提交表单。 + saveHTMLToTextarea : true, + // 用于增加自定义工具栏的功能,可以直接插入HTML标签,不使用默认的元素创建图标 + dialogMaskOpacity : 0.6, + placeholder: "请输入完成当前任务依赖的知识点或者其它相关信息", + imageUpload : true, + imageFormats : ["jpg", "jpeg", "gif", "png", "bmp", "webp"], + imageUploadURL : "" //url + /* + 上传的后台只需要返回一个 JSON 数据,结构如下: + { + success : 0 | 1, // 0 表示上传失败,1 表示上传成功 + message : "提示的信息,上传成功或上传失败及错误信息等。", + url : "图片地址" // 上传成功时才返回 + } + */ + }); }); @@ -92,7 +120,11 @@
  • <%#= f.kindeditor :task_pass, :editor_id => "challenge_task_pass", :width=>'87.5%', :height => 159, :resizeType => 0, :no_label => true %> - <%= f.text_area :task_pass, :class => "panel-form-width-690 panel-box-sizing", :no_label => true %> + <%#= f.text_area :task_pass, :class => "panel-form-width-690 panel-box-sizing", :no_label => true %> +
    + <%#= f.text_area :ready_knowledge, :placeholder => "请输入完成当前任务依赖的知识点或者其它相关信息,指导学员完成任务" %> + +
  • @@ -211,10 +243,10 @@
  • <% if params[:action] == "edit" %> - 保存 + 保存 取消 <% else %> - 保存 + 保存 取消 <% end %> @@ -300,7 +332,7 @@ function challenge_create(){ if($('#challenge_subject').val().trim() == ""){ $("#new_shixun_name").show(); - }else if($("#challenge_task_pass").val().trim() == ""){ + }else if($("#challenge_task_pass textarea").val().trim() == ""){ $("#new_shixun_pass").show(); }else if($("#challenge_score").val().trim()==""){ $("#new_shixun_score").show(); @@ -312,7 +344,7 @@ function challenge_update(){ if($('#challenge_subject').val().trim() == ""){ $("#new_shixun_name").show(); - }else if($("#challenge_task_pass").val().trim() == ""){ + }else if($("#challenge_task_pass textarea").val().trim() == ""){ $("#new_shixun_pass").show(); }else if($("#challenge_score").val().trim()==""){ $("#new_shixun_score").show(); @@ -335,7 +367,7 @@ $('#challenge_answer').val(cMirror.getValue()); }); - challenge_task_pass_editor = KindEditor.create('#challenge_task_pass', + /* challenge_task_pass_editor = KindEditor.create('#challenge_task_pass', {"width":"89.7%", "resizeType":0, "no_label":true, @@ -358,7 +390,7 @@ "fileManagerJson":"/kindeditor/filemanager" }); - +*/ function add_tag(){ var num = $(".task-bd-grey").children('div').length; var val = $(".task-tag-input").val().trim(); From 0be0467cb7c0947a2946ee412496898021665c59 Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 11 Apr 2017 14:05:50 +0800 Subject: [PATCH 11/74] =?UTF-8?q?challenge=E6=96=B0=E5=8A=A0=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E5=90=8E=E6=96=B0=E5=BB=BA=E3=80=81=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E7=9B=B8=E5=BA=94=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/challenges_helper.rb | 12 ++++++++++++ app/views/challenges/_form.html.erb | 8 ++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/app/helpers/challenges_helper.rb b/app/helpers/challenges_helper.rb index 86b0183c9..06d71f9bb 100644 --- a/app/helpers/challenges_helper.rb +++ b/app/helpers/challenges_helper.rb @@ -1,2 +1,14 @@ +# encoding: utf-8 module ChallengesHelper + + def difficulty_type difficulty + case difficulty + when 1 + "简单" + when 2 + "中等" + when 3 + "复杂" + end + end end diff --git a/app/views/challenges/_form.html.erb b/app/views/challenges/_form.html.erb index 138a93fd2..b520f705b 100644 --- a/app/views/challenges/_form.html.erb +++ b/app/views/challenges/_form.html.erb @@ -97,7 +97,7 @@
  • - <%= select_tag :evaluation, options_for_select([["输出输出", 1], ["文件存在", 2]]), :name => 'challenge[evaluation]', :class => "ml5", :style => "height: 28px;" %> + <%= select_tag :evaluation_way, options_for_select([["输出输出", 1], ["文件存在", 2]]), :name => 'challenge[evaluation_way]', :class => "ml5", :style => "height: 28px;" %>
  • @@ -197,9 +197,9 @@
  • - - - + + +
  • From 43d11c538881b15fc4a3de43659626931503eeda Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 11 Apr 2017 16:38:17 +0800 Subject: [PATCH 12/74] =?UTF-8?q?tpi=E6=94=B9=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/base_myshixun.html.erb | 348 +++++++- public/images/task/coin.png | Bin 0 -> 26748 bytes public/stylesheets/css/bigdata-common.css | 232 +++--- public/stylesheets/css/bigdata-public.css | 161 +++- public/stylesheets/css/font-awesome.css | 968 +++++++++++----------- public/stylesheets/css/taskstyle.css | 167 ++-- 6 files changed, 1166 insertions(+), 710 deletions(-) create mode 100644 public/images/task/coin.png diff --git a/app/views/layouts/base_myshixun.html.erb b/app/views/layouts/base_myshixun.html.erb index 86be35ea4..532aef9f1 100644 --- a/app/views/layouts/base_myshixun.html.erb +++ b/app/views/layouts/base_myshixun.html.erb @@ -9,7 +9,7 @@ <%= favicon %> <%= javascript_heads %> <%= heads_for_theme %> - <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common', 'css/font-awesome','css/taskstyle','css/structure','scm','css/public', 'css/project','css/popup','repository','css/gantt', 'css/calendar', 'css/moduel', 'css/cssPlus-v.0.2-build' %> + <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common', 'css/font-awesome','css/taskstyle','css/structure','scm','css/public', 'css/project','css/popup','repository','css/gantt', 'css/calendar', 'css/moduel', 'css/cssPlus-v.0.2-build', 'css/bigdata-common','css/bigdata-public' %> <%= call_hook :view_layouts_base_html_head %> <%= yield :header_tags -%> @@ -18,38 +18,313 @@
    -
    -
    -
    -
    -
  • -
    全部任务123 +
    全部任务<%= @myshixun.games.count %>
  • -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -

    第一关标题

    -

    - Python3 代码风格建议
    - Python3 中使用注释
    - 认识 Python3 模块
    - 实验步骤
    - 1. 解释器
    - Python 是一个脚本语言,你可以在 Python
    解释器中直接写代码或者将代码写到一个文件里,然后执行这个文件(即脚本文件)。
    - 首先,我们从使用解释器开始,打开终端,键入Python3 并回车。这个时候解释器便工作于交互模式。
    - Python3 中使用注释
    - 认识 Python3 模块
    - 实验步骤
    - 1. 解释器
    - Python 是一个脚本语言,你可以在 Python
    解释器中直接写代码或者将代码写到一个文件里,然后执行这个文件(即脚本文件)。
    - 首先,我们从使用解释器开始,打开终端,键入Python3 并回车。这个时候解释器便工作于交互模式。
    - Python3 中使用注释
    - 认识 Python3 模块
    - 实验步骤
    - 1. 解释器
    - Python 是一个脚本语言,你可以在 Python
    解释器中直接写代码或者将代码写到一个文件里,然后执行这个文件(即脚本文件)。
    - 首先,我们从使用解释器开始,打开终端,键入Python3 并回车。这个时候解释器便工作于交互模式。
    - Python3 中使用注释
    - 认识 Python3 模块
    - 实验步骤
    - 1. 解释器
    - Python 是一个脚本语言,你可以在 Python
    解释器中直接写代码或者将代码写到一个文件里,然后执行这个文件(即脚本文件)。
    - 首先,我们从使用解释器开始,打开终端,键入Python3 并回车。这个时候解释器便工作于交互模式。
    - 1. 解释器
    - Python 是一个脚本语言,你可以在 Python
    解释器中直接写代码或者将代码写到一个文件里,然后执行这个文件(即脚本文件)。
    - 首先,我们从使用解释器开始,打开终端,键入Python3 并回车。这个时候解释器便工作于交互模式。
    - Python3 中使用注释
    - 认识 Python3 模块
    - 实验步骤
    - 1. 解释器
    - Python 是一个脚本语言,你可以在 Python
    解释器中直接写代码或者将代码写到一个文件里,然后执行这个文件(即脚本文件)。
    - 首先,我们从使用解释器开始,打开终端,键入Python3 并回车。这个时候解释器便工作于交互模式。
    -

    -
    -
    -
    -
    -
    -
    -
    -
    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -
    -
    -
    -
    -
    -
    -
    -
    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -

    dafafdasf

    -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    testrepo / lib / plugins / acts_as_searchable / init.rb

    -
    - -
    -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -

    0/11 编译错误

    -
    -
    - - 测试集 1 -
    -
    -
      -
    • 输入:param1:1
    • -
    • 实际输出:
    • -
    • 期望输出:3
    • -
    -
    -
    -
    -
    - - 测试集 2 -
    -
    -
    -
    -
    -
    - - 测试集 3 - -
    -
    -
    -
    -
    -
    - - 测试集 4 - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    11/11 全部通过

    -
    -
    -
      -
    • 样例测试:9/9
    • -
    • 隐藏测试:9/9
    • -
    • 经验值:+ 300
    • -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - 耗时:1天5小时10分钟 - 测评 -
    -
    -
    -
    -
    -
    +<%= yield %> + diff --git a/db/migrate/20170413030447_add_actual_output_to_test_sets.rb b/db/migrate/20170413030447_add_actual_output_to_test_sets.rb new file mode 100644 index 000000000..b1838e1d0 --- /dev/null +++ b/db/migrate/20170413030447_add_actual_output_to_test_sets.rb @@ -0,0 +1,5 @@ +class AddActualOutputToTestSets < ActiveRecord::Migration + def change + add_column :test_sets, :actual_output, :string + end +end diff --git a/db/migrate/20170413032641_add_hidden_to_test_sets.rb b/db/migrate/20170413032641_add_hidden_to_test_sets.rb new file mode 100644 index 000000000..69253bf49 --- /dev/null +++ b/db/migrate/20170413032641_add_hidden_to_test_sets.rb @@ -0,0 +1,6 @@ +class AddHiddenToTestSets < ActiveRecord::Migration + def change + add_column :test_sets, :is_public, :boolean, :default => true + add_column :test_sets, :result, :boolean, :default => true + end +end From 54ff35bb14f68ae10091f8e340bfce56d42a0c01 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 13 Apr 2017 13:46:30 +0800 Subject: [PATCH 33/74] =?UTF-8?q?TPI=E7=89=88=E6=9C=AC=E5=BA=93=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/views/games/_repository.html.erb | 2 +- app/views/games/_tree.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/games/_repository.html.erb b/app/views/games/_repository.html.erb index 8a1324cb1..0ccaf77e7 100644 --- a/app/views/games/_repository.html.erb +++ b/app/views/games/_repository.html.erb @@ -1,4 +1,4 @@ -
    +

    <%= render :partial => 'myshixun_breadcrumbs', :locals => {:path => @path, :kind => 'dir'} %>

    diff --git a/app/views/games/_tree.html.erb b/app/views/games/_tree.html.erb index 145592b17..ea2be4980 100644 --- a/app/views/games/_tree.html.erb +++ b/app/views/games/_tree.html.erb @@ -8,7 +8,7 @@ <% ent_path = Redmine::CodesetUtil.replace_invalid_utf8(sub_path) %> <% ent_name = Redmine::CodesetUtil.replace_invalid_utf8(entry.name) %> - + <%= link_to h(ent_name), {:action => (entry.is_dir? ? 'show' : 'entry'), :id => @game, :myshixun_id => @myshixun, :path => to_path_param(ent_path), :rev => @rev, :extend => extend }, :remote => true, From cf90d843547ca7257fe396cc1f70165c9af03325 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 13 Apr 2017 14:02:29 +0800 Subject: [PATCH 34/74] =?UTF-8?q?=E5=AE=9E=E8=AE=ADTPM=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/games/_file_edit_form.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/games/_file_edit_form.html.erb b/app/views/games/_file_edit_form.html.erb index b91f5f66a..ace44f895 100644 --- a/app/views/games/_file_edit_form.html.erb +++ b/app/views/games/_file_edit_form.html.erb @@ -38,7 +38,7 @@ // $("#challenge-answer-edit-small" ).nextAll(".CodeMirror").css("line-height", 1.2); $(document).ready(function(){ // 设置codemirror的高度/宽度自适应 - var code_height = $("#new_repository_contents").height() - $("#top_repository").height() - 15; + var code_height = $("#new_repository_contents").height() - $("#top_repository").height() - 10; editor_CodeMirror.setSize("auto",code_height+"px"); editor_CodeMirror.refresh(); }); From c0f0c8b69479312d568477d7190201b1766185bd Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 13 Apr 2017 14:29:33 +0800 Subject: [PATCH 35/74] =?UTF-8?q?=E5=B1=80=E9=83=A8=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/games_controller.rb | 1 + app/views/games/_game_results.html.erb | 6 ++-- app/views/games/_game_show.html.erb | 36 ++++++++++++++++++++++++ app/views/games/show.html.erb | 38 +------------------------- app/views/games/show.js.erb | 4 +-- 5 files changed, 43 insertions(+), 42 deletions(-) diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb index db582c838..986abd9ed 100644 --- a/app/controllers/games_controller.rb +++ b/app/controllers/games_controller.rb @@ -47,6 +47,7 @@ class GamesController < ApplicationController end logger.info("88888************#{@entries} ") @test_cases = @game_challenge.test_sets + @test_cases_count = @test_cases.count (@myshixun.games.count == @game_challenge.position && @game.status ==2) ? @had_done = 1 : @had_done = 0 if outputs.count == 0 @results = [] diff --git a/app/views/games/_game_results.html.erb b/app/views/games/_game_results.html.erb index 50d3fa892..15cbab6a2 100644 --- a/app/views/games/_game_results.html.erb +++ b/app/views/games/_game_results.html.erb @@ -20,12 +20,12 @@
    测试集 <%= index + 1 %> + <% unless test_case.result? %> + + <% end %> <% unless test_case.is_public? %> <% end %> - <% unless test_case.result? %> - - <% end %>
      diff --git a/app/views/games/_game_show.html.erb b/app/views/games/_game_show.html.erb index d79130136..955008d63 100644 --- a/app/views/games/_game_show.html.erb +++ b/app/views/games/_game_show.html.erb @@ -78,3 +78,39 @@
    + \ No newline at end of file diff --git a/app/views/games/show.html.erb b/app/views/games/show.html.erb index 22a03c9d6..ab1fc577f 100644 --- a/app/views/games/show.html.erb +++ b/app/views/games/show.html.erb @@ -1,4 +1,3 @@ -<%= javascript_include_tag 'baiduTemplate', 'jquery.datetimepicker.js' %> <%= javascript_include_tag "/codemirror/lib/codemirror", "/codemirror/mode/javascript/javascript", "/codemirror/addon/edit/matchbrackets.js", "/codemirror/mode/clike/clike" %> <%= stylesheet_link_tag "/codemirror/lib/codemirror", "/codemirror/theme/ambiance" %> <%= stylesheet_link_tag '/editormd/css/editormd','/editormd/css/editormd.min' %> @@ -8,7 +7,7 @@
    - <%= render :partial => 'game_show' %> + <%= render :partial => 'games/game_show' %>
    \ No newline at end of file diff --git a/app/views/games/show.js.erb b/app/views/games/show.js.erb index bf708d4ea..8be4d8fe8 100644 --- a/app/views/games/show.js.erb +++ b/app/views/games/show.js.erb @@ -1,4 +1,4 @@ $("#game_show_content").html('<%= escape_javascript(render :partial => 'games/game_show') %>'); -$("#myshixun_top").html('<%= escape_javascript(render :partial => 'myshixuns/myshixun_top') %>'); -$("#current_task_tab").attr('href','<%= myshixun_game_path(@myshixun.current_task, :myshixun_id => @myshixun) %>'); +//$("#myshixun_top").html('<%#= escape_javascript(render :partial => 'myshixuns/myshixun_top') %>'); +//$("#current_task_tab").attr('href','<%#= myshixun_game_path(@myshixun.current_task, :myshixun_id => @myshixun) %>'); From d698dd5fc7cba402949f7adfaf3d3e1c2f272418 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 13 Apr 2017 14:33:09 +0800 Subject: [PATCH 36/74] =?UTF-8?q?=E7=BA=A0=E9=94=99=EF=BC=88=E6=9C=AA?= =?UTF-8?q?=E5=AE=8C=E6=88=90=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/games/_game_show.html.erb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/views/games/_game_show.html.erb b/app/views/games/_game_show.html.erb index d79130136..5701ab90c 100644 --- a/app/views/games/_game_show.html.erb +++ b/app/views/games/_game_show.html.erb @@ -47,7 +47,7 @@
    @@ -77,4 +77,10 @@ - + \ No newline at end of file From ed9e4f571ada929f622ee5fecbc1f76b68b1dd1e Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 13 Apr 2017 16:29:15 +0800 Subject: [PATCH 37/74] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E7=BA=A0=E9=94=99?= =?UTF-8?q?=E5=BC=B9=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/words_controller.rb | 7 ++++++ app/views/games/_game_show.html.erb | 12 ++++++++--- app/views/games/_send_error_pop.html.erb | 27 ++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 3 deletions(-) create mode 100644 app/views/games/_send_error_pop.html.erb diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index f8d1290f4..56a056ea4 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -514,7 +514,13 @@ class WordsController < ApplicationController if params[:text].size>0 && @user # @user.add_jour(me, params[:text]) #私信 + if params[:shixuns] == "true" + master = User.find(params[:shixun_author]) + message = "【#{master.show_name}导师/#{params[:shixun_name]}>第#{params[:position]}关】问题报告:
    " + params[:text] + JournalsForMessage.create(:jour_id => master.id,:user_id => me.id, :notes => message, :reply_id => 0, :status => true, :is_readed => false, :private => 1) + else message = "【未收到激活邮件的用户反馈,用户邮箱:"+me.mail+"】
    "+params[:text] + end @user.journals_for_messages << JournalsForMessage.new(:user_id => me.id, :notes => message, :reply_id => 0, :status => true, :is_readed => false, :private => 1) else status = 0 @@ -524,6 +530,7 @@ class WordsController < ApplicationController render_403 end end + private diff --git a/app/views/games/_game_show.html.erb b/app/views/games/_game_show.html.erb index cf9eeb4c5..2a12771e2 100644 --- a/app/views/games/_game_show.html.erb +++ b/app/views/games/_game_show.html.erb @@ -1,3 +1,10 @@ +
    @@ -114,8 +121,7 @@ $('#task_pass_contents').find('img').css("max-width", "100%"); }); function error_correction_pop(){ - /* $.ajax({ - url: '<%#= send_error %>' - });*/ + var htmlvalue = "<%= escape_javascript(render :partial => 'games/send_error_pop') %>"; + pop_box_new(htmlvalue,460,316); } \ No newline at end of file diff --git a/app/views/games/_send_error_pop.html.erb b/app/views/games/_send_error_pop.html.erb new file mode 100644 index 000000000..4d4fac696 --- /dev/null +++ b/app/views/games/_send_error_pop.html.erb @@ -0,0 +1,27 @@ +
    +

    问题报告

    + +
    +
    +

    这个任务有什么问题或错误?

    +

    请尽可能清晰的描述

    + +
    +
    + 取消 + 确定 +
    + \ No newline at end of file From 698d9f54d543c1b972d97165272aaa48831da905 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 14 Apr 2017 08:39:09 +0800 Subject: [PATCH 38/74] =?UTF-8?q?TPM=E7=BA=A0=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/games_controller.rb | 1 + app/controllers/words_controller.rb | 11 ++++++++--- app/models/test_set.rb | 2 +- app/views/games/_game_results.html.erb | 2 +- app/views/games/_send_error_pop.html.erb | 2 +- app/views/games/show.js.erb | 4 +--- 6 files changed, 13 insertions(+), 9 deletions(-) diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb index 986abd9ed..d2e57e85f 100644 --- a/app/controllers/games_controller.rb +++ b/app/controllers/games_controller.rb @@ -47,6 +47,7 @@ class GamesController < ApplicationController end logger.info("88888************#{@entries} ") @test_cases = @game_challenge.test_sets + @error_position = @test_cases.each_with_index { |test_case, index| test_case.result == 0 } @test_cases_count = @test_cases.count (@myshixun.games.count == @game_challenge.position && @game.status ==2) ? @had_done = 1 : @had_done = 0 if outputs.count == 0 diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index 56a056ea4..e66abaf33 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -514,14 +514,19 @@ class WordsController < ApplicationController if params[:text].size>0 && @user # @user.add_jour(me, params[:text]) #私信 - if params[:shixuns] == "true" + if params[:shixun_name] master = User.find(params[:shixun_author]) + game_id = params[:game_id] message = "【#{master.show_name}导师/#{params[:shixun_name]}>第#{params[:position]}关】问题报告:
    " + params[:text] - JournalsForMessage.create(:jour_id => master.id,:user_id => me.id, :notes => message, :reply_id => 0, :status => true, :is_readed => false, :private => 1) + # game.journals_for_messages << JournalsForMessage.new(:user_id => me.id, :notes => message, :reply_id => 0, :status => true, :is_readed => false, :private => 1) + jfm = JournalsForMessage.new(:jour_id => game_id, :jour_type => "Game", :user_id => master.id, :notes => message, :reply_id => 0, :status => true, :is_readed => false, :private => 1) + jfm.save + JournalsForMessage.create(:jour_id => game_id, :jour_type => "Game", :user_id => 1, :notes => message, :reply_id => 0, :status => true, :is_readed => false, :private => 1) else message = "【未收到激活邮件的用户反馈,用户邮箱:"+me.mail+"】
    "+params[:text] - end @user.journals_for_messages << JournalsForMessage.new(:user_id => me.id, :notes => message, :reply_id => 0, :status => true, :is_readed => false, :private => 1) + end + else status = 0 end diff --git a/app/models/test_set.rb b/app/models/test_set.rb index 90627a8db..c4d0e43db 100644 --- a/app/models/test_set.rb +++ b/app/models/test_set.rb @@ -1,5 +1,5 @@ class TestSet < ActiveRecord::Base - default_scope :order => 'id desc' + default_scope :order => 'id asc' attr_accessible :challenge_id, :input, :output, :game_id, :actual_output belongs_to :challenge end diff --git a/app/views/games/_game_results.html.erb b/app/views/games/_game_results.html.erb index 15cbab6a2..aa289aa65 100644 --- a/app/views/games/_game_results.html.erb +++ b/app/views/games/_game_results.html.erb @@ -14,7 +14,7 @@
    -

    0/11 编译错误

    +

    0/<%= @test_cases_count %> 编译错误

    <% @test_cases.each_with_index do |test_case, index| %>
    diff --git a/app/views/games/_send_error_pop.html.erb b/app/views/games/_send_error_pop.html.erb index 4d4fac696..c5fbc0b9d 100644 --- a/app/views/games/_send_error_pop.html.erb +++ b/app/views/games/_send_error_pop.html.erb @@ -15,7 +15,7 @@ function problem_report(user){ $.ajax({ url: '<%= leave_email_activation_message_path(1) %>', - data: {user: user, text: $("#error_contents").val(), shixuns: true, shixun_name:'<%= @myshixun.name %>', shixun_author:'<%= @game_challenge.user_id %>', position:'<%= @game_challenge.position %>'}, + data: {user: user, text: $("#error_contents").val(), game_id: '<%= @game.id %>', shixun_name:'<%= @myshixun.name %>', shixun_author:'<%= @game_challenge.user_id %>', position:'<%= @game_challenge.position %>'}, type: "POST", success: function (data) { var htmlvalue = "" diff --git a/app/views/games/show.js.erb b/app/views/games/show.js.erb index 8be4d8fe8..5457d9b56 100644 --- a/app/views/games/show.js.erb +++ b/app/views/games/show.js.erb @@ -1,4 +1,2 @@ $("#game_show_content").html('<%= escape_javascript(render :partial => 'games/game_show') %>'); - -//$("#myshixun_top").html('<%#= escape_javascript(render :partial => 'myshixuns/myshixun_top') %>'); -//$("#current_task_tab").attr('href','<%#= myshixun_game_path(@myshixun.current_task, :myshixun_id => @myshixun) %>'); +$("#current_task_tab").attr('href','<%= myshixun_game_path(@myshixun.current_task, :myshixun_id => @myshixun) %>'); From fe15d8fa9f264d687610f27cbe9c1463b2ec62d8 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 14 Apr 2017 08:41:00 +0800 Subject: [PATCH 39/74] =?UTF-8?q?TPm=E7=BA=A0=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/games/_send_error_pop.html.erb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/app/views/games/_send_error_pop.html.erb b/app/views/games/_send_error_pop.html.erb index 4d4fac696..4244595a0 100644 --- a/app/views/games/_send_error_pop.html.erb +++ b/app/views/games/_send_error_pop.html.erb @@ -1,6 +1,6 @@

    问题报告

    - +

    这个任务有什么问题或错误?

    @@ -9,18 +9,16 @@
    + diff --git a/app/views/games/show.js.erb b/app/views/games/show.js.erb index 5457d9b56..4ddbeb86d 100644 --- a/app/views/games/show.js.erb +++ b/app/views/games/show.js.erb @@ -1,2 +1,3 @@ +$("#all_task_show").toggle(); $("#game_show_content").html('<%= escape_javascript(render :partial => 'games/game_show') %>'); $("#current_task_tab").attr('href','<%= myshixun_game_path(@myshixun.current_task, :myshixun_id => @myshixun) %>'); From cbcd63f4c3df90d4dc28b4b2ffc4cb21327045b1 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 14 Apr 2017 10:27:19 +0800 Subject: [PATCH 41/74] =?UTF-8?q?=E5=AE=9E=E8=AE=ADtpm=E7=BB=8F=E9=AA=8C?= =?UTF-8?q?=E5=80=BC=E9=9A=8F=E9=9A=BE=E6=98=93=E5=BA=A6=E7=9A=84=E6=94=B9?= =?UTF-8?q?=E5=8A=A8=E8=80=8C=E6=94=B9=E5=8F=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/challenges/_form.html.erb | 48 ++++++++++++++++++++++++++--- 1 file changed, 43 insertions(+), 5 deletions(-) diff --git a/app/views/challenges/_form.html.erb b/app/views/challenges/_form.html.erb index 1e436a5ff..daf25b887 100644 --- a/app/views/challenges/_form.html.erb +++ b/app/views/challenges/_form.html.erb @@ -130,7 +130,7 @@
  • - <%= select_tag :evaluation_way, options_for_select([["输出输出", 1], ["文件存在", 2]]), :name => 'challenge[evaluation_way]', :class => " fl", :style => "height: 40px; width:200px;" %> + <%= select_tag :evaluation_way, options_for_select([["输出输出", 1]]), :name => 'challenge[evaluation_way]', :class => " fl", :style => "height: 40px; width:200px;" %> 请选择自动检测学员是否完成本任务的评测标准
  • @@ -238,13 +238,13 @@ <%= 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 => "请输入分值(只能是数字)" %> - (100~200 经验值) + <%#= 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;" %>
  • @@ -315,6 +315,45 @@ $(inputs_labels[j]).html("组" + (j + 1)); } }); + + // 根据难易程度设置不同的奖励经验值(适用新建与编辑模式) + var list= $('input:radio[name="challenge[difficulty]"]:checked').val(); // 获取select的索引值 + if(list == 1){ + $("#challenge_score").empty(); + for(var i= 100; i <= 200; i += 100){ + $("#challenge_score").append(""); + } + }else if(list == 2){ + $("#challenge_score").empty(); + for(var i= 300; i <= 600; i += 100){ + $("#challenge_score").append(""); + } + }else if(list == 3){ + $("#challenge_score").empty(); + for(var i= 700; i <= 1000; i += 100){ + $("#challenge_score").append(""); + } + } + $("#challenge_score").find("option[value='<%= @challenge.score %>']").attr("selected",true); // 设置option默认值 + $("#challenge_difficulty_1").click(function(){ + $("#challenge_score").empty(); + for(var i= 100; i <= 200; i += 100){ + $("#challenge_score").append(""); + } + }); + $("#challenge_difficulty_2").click(function(){ + $("#challenge_score").empty(); + for(var i= 300; i <= 600; i += 100){ + $("#challenge_score").append(""); + } + }); + $("#challenge_difficulty_3").click(function(){ + $("#challenge_score").empty(); + for(var i= 700; i <= 1000; i += 100){ + $("#challenge_score").append(""); + } + }) + }); // 设置textarea的宽度到140以后出现滚动条 var text1 = document.getElementById("textarea_sample_input_test"); @@ -418,5 +457,4 @@ var obj = thisObj.parentNode.id; $("#"+obj).remove(); } - From 151a118d6310d5280bc7e75156f24de2579fad56 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 14 Apr 2017 10:58:14 +0800 Subject: [PATCH 42/74] =?UTF-8?q?TPI=E5=B7=A6=E4=BE=A7=E5=AF=BC=E8=88=AA?= =?UTF-8?q?=E6=A0=B7=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/views/games/show.js.erb | 1 + app/views/layouts/base_myshixun.html.erb | 18 ++++++++++++++++++ public/stylesheets/css/taskstyle.css | 4 ++-- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/app/views/games/show.js.erb b/app/views/games/show.js.erb index 4ddbeb86d..863d4e779 100644 --- a/app/views/games/show.js.erb +++ b/app/views/games/show.js.erb @@ -1,3 +1,4 @@ $("#all_task_show").toggle(); $("#game_show_content").html('<%= escape_javascript(render :partial => 'games/game_show') %>'); $("#current_task_tab").attr('href','<%= myshixun_game_path(@myshixun.current_task, :myshixun_id => @myshixun) %>'); + diff --git a/app/views/layouts/base_myshixun.html.erb b/app/views/layouts/base_myshixun.html.erb index b79a4993a..171fdc6ae 100644 --- a/app/views/layouts/base_myshixun.html.erb +++ b/app/views/layouts/base_myshixun.html.erb @@ -73,6 +73,24 @@ g('blacktab_con_'+n).className='dis'; g('blacktab_nav_'+n).className='blacktab_hover'; } + + // 点击全部任务左侧tab样式切换 + var c = 0; // 设置全部任务展开样式,与不展开时的样式 + $("#all_task_tab").click(function(){ + if( c == 0){ + $("#all_task_tab").addClass('leftnav-active'); + $("#current_task_tab").removeClass('leftnav-active'); + c = 1; + }else if(c == 1){ + $("#all_task_tab").removeClass('leftnav-active'); + $("#current_task_tab").addClass('leftnav-active'); + c = 0; + } + }); + $("#current_task_tab").click(function(){ + $("#current_task_tab").addClass('leftnav-active'); + $("#all_task_tab").removeClass('leftnav-active'); + }); <%= javascript_include_tag 'cookie','project',"avatars", 'header','prettify','select_list_move','attachments' %> diff --git a/public/stylesheets/css/taskstyle.css b/public/stylesheets/css/taskstyle.css index 583873b5b..352b5bf17 100644 --- a/public/stylesheets/css/taskstyle.css +++ b/public/stylesheets/css/taskstyle.css @@ -11,7 +11,7 @@ a.user-info-img img:hover{border:2px solid #888;} a.user-info-name{ display: block; font-size: 16px; color: #fff; max-width:100px; margin: 10px auto; text-align: center;} .leftnav-box{ width: 80px; height: 60px; background:#292b3a; padding:10px 0; margin-bottom:2px;} a.leftnav-box-inner{ display: block; width:77px; border-left:3px solid #292b3a; background:#292b3a; text-align: center; padding:10px 0; color:#575f6c;} -a:hover.leftnav-box-inner,a.leftnav-active{border-left:3px solid #3498db;color: #fff; } +a:hover.leftnav-box-inner,a.leftnav-active{border-left:3px solid #3498db;color: #fff!important;} .btn-cir{ background:#575f6c; color:#292b3a;display: inline-block; padding:0px 5px; border-radius:25px; border-radius:15px; line-height:20px; height: 20px; font-size:12px;} .btn-cir:hover{background:#fff;} .btn-cir-grey{background: #e1e1e1;color: #333;} @@ -177,7 +177,7 @@ input.knowledge_frame{height:30px;line-height:30px;border:none;background:#f3f5f .-position-a-r15{ position: absolute; top:5px; right:15px;} .btn-cir-big{ background: #999;color: #fff;display: inline-block; padding:2px 10px; border-radius:25px; border-radius:15px; line-height:20px; height: 20px; font-size:12px;} .-task-ml80{ margin-left: 80px;} -.page--over { position: fixed;top: 0; left:80px; right: 0; z-index:10000;background:rgba(0,0,0,0.7); height:100%; color:#fff;} +.page--over { position: fixed;top: 0; left:80px; right: 0; z-index:10000;background:rgba(0,0,0,0.3); height:100%; color:#fff;} .-task-list-header{ border-bottom:1px solid #eee; padding:5px 15px; color:#898989; font-size: 14px; font-weight: normal;} .-task-list-header h3{ font-weight: normal; font-size:16px; color:#333;} .-task-list-inner{ background:#EFF2F7; margin:10px; padding:5px;} From e351834fb14bf892e2f84aedcb2b9abccd6c2e58 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 14 Apr 2017 10:58:25 +0800 Subject: [PATCH 43/74] =?UTF-8?q?=E6=B7=BB=E5=8A=A0game=E5=BC=80=E5=90=AF?= =?UTF-8?q?=E6=97=B6=E9=97=B4=EF=BC=8Copen=5Ftime=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=BF=81=E7=A7=BB=E3=80=82index=E5=88=B7=E6=96=B0=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E9=9A=90=E8=97=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/games_controller.rb | 2 +- app/controllers/shixuns_controller.rb | 2 +- app/models/game.rb | 2 +- app/views/games/show.js.erb | 2 +- db/migrate/20170414023452_add_open_time_to_game.rb | 5 +++++ db/migrate/20170414024741_update_open_time_to_game.rb | 10 ++++++++++ 6 files changed, 19 insertions(+), 4 deletions(-) create mode 100644 db/migrate/20170414023452_add_open_time_to_game.rb create mode 100644 db/migrate/20170414024741_update_open_time_to_game.rb diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb index d2e57e85f..c49bc2a40 100644 --- a/app/controllers/games_controller.rb +++ b/app/controllers/games_controller.rb @@ -168,7 +168,7 @@ class GamesController < ApplicationController def next_step render_403 if @game.status != 2 next_game = @game.next_game - next_game.update_attribute(:status, 0) if next_game.status == 3 + next_game.update_attributes(:status => 0, :open_time => Time.now) if next_game.status == 3 respond_to do |format| format.js{redirect_to myshixun_game_path(next_game, :myshixun_id => @myshixun.id)} diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 4e9dd4102..7e48c8c4e 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -81,7 +81,7 @@ class ShixunsController < ApplicationController # 之所以增加user_id是为了方便统计查询性能 challenges.each_with_index do |challenge, index| status = (index == 0 ? 0 : 3) - Game.create!(:challenge_id => challenge.id, :myshixun_id => myshixun.id, :status => status, :user_id => myshixun.user_id) + Game.create!(:challenge_id => challenge.id, :myshixun_id => myshixun.id, :status => status, :user_id => myshixun.user_id, :open_time => Time.now) end else raise("网络异常,请稍后重试") diff --git a/app/models/game.rb b/app/models/game.rb index 9117941ba..9bff76d7e 100644 --- a/app/models/game.rb +++ b/app/models/game.rb @@ -1,7 +1,7 @@ class Game < ActiveRecord::Base # stauts 0: can exe 1:doing 2:successed 3:locked default_scope :order => 'created_at desc' - attr_accessible :myshixun_id, :user_id, :status, :final_score, :challenge_id + attr_accessible :myshixun_id, :user_id, :status, :final_score, :challenge_id, :open_time belongs_to :myshixun,:touch=> true belongs_to :user belongs_to :challenge diff --git a/app/views/games/show.js.erb b/app/views/games/show.js.erb index 4ddbeb86d..7029c2bd1 100644 --- a/app/views/games/show.js.erb +++ b/app/views/games/show.js.erb @@ -1,3 +1,3 @@ -$("#all_task_show").toggle(); +$("#all_task_show").hide(); $("#game_show_content").html('<%= escape_javascript(render :partial => 'games/game_show') %>'); $("#current_task_tab").attr('href','<%= myshixun_game_path(@myshixun.current_task, :myshixun_id => @myshixun) %>'); diff --git a/db/migrate/20170414023452_add_open_time_to_game.rb b/db/migrate/20170414023452_add_open_time_to_game.rb new file mode 100644 index 000000000..7f0318a12 --- /dev/null +++ b/db/migrate/20170414023452_add_open_time_to_game.rb @@ -0,0 +1,5 @@ +class AddOpenTimeToGame < ActiveRecord::Migration + def change + add_column :games, :open_time, :datetime + end +end diff --git a/db/migrate/20170414024741_update_open_time_to_game.rb b/db/migrate/20170414024741_update_open_time_to_game.rb new file mode 100644 index 000000000..a5df9d440 --- /dev/null +++ b/db/migrate/20170414024741_update_open_time_to_game.rb @@ -0,0 +1,10 @@ +class UpdateOpenTimeToGame < ActiveRecord::Migration + def up + Game.all.each do |game| + game.update_attribute(:open_time, game.created_at) + end + end + + def down + end +end From 50ed200ca4a083e14b5cc7b031c09f32d2a5b68f Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 14 Apr 2017 14:38:29 +0800 Subject: [PATCH 44/74] =?UTF-8?q?game=E7=BA=A0=E9=94=99=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E5=8F=91=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/words_controller.rb | 12 ++++++------ app/models/journals_for_message.rb | 3 +++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index e66abaf33..b3e8ec91c 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -515,13 +515,13 @@ class WordsController < ApplicationController # @user.add_jour(me, params[:text]) #私信 if params[:shixun_name] - master = User.find(params[:shixun_author]) game_id = params[:game_id] - message = "【#{master.show_name}导师/#{params[:shixun_name]}>第#{params[:position]}关】问题报告:
    " + params[:text] - # game.journals_for_messages << JournalsForMessage.new(:user_id => me.id, :notes => message, :reply_id => 0, :status => true, :is_readed => false, :private => 1) - jfm = JournalsForMessage.new(:jour_id => game_id, :jour_type => "Game", :user_id => master.id, :notes => message, :reply_id => 0, :status => true, :is_readed => false, :private => 1) - jfm.save - JournalsForMessage.create(:jour_id => game_id, :jour_type => "Game", :user_id => 1, :notes => message, :reply_id => 0, :status => true, :is_readed => false, :private => 1) + message = params[:text] + admin_id = User.where(:admin => 1).first.try(:id) + user_ids = [admin_id, params[:shixun_author_id].to_i] + user_ids.each do |user_id| + JournalsForMessage.create(:jour_id => game_id, :jour_type => "Game", :user_id => user_id, :notes => message, :reply_id => 0, :status => true, :is_readed => false, :private => 1) + end else message = "【未收到激活邮件的用户反馈,用户邮箱:"+me.mail+"】
    "+params[:text] @user.journals_for_messages << JournalsForMessage.new(:user_id => me.id, :notes => message, :reply_id => 0, :status => true, :is_readed => false, :private => 1) diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb index d1f32f82d..885bdc0b8 100644 --- a/app/models/journals_for_message.rb +++ b/app/models/journals_for_message.rb @@ -322,6 +322,9 @@ class JournalsForMessage < ActiveRecord::Base receivers.each do |r| self.user_feedback_messages << UserFeedbackMessage.new(:user_id => r.id, :journals_for_message_id => self.id, :journals_for_message_type => "Principal", :viewed => false) end + elsif self.jour_type == 'Game' + # game不存在回复 + self.user_feedback_messages << UserFeedbackMessage.new(:user_id => self.user_id, :journals_for_message_id => self.id, :journals_for_message_type => "Game", :viewed => false) end end From 080d00ab04ce5849c9e9f9a1a736b9c95d9a7de4 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 14 Apr 2017 15:47:20 +0800 Subject: [PATCH 45/74] =?UTF-8?q?=E7=82=B9=E8=B5=9E=E4=B8=8E=E8=B8=A9?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/games_controller.rb | 4 ++ app/controllers/praise_tread_controller.rb | 16 ++++++- app/views/games/_game_show.html.erb | 49 +++++++++++++++++++--- app/views/games/show.js.erb | 3 +- 4 files changed, 62 insertions(+), 10 deletions(-) diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb index c49bc2a40..eec9e8aeb 100644 --- a/app/controllers/games_controller.rb +++ b/app/controllers/games_controller.rb @@ -22,8 +22,12 @@ class GamesController < ApplicationController # mushixun的版本库必须创建时就创建 # 首次进入版本库自动打开文件 # path:"" && path: @game.path + # @praise 判断是否点赞 + # @praise 判断是否踩 def show @game_challenge = @game.challenge + @praise = PraiseTread.where("praise_tread_object_id=? and praise_tread_object_type=? and user_id=?", @game_challenge.id, @game_challenge.class.to_s, User.current.id).first + @tread = PraiseTread.where("praise_tread_object_id=? and praise_tread_object_type=? and user_id=?", @game_challenge.id, "ChallengeTread", User.current.id).first logger.info("test ................#{@game_challenge.id}") game_path = (@game_challenge.path.blank? ? @path : @game_challenge.path.strip) logger.info("test game_path ................#{game_path}") diff --git a/app/controllers/praise_tread_controller.rb b/app/controllers/praise_tread_controller.rb index 136915bbd..a661892f8 100644 --- a/app/controllers/praise_tread_controller.rb +++ b/app/controllers/praise_tread_controller.rb @@ -17,13 +17,19 @@ class PraiseTreadController < ApplicationController end # @is_in_list = nil @obj = find_object_by_type_and_id(@obj_type,@obj_id) - pts = PraiseTread.where("praise_tread_object_id=? and praise_tread_object_type=? and user_id=?",@obj_id,@obj_type.to_s,User.current.id) - unless pts.empty? + pts = PraiseTread.where("praise_tread_object_id=? and praise_tread_object_type=? and user_id=?",@obj_id,@obj_type.to_s,User.current.id).first + unless pts.blank? + if(params[:game_praise] == "true") + pts.delete + render :json => {praise: false} + return + end respond_to do |format| format.js end return end + @horizontal = params[:horizontal].downcase == "false" ? false:true if params[:horizontal] # if @obj.respond_to?("author_id") # author_id = @obj.author_id @@ -33,6 +39,10 @@ class PraiseTreadController < ApplicationController # unless author_id == User.current.id praise_tread_plus(@obj_type,@obj_id,1) # end + if params[:game_praise] == "true" + render :json => {praise: true} + return + end respond_to do |format| format.js end @@ -137,6 +147,8 @@ class PraiseTreadController < ApplicationController @obj = Syllabus.find_by_id(id) when 'Work' @obj = Work.find_by_id(id) + when 'Challenge' || 'ChallengeTread' + @obj = Challenge.find_by_id(id) else @obj = nil end diff --git a/app/views/games/_game_show.html.erb b/app/views/games/_game_show.html.erb index 2a12771e2..965e228e9 100644 --- a/app/views/games/_game_show.html.erb +++ b/app/views/games/_game_show.html.erb @@ -52,8 +52,8 @@