From ec56f1f05a8bddb87cabc4344abdee46900886da Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 25 Sep 2017 16:50:51 +0800 Subject: [PATCH 01/16] =?UTF-8?q?=E6=96=87=E4=BB=B6=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/shixuns_controller.rb | 8 ++++ .../challenges/_evaluating_form.html.erb | 38 ++++++++++++++++++- config/routes.rb | 1 + 3 files changed, 45 insertions(+), 2 deletions(-) diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index d11285bc7..609f1eec4 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -14,6 +14,14 @@ class ShixunsController < ApplicationController CODES = %W(2 3 4 5 6 7 8 9 A B C D E F G H J K L N M O P Q R S T U V W X Y Z) DCODES = %W(2 3 4 5 6 7 8 9 a b c f e f g h i j k l m n o p q r s t u v w x y z) + # 获取版本库文件目录 + def search_file_list + path = params[:path] + g = Gitlab.client + dir = g.trees(@shixun.gpid).map{|tree| tree.name} + logger.info("dir is ##{dir}") + render :json => {:dir => dir} + end def statistics_students @statistics = @shixun.myshixuns.order("created_at desc") diff --git a/app/views/challenges/_evaluating_form.html.erb b/app/views/challenges/_evaluating_form.html.erb index 46e28bf47..45702ef51 100644 --- a/app/views/challenges/_evaluating_form.html.erb +++ b/app/views/challenges/_evaluating_form.html.erb @@ -18,8 +18,10 @@
  • - <%= 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 :path, :class => "panel-form-width-690 panel-box-sizing fl", :no_label => true, :placeholder => "进入实训后将默认打开该文件,如:src/test/welcome.java", :maxlength => "256" %> + +
    • @@ -100,6 +102,13 @@ bt.LEFT_DELIMITER = ''; + // 获取版本库路径 + $("#shixun_file_path").on('click', function (e) { + alert("test"); + search_shixun_files_ajax(); +// throttle(search_not_teacher_f, window, e); + }); + $("#shixun_form").on('click', 'a.test_icon_add', function () { var html = bt('t:test-answer-list', null); $(this).parent().parent('.clearfix').after(html); @@ -155,8 +164,33 @@ $(inputs_labels[j]).html("组" + (j + 1)); } }); - }); + + function search_shixun_files_ajax(){ + $.ajax({ + url: '<%= search_file_list_shixun_path(@shixun) %>', + type: 'get', + success: function (data) { + alert(data.dir); + if(data.dir.length > 0){ + alert(data.dir); + $(".course_list_ul").empty(); + for(var i=0; i

      " + data.dir[i][0] + "

    • "); + } + $(".course_list_ul").show(); + if($(".course_list_ul").find("li").length>5){ + $(".course_list_ul").css("overflow-y","scroll"); + } else{ + $(".course_list_ul").css("overflow-y","hidden"); + } + } else{ + $(".course_list_ul").hide(); + } + } + }); + } + // 判断测试集是否锁定, 0未锁定,1锁定 function test_set_whether_lock(){ var lock = document.getElementsByName("test_set[lock][]"); diff --git a/config/routes.rb b/config/routes.rb index 700d20d6a..9fb0d4d72 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -106,6 +106,7 @@ RedmineApp::Application.routes.draw do get 'search_user_courses' post 'send_to_course' get 'statistics_students' + get 'search_file_list' end collection do get 'shixun_courses' From ce9630b6cd8da06fc8846044f4a4ae53b314de4a Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 26 Sep 2017 10:01:03 +0800 Subject: [PATCH 02/16] =?UTF-8?q?=E6=96=87=E4=BB=B6=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/shixuns_controller.rb | 4 ++-- app/views/challenges/_evaluating_form.html.erb | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 609f1eec4..ee87d34bc 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -17,8 +17,9 @@ class ShixunsController < ApplicationController # 获取版本库文件目录 def search_file_list path = params[:path] + path = to_path_param(path) g = Gitlab.client - dir = g.trees(@shixun.gpid).map{|tree| tree.name} + dir = g.trees(@shixun.gpid, :path => path).map{|tree| [tree.type,tree.name]} logger.info("dir is ##{dir}") render :json => {:dir => dir} end @@ -31,7 +32,6 @@ class ShixunsController < ApplicationController @statistic_pages = Paginator.new @statistics_count, @limit, params['page'] || 1 @offset ||= @statistic_pages.offset @statistics = paginateHelper @statistics, @limit - end # push代码的时候会触发gitlab hook diff --git a/app/views/challenges/_evaluating_form.html.erb b/app/views/challenges/_evaluating_form.html.erb index 45702ef51..b1f943818 100644 --- a/app/views/challenges/_evaluating_form.html.erb +++ b/app/views/challenges/_evaluating_form.html.erb @@ -21,8 +21,9 @@ <%#= 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" %> From 74f97f79ad4f1d3808f652b30a5390978fca89e1 Mon Sep 17 00:00:00 2001 From: miss <994230062@qq.com> Date: Wed, 27 Sep 2017 15:09:18 +0800 Subject: [PATCH 03/16] =?UTF-8?q?=E6=96=87=E4=BB=B6=E8=B7=AF=E5=BE=84?= =?UTF-8?q?=E7=9A=84=E5=BC=B9=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/shixuns_controller.rb | 2 ++ app/views/shixuns/_achieve_ ways.html.erb | 33 +++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 app/views/shixuns/_achieve_ ways.html.erb diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 609f1eec4..5710a81ed 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -22,7 +22,9 @@ class ShixunsController < ApplicationController logger.info("dir is ##{dir}") render :json => {:dir => dir} end + def achieve_ways + end def statistics_students @statistics = @shixun.myshixuns.order("created_at desc") @statistics_count = @statistics.count diff --git a/app/views/shixuns/_achieve_ ways.html.erb b/app/views/shixuns/_achieve_ ways.html.erb new file mode 100644 index 000000000..22c32b233 --- /dev/null +++ b/app/views/shixuns/_achieve_ ways.html.erb @@ -0,0 +1,33 @@ + +
        +
        +

        文件路径

        + +
        +
        +
        +
          +
        • +
        +
        +
        +
        + + \ No newline at end of file From adb0aa3f667295cea28aabdcb3c2f461573a749f Mon Sep 17 00:00:00 2001 From: miss <994230062@qq.com> Date: Sat, 30 Sep 2017 10:48:43 +0800 Subject: [PATCH 04/16] =?UTF-8?q?=E6=96=87=E4=BB=B6=E8=B7=AF=E5=BE=84?= =?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/shixuns_controller.rb | 1 + .../challenges/_evaluating_form.html.erb | 5 ++ app/views/shixuns/_achieve_ ways.html.erb | 33 ----------- app/views/shixuns/_achieve_ways.html.erb | 58 +++++++++++++++++++ 4 files changed, 64 insertions(+), 33 deletions(-) delete mode 100644 app/views/shixuns/_achieve_ ways.html.erb create mode 100644 app/views/shixuns/_achieve_ways.html.erb diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 5710a81ed..9eab2c97a 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -23,6 +23,7 @@ class ShixunsController < ApplicationController render :json => {:dir => dir} end def achieve_ways + @entries = Gitlab.client.trees(@shixun.gpid).map{|tree| tree.name} end def statistics_students diff --git a/app/views/challenges/_evaluating_form.html.erb b/app/views/challenges/_evaluating_form.html.erb index 45702ef51..25acfe256 100644 --- a/app/views/challenges/_evaluating_form.html.erb +++ b/app/views/challenges/_evaluating_form.html.erb @@ -106,6 +106,7 @@ $("#shixun_file_path").on('click', function (e) { alert("test"); search_shixun_files_ajax(); + achieve_ways(); // throttle(search_not_teacher_f, window, e); }); @@ -190,7 +191,11 @@ } }); } + function achieve_ways(){ + var htmlvalue = "<%= escape_javascript( render :partial => 'shixuns/achieve_ways') %>"; + pop_box_new(htmlvalue, 600, 400); + } // 判断测试集是否锁定, 0未锁定,1锁定 function test_set_whether_lock(){ var lock = document.getElementsByName("test_set[lock][]"); diff --git a/app/views/shixuns/_achieve_ ways.html.erb b/app/views/shixuns/_achieve_ ways.html.erb deleted file mode 100644 index 22c32b233..000000000 --- a/app/views/shixuns/_achieve_ ways.html.erb +++ /dev/null @@ -1,33 +0,0 @@ - -
        -
        -

        文件路径

        - -
        -
        -
        -
          -
        • -
        -
        -
        -
        - - \ No newline at end of file diff --git a/app/views/shixuns/_achieve_ways.html.erb b/app/views/shixuns/_achieve_ways.html.erb new file mode 100644 index 000000000..6a3a2e964 --- /dev/null +++ b/app/views/shixuns/_achieve_ways.html.erb @@ -0,0 +1,58 @@ + +
        +
        +

        文件路径

        + +
        +
        +
        +
          + <% @entries.each do |entry| %> + <% tr_id = Digest::MD5.hexdigest(entry.path) + depth = params[:depth].to_i %> + <% sub_path = entry.path[0] == "/" ? entry.path.sub("/", "") : entry.path %> + <% ent_path = Redmine::CodesetUtil.replace_invalid_utf8(sub_path) %> + <% ent_name = Redmine::CodesetUtil.replace_invalid_utf8(entry.name) %> +
        • + +
        • + <% end %> +
        + +
        +
        +
        + + \ No newline at end of file From c8262cfeaa0f531f20c5b2e4f5dd262a07b17144 Mon Sep 17 00:00:00 2001 From: miss <994230062@qq.com> Date: Sat, 30 Sep 2017 15:32:27 +0800 Subject: [PATCH 05/16] =?UTF-8?q?=E6=96=87=E4=BB=B6=E8=B7=AF=E5=BE=84?= =?UTF-8?q?=E7=9A=84=E5=BC=B9=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/challenges_controller.rb | 3 ++ app/controllers/shixuns_controller.rb | 10 ++++-- app/views/shixuns/_achieve_ways.html.erb | 41 ++++++++++++------------ config/routes.rb | 1 + 4 files changed, 33 insertions(+), 22 deletions(-) diff --git a/app/controllers/challenges_controller.rb b/app/controllers/challenges_controller.rb index aef0170ff..2881e53f5 100644 --- a/app/controllers/challenges_controller.rb +++ b/app/controllers/challenges_controller.rb @@ -91,6 +91,9 @@ class ChallengesController < ApplicationController end def edit + @repository = @shixun.repository + @entries = @repository.entries(@path, @rev) + @st = @challenge.st challenge_num = Challenge.where(:shixun_id => @shixun).count challenge_pos = @challenge.position diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 9eab2c97a..54a35e8f6 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -16,16 +16,22 @@ class ShixunsController < ApplicationController # 获取版本库文件目录 def search_file_list + @repository = @shixun.repository + @entries = @repository.entries(@path, @rev) + path = params[:path] g = Gitlab.client dir = g.trees(@shixun.gpid).map{|tree| tree.name} logger.info("dir is ##{dir}") render :json => {:dir => dir} end - def achieve_ways - @entries = Gitlab.client.trees(@shixun.gpid).map{|tree| tree.name} + def achieve_ways + @repository = @shixun.repository + @entries = @repository.entries(@path, @rev) + # @entries = Gitlab.client.trees(@shixun.gpid).map{|tree| tree.name} end + def statistics_students @statistics = @shixun.myshixuns.order("created_at desc") @statistics_count = @statistics.count diff --git a/app/views/shixuns/_achieve_ways.html.erb b/app/views/shixuns/_achieve_ways.html.erb index 6a3a2e964..ca47ea645 100644 --- a/app/views/shixuns/_achieve_ways.html.erb +++ b/app/views/shixuns/_achieve_ways.html.erb @@ -1,5 +1,5 @@ -
        +

        文件路径

        @@ -33,26 +33,27 @@
      • <% end %> - + 取消 + 确定
        - \ No newline at end of file + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 9fb0d4d72..f79c60837 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -107,6 +107,7 @@ RedmineApp::Application.routes.draw do post 'send_to_course' get 'statistics_students' get 'search_file_list' + get 'achieve_ways' end collection do get 'shixun_courses' From 7588aa39a8eab6db8426c495d8c3a7bf15962bb2 Mon Sep 17 00:00:00 2001 From: huang Date: Sat, 30 Sep 2017 16:10:37 +0800 Subject: [PATCH 06/16] 0 --- app/controllers/challenges_controller.rb | 3 -- .../challenges/_evaluating_form.html.erb | 28 +++++-------------- 2 files changed, 7 insertions(+), 24 deletions(-) diff --git a/app/controllers/challenges_controller.rb b/app/controllers/challenges_controller.rb index 14665d7a1..375596075 100644 --- a/app/controllers/challenges_controller.rb +++ b/app/controllers/challenges_controller.rb @@ -91,9 +91,6 @@ class ChallengesController < ApplicationController end def edit - @repository = @shixun.repository - @entries = @repository.entries(@path, @rev) - @st = @challenge.st challenge_num = Challenge.where(:shixun_id => @shixun).count challenge_pos = @challenge.position diff --git a/app/views/challenges/_evaluating_form.html.erb b/app/views/challenges/_evaluating_form.html.erb index 948386fc7..837264d33 100644 --- a/app/views/challenges/_evaluating_form.html.erb +++ b/app/views/challenges/_evaluating_form.html.erb @@ -107,7 +107,7 @@ $("#shixun_file_path").on('click', function (e) { alert("test"); search_shixun_files_ajax(); - achieve_ways(); +// achieve_ways(); // throttle(search_not_teacher_f, window, e); }); @@ -173,30 +173,16 @@ url: '<%= search_file_list_shixun_path(@shixun) %>', type: 'get', success: function (data) { - alert(data.dir); - if(data.dir.length > 0){ - alert(data.dir); - $(".course_list_ul").empty(); - for(var i=0; i

        " + data.dir[i][0] + "

        "); - } - $(".course_list_ul").show(); - if($(".course_list_ul").find("li").length>5){ - $(".course_list_ul").css("overflow-y","scroll"); - } else{ - $(".course_list_ul").css("overflow-y","hidden"); - } - } else{ - $(".course_list_ul").hide(); - } + var htmlvalue = "ffffffffffffffffffffff<%#= escape_javascript( render :partial => 'shixuns/achieve_ways') %>"; + pop_box_new(htmlvalue, 600, 400); } }); } - function achieve_ways(){ - var htmlvalue = "<%= escape_javascript( render :partial => 'shixuns/achieve_ways') %>"; - pop_box_new(htmlvalue, 600, 400); - } +// function search_shixun_files_ajax(){ +// +// +// } // 判断测试集是否锁定, 0未锁定,1锁定 function test_set_whether_lock(){ var lock = document.getElementsByName("test_set[lock][]"); From e38cee66b8d96cddbd6f9497459e1bf9dccb21d5 Mon Sep 17 00:00:00 2001 From: huang Date: Sat, 30 Sep 2017 18:12:25 +0800 Subject: [PATCH 07/16] =?UTF-8?q?=E6=96=87=E4=BB=B6=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/shixuns_controller.rb | 14 ++++----- .../challenges/_evaluating_form.html.erb | 24 +++----------- app/views/shixuns/_achieve_ways.html.erb | 31 +++++-------------- app/views/shixuns/search_file_list.js.erb | 2 ++ 4 files changed, 22 insertions(+), 49 deletions(-) create mode 100644 app/views/shixuns/search_file_list.js.erb diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index a5664b0f2..59d4175a2 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -16,15 +16,15 @@ class ShixunsController < ApplicationController # 获取版本库文件目录 def search_file_list - @repository = @shixun.repository - @entries = @repository.entries(@path, @rev) - path = params[:path] - path = to_path_param(path) + @path = to_path_param(path) g = Gitlab.client - dir = g.trees(@shixun.gpid, :path => path).map{|tree| [tree.type,tree.name]} - logger.info("dir is ##{dir}") - render :json => {:dir => dir} + @dir = g.trees(@shixun.gpid, :path => path).map{|tree| [tree.type,tree.name]} + logger.info("dir is ##{@dir}") + respond_to do |format| + format.js + end + # render :json => {:dir => @dir} end def achieve_ways diff --git a/app/views/challenges/_evaluating_form.html.erb b/app/views/challenges/_evaluating_form.html.erb index 837264d33..a4d3d0c80 100644 --- a/app/views/challenges/_evaluating_form.html.erb +++ b/app/views/challenges/_evaluating_form.html.erb @@ -105,10 +105,11 @@ // 获取版本库路径 $("#shixun_file_path").on('click', function (e) { - alert("test"); - search_shixun_files_ajax(); -// achieve_ways(); -// throttle(search_not_teacher_f, window, e); + data = 0; + $.ajax({ + url: '<%= search_file_list_shixun_path(@shixun) %>', + dataType: "script" + }); }); $("#shixun_form").on('click', 'a.test_icon_add', function () { @@ -168,21 +169,6 @@ }); }); - function search_shixun_files_ajax(){ - $.ajax({ - url: '<%= search_file_list_shixun_path(@shixun) %>', - type: 'get', - success: function (data) { - var htmlvalue = "ffffffffffffffffffffff<%#= escape_javascript( render :partial => 'shixuns/achieve_ways') %>"; - pop_box_new(htmlvalue, 600, 400); - } - }); - } - -// function search_shixun_files_ajax(){ -// -// -// } // 判断测试集是否锁定, 0未锁定,1锁定 function test_set_whether_lock(){ var lock = document.getElementsByName("test_set[lock][]"); diff --git a/app/views/shixuns/_achieve_ways.html.erb b/app/views/shixuns/_achieve_ways.html.erb index ca47ea645..ca4ec518c 100644 --- a/app/views/shixuns/_achieve_ways.html.erb +++ b/app/views/shixuns/_achieve_ways.html.erb @@ -7,30 +7,15 @@
          - <% @entries.each do |entry| %> - <% tr_id = Digest::MD5.hexdigest(entry.path) - depth = params[:depth].to_i %> - <% sub_path = entry.path[0] == "/" ? entry.path.sub("/", "") : entry.path %> - <% ent_path = Redmine::CodesetUtil.replace_invalid_utf8(sub_path) %> - <% ent_name = Redmine::CodesetUtil.replace_invalid_utf8(entry.name) %> -
        • -
        • + +
        • <% end %> - <%= link_to h(ent_name), - {:action => (entry.is_dir? ? 'show' : 'entry'), :id => @project, :repository_id => @repository.identifier_param, :path => to_path_param(ent_path), :rev => @rev}, - :class => (entry.is_dir? ? 'old-icon old-icon-folder' : "old-icon old-icon-file #{Redmine::MimeType.css_class_of(ent_name)}")%> -
        - <% end %> 取消 diff --git a/app/views/shixuns/search_file_list.js.erb b/app/views/shixuns/search_file_list.js.erb new file mode 100644 index 000000000..1dd512f68 --- /dev/null +++ b/app/views/shixuns/search_file_list.js.erb @@ -0,0 +1,2 @@ +var htmlvalue = "<%= escape_javascript( render :partial => 'shixuns/achieve_ways') %>"; +pop_box_new(htmlvalue, 600, 400); \ No newline at end of file From a45a85cce8b354063c3af46440d241bf3ca2230f Mon Sep 17 00:00:00 2001 From: miss <994230062@qq.com> Date: Sat, 30 Sep 2017 19:23:51 +0800 Subject: [PATCH 08/16] =?UTF-8?q?=E5=BC=B9=E6=A1=86=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/shixuns/_achieve_ways.html.erb | 30 +++++------------------- 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/app/views/shixuns/_achieve_ways.html.erb b/app/views/shixuns/_achieve_ways.html.erb index ca4ec518c..aa5fd3e7d 100644 --- a/app/views/shixuns/_achieve_ways.html.erb +++ b/app/views/shixuns/_achieve_ways.html.erb @@ -1,16 +1,16 @@ -
        +

        文件路径

        -
          +
            <%= to_path_param(@path) %> <% if @dir.present? %> <% @dir.each do |entry| %> -
          • +
          • @@ -18,27 +18,9 @@ <% end %> <% end %>
          - 取消 - 确定 + + 确定 + 取消
        - - - - - - - - - - - - - - - - - - - \ No newline at end of file From b2304597b4e3a4ed1470ebce82e1cbb9225052b8 Mon Sep 17 00:00:00 2001 From: huang Date: Sat, 30 Sep 2017 19:25:35 +0800 Subject: [PATCH 09/16] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E8=B7=AF=E5=BE=84?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E7=9B=AE=E5=BD=95=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/shixuns_controller.rb | 2 +- app/views/shixuns/_achieve_ways.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 64c6fb7c6..77b25309f 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -19,7 +19,7 @@ class ShixunsController < ApplicationController path = params[:path] @path = to_path_param(path) g = Gitlab.client - @dir = g.trees(@shixun.gpid, :path => path).map{|tree| [tree.type,tree.name]} + @dir = g.trees(@shixun.gpid, :path => @path).map{|tree|[tree.type, (@path.blank? ? tree.name : "#{@path}"+"/"+tree.name )]} logger.info("dir is ##{@dir}") respond_to do |format| format.js diff --git a/app/views/shixuns/_achieve_ways.html.erb b/app/views/shixuns/_achieve_ways.html.erb index ca4ec518c..f393c1800 100644 --- a/app/views/shixuns/_achieve_ways.html.erb +++ b/app/views/shixuns/_achieve_ways.html.erb @@ -12,7 +12,7 @@ <% @dir.each do |entry| %>
      • <% end %> From 1fd9f3a9dd7739fa9e4f6b44e9888ed4956affdd Mon Sep 17 00:00:00 2001 From: huang Date: Sat, 30 Sep 2017 19:39:13 +0800 Subject: [PATCH 10/16] =?UTF-8?q?=E6=96=87=E4=BB=B6=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/shixuns/_achieve_ways.html.erb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/views/shixuns/_achieve_ways.html.erb b/app/views/shixuns/_achieve_ways.html.erb index f393c1800..5251502e0 100644 --- a/app/views/shixuns/_achieve_ways.html.erb +++ b/app/views/shixuns/_achieve_ways.html.erb @@ -7,12 +7,17 @@
          + <%= to_path_param(@path) %> <% if @dir.present? %> <% @dir.each do |entry| %>
        • <% end %> From c1b4199f24eef4630bf8835697b6baf9c7e56edc Mon Sep 17 00:00:00 2001 From: huang Date: Sat, 30 Sep 2017 20:08:42 +0800 Subject: [PATCH 11/16] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E8=B7=AF=E5=BE=84?= =?UTF-8?q?=E7=9B=AE=E5=BD=95=E5=9B=9E=E9=80=80=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/shixuns/_achieve_ways.html.erb | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/app/views/shixuns/_achieve_ways.html.erb b/app/views/shixuns/_achieve_ways.html.erb index 5251502e0..a582638e8 100644 --- a/app/views/shixuns/_achieve_ways.html.erb +++ b/app/views/shixuns/_achieve_ways.html.erb @@ -7,8 +7,21 @@
            - - <%= to_path_param(@path) %> + <% if @path.present? %> + <% + dirs = @path.split('/') + # if 'file' == kind + # filename = dirs.pop + # end + link_path = '' + dirs.each do |dir| + next if dir.blank? + link_path << '/' unless link_path.empty? + link_path << "#{dir}" + %> + <%= link_to (h(dir)+'/'), search_file_list_shixun_path(@shixun, :path => to_path_param(to_path_param(link_path))), :class => "f14 fb", :remote => true %> + <% end %> + <% end %> <% if @dir.present? %> <% @dir.each do |entry| %>
          • From 2f0d5155efe272ab63269a5e0c1c7460a7d4c55f Mon Sep 17 00:00:00 2001 From: huang Date: Sat, 30 Sep 2017 20:09:23 +0800 Subject: [PATCH 12/16] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/shixuns/_achieve_ways.html.erb | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/views/shixuns/_achieve_ways.html.erb b/app/views/shixuns/_achieve_ways.html.erb index a582638e8..870c396bc 100644 --- a/app/views/shixuns/_achieve_ways.html.erb +++ b/app/views/shixuns/_achieve_ways.html.erb @@ -10,9 +10,6 @@ <% if @path.present? %> <% dirs = @path.split('/') - # if 'file' == kind - # filename = dirs.pop - # end link_path = '' dirs.each do |dir| next if dir.blank? From 0760e7d9e0f9fd318831ebccbcbd452997bde6dd Mon Sep 17 00:00:00 2001 From: miss <994230062@qq.com> Date: Sat, 30 Sep 2017 20:10:35 +0800 Subject: [PATCH 13/16] =?UTF-8?q?=E8=B7=AF=E5=BE=84=E7=9A=84=E8=8E=B7?= =?UTF-8?q?=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../challenges/_evaluating_form.html.erb | 4 ++-- app/views/shixuns/_achieve_ways.html.erb | 20 +++++++++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/app/views/challenges/_evaluating_form.html.erb b/app/views/challenges/_evaluating_form.html.erb index a4d3d0c80..773f44557 100644 --- a/app/views/challenges/_evaluating_form.html.erb +++ b/app/views/challenges/_evaluating_form.html.erb @@ -18,8 +18,8 @@
          • - <%#= 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 :path, :class => "panel-form-width-690 panel-box-sizing fl", :id => "shixun_file_path", :no_label => true, :placeholder => "进入实训后将默认打开该文件,如:src/test/welcome.java", :maxlength => "256" %> +
          • diff --git a/app/views/shixuns/_achieve_ways.html.erb b/app/views/shixuns/_achieve_ways.html.erb index bde9fb889..8a3b8b894 100644 --- a/app/views/shixuns/_achieve_ways.html.erb +++ b/app/views/shixuns/_achieve_ways.html.erb @@ -24,8 +24,24 @@ <% end %>
          - 确定 - 取消 + 确定 + 取消
        + + + \ No newline at end of file From a9826d556ae6e2bf8728607aa516962fcd834705 Mon Sep 17 00:00:00 2001 From: miss <994230062@qq.com> Date: Sat, 30 Sep 2017 20:32:57 +0800 Subject: [PATCH 14/16] =?UTF-8?q?=E6=96=87=E4=BB=B6=E8=B7=AF=E5=BE=84?= =?UTF-8?q?=E7=9A=84=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/shixuns/_achieve_ways.html.erb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/views/shixuns/_achieve_ways.html.erb b/app/views/shixuns/_achieve_ways.html.erb index cf2b83713..3923370a5 100644 --- a/app/views/shixuns/_achieve_ways.html.erb +++ b/app/views/shixuns/_achieve_ways.html.erb @@ -33,6 +33,10 @@ <% end %> <% end %> +
        + + +
        确定 取消 @@ -45,10 +49,10 @@ var $Path = ''; $(".old-icon-file").click(function(){ $Path = $(this).html(); - return $Path; + $("#points_tusi").val($Path); }); $("#add_path").click(function(){ - $("#shixun_file_path").val($Path); + $("#shixun_file_path").val($("#points_tusi").val()); $("#popupWrap").hide(); }); $("#back_page").click(function(){ From c6c9507abe4f54cf8a01bcf72ca2b813e970a8c4 Mon Sep 17 00:00:00 2001 From: huang Date: Sat, 30 Sep 2017 20:41:05 +0800 Subject: [PATCH 15/16] =?UTF-8?q?=E6=96=87=E4=BB=B6=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=A0=B9=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/shixuns/_achieve_ways.html.erb | 3 ++- config/routes.rb | 5 +++++ public/stylesheets/css/taskstyle.css | 8 ++++---- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/app/views/shixuns/_achieve_ways.html.erb b/app/views/shixuns/_achieve_ways.html.erb index 870c396bc..e3b31e6be 100644 --- a/app/views/shixuns/_achieve_ways.html.erb +++ b/app/views/shixuns/_achieve_ways.html.erb @@ -8,6 +8,7 @@
          <% if @path.present? %> + 根目录/ <% dirs = @path.split('/') link_path = '' @@ -16,7 +17,7 @@ link_path << '/' unless link_path.empty? link_path << "#{dir}" %> - <%= link_to (h(dir)+'/'), search_file_list_shixun_path(@shixun, :path => to_path_param(to_path_param(link_path))), :class => "f14 fb", :remote => true %> + <%= link_to (h(dir)+'/'), search_file_list_shixun_path(@shixun, :path => to_path_param(to_path_param(link_path))), :class => "f14 fb", :remote => true %> <% end %> <% end %> <% if @dir.present? %> diff --git a/config/routes.rb b/config/routes.rb index 5f33567db..958c98a7c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -252,6 +252,11 @@ RedmineApp::Application.routes.draw do get 'add_departments_part' post 'save_school' post 'update_user_message' + post 'add_auto_users_trial' + post 'create_auto_users_trial' + match 'update_auto_users_trial', :via => [:get, :post] + match 'account', :via => [:get, :post] + post 'shixun_can_copy' end end # Enable Grack support diff --git a/public/stylesheets/css/taskstyle.css b/public/stylesheets/css/taskstyle.css index d74dd10d9..566f9520a 100644 --- a/public/stylesheets/css/taskstyle.css +++ b/public/stylesheets/css/taskstyle.css @@ -70,7 +70,7 @@ a.rightbar-pause{ color:#29bd8b; font-size: 18px; margin-right:15px; margin-top: .panel-inner-title{ font-size: 14px; color: #666; max-width:85%; line-height:30px;word-wrap: break-word; margin-bottom: 10px} .panel-footer{ min-width:1000px; height: 210px!important;} /* 弹框 */ -.task-popup-text-center{ text-align: center; color: #666;} +.task-popup-text-center{ text-align: center; color: #333;} .task-popup-title{ border-bottom: 1px solid #eee; padding:10px 15px; } .task-popup-content{ padding:0px 15px 15px 15px;} .task-popup-submit{ margin: 0 auto 15px; width: 120px;} @@ -430,11 +430,11 @@ html>body #ajax-indicator-base { position: fixed; } /*二次回复的提示语的样式*/ .points-data-tip-top{position:absolute;left:100px;top:-30px;opacity:.7;width:150px;height:30px;z-index:9999;display:none;} -.data-tip-top{position:relative;box-shadow:0px 0px 8px #000;backgund:#000;color:#fff;word-wrap: break-word; +.data-tip-top1{position:relative;box-shadow:0px 0px 8px #000;background:#000;color:#fff;word-wrap: break-word; text-align:center;border-radius:4px;padding:0 10px;border:1px solid #000;} -.data-tip-top:after,.data-tip-top:before{position: absolute;content:'';width:0;height:0;left: 45%;bottom:-10px;border-left: 5px solid transparent; +.data-tip-top1:after,.data-tip-top1:before{position: absolute;content:'';width:0;height:0;left: 45%;bottom:-10px;border-left: 5px solid transparent; border-right: 5px solid transparent;border-top: 10px solid #000;} -.data-tip-top:before{bottom:-11px;} +.data-tip-top1:before{bottom:-11px;} /*选择题tab切换*/ .nav_option li{overflow: hidden;width: 110px; text-align: center;cursor: pointer;height: 38px;line-height: 38px;border-top-right-radius: 5px;border-top-left-radius: 5px;border:1px solid #e2e2e2;border-bottom: 0px;color: #FF7500;border-right: none;} .nav_option li:last-child{border-right: 1px solid #e2e2e2;} From 500d8e1082d409ec304139f76f7737836485ac37 Mon Sep 17 00:00:00 2001 From: huang Date: Sat, 30 Sep 2017 20:51:02 +0800 Subject: [PATCH 16/16] =?UTF-8?q?=E6=8C=87=E5=AE=9A=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E7=9B=AE=E5=BD=95=E4=BB=A3=E7=A0=81=E4=B8=BA=E7=A9=BA=E7=9A=84?= =?UTF-8?q?=E6=97=B6=E5=80=99=E7=BB=99=E5=87=BA=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/shixuns/_achieve_ways.html.erb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/views/shixuns/_achieve_ways.html.erb b/app/views/shixuns/_achieve_ways.html.erb index 9987a555b..f10e2155a 100644 --- a/app/views/shixuns/_achieve_ways.html.erb +++ b/app/views/shixuns/_achieve_ways.html.erb @@ -32,6 +32,8 @@
        <% end %> + <% else %> + 指定文件路径前,请先在版本库中提交代码 <% end %>