diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 921bdf161..77b25309f 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -14,6 +14,24 @@ 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] + @path = to_path_param(path) + g = Gitlab.client + @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 + end + # render :json => {:dir => @dir} + end + + 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 pub_shixun = ApplyAction.where(:container_type => "ApplyShixun", :status => 1, :container_id => @shixun.id).last diff --git a/app/views/challenges/_evaluating_form.html.erb b/app/views/challenges/_evaluating_form.html.erb index 46e28bf47..773f44557 100644 --- a/app/views/challenges/_evaluating_form.html.erb +++ b/app/views/challenges/_evaluating_form.html.erb @@ -18,9 +18,12 @@
  • - <%= 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" %> + +
  • +
  • <%= f.text_field :exec_path, :class => "panel-form-width-690 panel-box-sizing fl", :no_label => true, :placeholder => "输入关卡需要执行的文件路径,如:src/test/main.java", :maxlength => "256" %> @@ -100,6 +103,15 @@ bt.LEFT_DELIMITER = ''; + // 获取版本库路径 + $("#shixun_file_path").on('click', function (e) { + data = 0; + $.ajax({ + url: '<%= search_file_list_shixun_path(@shixun) %>', + dataType: "script" + }); + }); + $("#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 +167,8 @@ $(inputs_labels[j]).html("组" + (j + 1)); } }); - }); + // 判断测试集是否锁定, 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 new file mode 100644 index 000000000..f10e2155a --- /dev/null +++ b/app/views/shixuns/_achieve_ways.html.erb @@ -0,0 +1,64 @@ + +
    +
    +

    文件路径

    + +
    +
    +
    +
      + <% if @path.present? %> + 根目录/ + <% + dirs = @path.split('/') + 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| %> +
    • + +
    • + <% end %> + <% else %> + 指定文件路径前,请先在版本库中提交代码 + <% 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 diff --git a/config/routes.rb b/config/routes.rb index 1d5b87363..958c98a7c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -107,6 +107,8 @@ RedmineApp::Application.routes.draw do get 'search_user_courses' post 'send_to_course' get 'statistics_students' + get 'search_file_list' + get 'achieve_ways' end collection do get 'shixun_courses' @@ -250,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;}