Merge branch 'dev_huang' into develop

This commit is contained in:
huang 2017-09-30 21:06:10 +08:00
commit 88d151ec31
6 changed files with 109 additions and 6 deletions

View File

@ -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

View File

@ -18,9 +18,12 @@
<div id="shixun_form">
<li class="clearfix">
<label class="panel-form-label fl"><span class="c_red mr5">*</span>文件路径:</label>
<%= 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" %>
<!--<input id="shixun_file_path" class="panel-form-width-690 panel-box-sizing fl">-->
<span style="display: none" class="c_red ml95" id="challenge_file_path">文件路径不能为空</span>
</li>
<li class="clearfix">
<label class="panel-form-label fl"><span class="c_red mr5">*</span>执行文件:</label>
<%= 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 = '<!';
bt.RIGHT_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][]");

View File

@ -0,0 +1,64 @@
<!-------------------文件路径--------------------------->
<div class="task-popup newteacher" style="width:600px;">
<div class="task-popup-title clearfix task-popup-bggrey">
<h3 class="fl ">文件路径</h3>
<a href="javascript:void(0);" class="pop_close"><i class="fa fa-times-circle font-18 link-color-grey fr mt5"></i></a>
</div>
<div class="task_popup_con">
<div class="newupload_conbox clearfix">
<ul style = "height:200px;overflow-y:hidden;background:#f5f5f5; padding:10px;">
<% if @path.present? %>
<a class="f14 fb" href="<%= search_file_list_shixun_path(@shixun) %>" data-remote="true">根目录/</a>
<%
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| %>
<li class = "entry">
<div class="filename_no_report hidden">
<% if entry[0] == "tree" %>
<%= link_to h(entry[1]), search_file_list_shixun_path(@shixun, :path => to_path_param(entry[1])), :class => 'old-icon old-icon-folder', :remote => true %>
<% else %>
<a href="javascript:void(0);" class="old-icon old-icon-file"><%= h(entry[1]) %></a>
<% end %>
</div>
</li>
<% end %>
<% else %>
指定文件路径前,请先在版本库中提交代码
<% end %>
</ul>
<div class = "clearfix mt20">
<label class="panel-form-label fl" style = "width:120px;text-align:left;">选中的文件路径:</label>
<input id = "points_tusi" placeholder = "选中的文件路径" class = "fl panel-form-width-200 panel-box-sizing" style = "width:440px;"/>
</div>
<a href="javascript:void(0);" class="task-btn task-btn-blue fr" style="margin-top: 20px;margin-left:20px;" id = "add_path">确定</a>
<a href="javascript:void(0);" class="pop_close task-btn mb10 fr" style="margin-top: 20px;" id = "back_page">取消</a>
</div>
</div>
</div>
<script>
var $Path = '';
$(".old-icon-file").click(function(){
$Path = $(this).html();
$("#points_tusi").val($Path);
});
$("#add_path").click(function(){
$("#shixun_file_path").val($("#points_tusi").val());
$("#popupWrap").hide();
});
$("#back_page").click(function(){
$("#popupWrap").hide();
})
</script>

View File

@ -0,0 +1,2 @@
var htmlvalue = "<%= escape_javascript( render :partial => 'shixuns/achieve_ways') %>";
pop_box_new(htmlvalue, 600, 400);

View File

@ -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

View File

@ -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;}