Merge branch 'develop' into dev_linda
This commit is contained in:
commit
1f2bcfbe2b
|
|
@ -33,6 +33,8 @@
|
|||
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="RAILS_SERVER_TYPE" VALUE="Default" />
|
||||
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="ENVIRONMENT_TYPE" VALUE="development" />
|
||||
<RAILS_SERVER_CONFIG_SETTINGS_ID NAME="LAUNCH_JS" VALUE="false" />
|
||||
<RunnerSettings RunnerId="RubyDebugRunner" />
|
||||
<ConfigurationWrapper RunnerId="RubyDebugRunner" />
|
||||
<method />
|
||||
</configuration>
|
||||
<configuration default="false" name="Production: bigdate" type="RailsRunConfigurationType" factoryName="Rails">
|
||||
|
|
@ -109,7 +111,7 @@
|
|||
<orderEntry type="jdk" jdkName="ruby-1.9.3-p484" jdkType="RUBY_SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module-library">
|
||||
<library name="gitlab (v3.2.0, D:/002/bigdata/lib/gitlab-cli) [path][gem]">
|
||||
<library name="gitlab (v3.2.0, F:/bigdata/lib/gitlab-cli) [path][gem]">
|
||||
<CLASSES>
|
||||
<root url="file://$MODULE_DIR$/lib/gitlab-cli/bin" />
|
||||
<root url="file://$MODULE_DIR$/lib/gitlab-cli/lib" />
|
||||
|
|
@ -121,7 +123,7 @@
|
|||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="grack (v2.0.2, D:/002/bigdata/lib/grack) [path][gem]">
|
||||
<library name="grack (v2.0.2, F:/bigdata/lib/grack) [path][gem]">
|
||||
<CLASSES>
|
||||
<root url="file://$MODULE_DIR$/lib/grack/bin" />
|
||||
<root url="file://$MODULE_DIR$/lib/grack/lib" />
|
||||
|
|
@ -135,7 +137,7 @@
|
|||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="rails_kindeditor (v0.4.5, D:/002/bigdata/lib/rails_kindeditor) [path][gem]">
|
||||
<library name="rails_kindeditor (v0.4.5, F:/bigdata/lib/rails_kindeditor) [path][gem]">
|
||||
<CLASSES>
|
||||
<root url="file://$MODULE_DIR$/lib/rails_kindeditor/app" />
|
||||
<root url="file://$MODULE_DIR$/lib/rails_kindeditor/lib" />
|
||||
|
|
@ -153,7 +155,7 @@
|
|||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
<library name="wechat (v[path], D:/002/bigdata/lib/wechat) [path][gem]">
|
||||
<library name="wechat (v[path], F:/bigdata/lib/wechat) [path][gem]">
|
||||
<CLASSES>
|
||||
<root url="file://$MODULE_DIR$/lib/wechat/bin" />
|
||||
<root url="file://$MODULE_DIR$/lib/wechat/lib" />
|
||||
|
|
@ -218,7 +220,6 @@
|
|||
<orderEntry type="library" scope="PROVIDED" name="ice_nine (v0.11.1, ruby-1.9.3-p484) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="journey (v1.0.4, ruby-1.9.3-p484) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="jquery-rails (v2.0.3, ruby-1.9.3-p484) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="json (v1.8.3, ruby-1.9.3-p484) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="kaminari (v0.16.3, ruby-1.9.3-p484) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="mail (v2.5.4, ruby-1.9.3-p484) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="mime-types (v1.25.1, ruby-1.9.3-p484) [gem]" level="application" />
|
||||
|
|
@ -242,7 +243,6 @@
|
|||
<orderEntry type="library" scope="PROVIDED" name="rack-test (v0.6.3, ruby-1.9.3-p484) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="rails (v3.2.16, ruby-1.9.3-p484) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="railties (v3.2.16, ruby-1.9.3-p484) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="rake (v10.4.2, ruby-1.9.3-p484) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="rdoc (v3.12.2, ruby-1.9.3-p484) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="redis (v3.2.1, ruby-1.9.3-p484) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="redis-actionpack (v3.2.4, ruby-1.9.3-p484) [gem]" level="application" />
|
||||
|
|
@ -262,7 +262,6 @@
|
|||
<orderEntry type="library" scope="PROVIDED" name="sprockets (v2.2.3, ruby-1.9.3-p484) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="terminal-table (v1.5.2, ruby-1.9.3-p484) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="thor (v0.19.1, ruby-1.9.3-p484) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="thread_safe (v0.3.5, ruby-1.9.3-p484) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="tilt (v1.4.1, ruby-1.9.3-p484) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="treetop (v1.4.15, ruby-1.9.3-p484) [gem]" level="application" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="tzinfo (v0.3.44, ruby-1.9.3-p484) [gem]" level="application" />
|
||||
|
|
|
|||
|
|
@ -4,25 +4,25 @@
|
|||
<data-source source="LOCAL" name="Rails bigdate: production" uuid="adee68b8-199d-47ec-bc4e-eaf7d580fa6c">
|
||||
<driver-ref>mysql</driver-ref>
|
||||
<jdbc-driver>com.mysql.jdbc.Driver</jdbc-driver>
|
||||
<jdbc-url>jdbc:mysql://127.0.0.1/trustie2</jdbc-url>
|
||||
<jdbc-url>jdbc:mysql://127.0.0.1/0604new</jdbc-url>
|
||||
<user-name>root</user-name>
|
||||
<user-password>df9bdf98df99df9edf9fdf9c</user-password>
|
||||
<user-password>df9bdf98df99df9e</user-password>
|
||||
<libraries />
|
||||
</data-source>
|
||||
<data-source source="LOCAL" name="Rails bigdate: development" uuid="f43a223e-937a-457d-9c1a-d91100b6257b">
|
||||
<driver-ref>mysql</driver-ref>
|
||||
<jdbc-driver>com.mysql.jdbc.Driver</jdbc-driver>
|
||||
<jdbc-url>jdbc:mysql://127.0.0.1/trustie2</jdbc-url>
|
||||
<jdbc-url>jdbc:mysql://127.0.0.1/20161227data</jdbc-url>
|
||||
<user-name>root</user-name>
|
||||
<user-password>df9bdf98df99df9edf9fdf9c</user-password>
|
||||
<user-password>df9bdf98df99df9e</user-password>
|
||||
<libraries />
|
||||
</data-source>
|
||||
<data-source source="LOCAL" name="Rails bigdate: test" uuid="e85434eb-4b0f-4e83-a8a4-933a0fed85bc">
|
||||
<driver-ref>mysql</driver-ref>
|
||||
<jdbc-driver>com.mysql.jdbc.Driver</jdbc-driver>
|
||||
<jdbc-url>jdbc:mysql://127.0.0.1/trustie2</jdbc-url>
|
||||
<jdbc-url>jdbc:mysql://127.0.0.1/0623newblank</jdbc-url>
|
||||
<user-name>root</user-name>
|
||||
<user-password>df9bdf98df99df9edf9fdf9c</user-password>
|
||||
<user-password>df9bdf98df99df9e</user-password>
|
||||
<libraries />
|
||||
</data-source>
|
||||
</component>
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ class AccountController < ApplicationController
|
|||
def logout
|
||||
if User.current.anonymous?
|
||||
redirect_to signin_path
|
||||
elsif request.post?
|
||||
else
|
||||
logout_user
|
||||
redirect_to signin_path
|
||||
end
|
||||
|
|
|
|||
|
|
@ -433,7 +433,7 @@ class ApplicationController < ActionController::Base
|
|||
if params[:project_id]
|
||||
@project = Project.find(params[:project_id])
|
||||
elsif params[:shixun_id]
|
||||
@shixun = Shixun.find(params[:shixun_id])
|
||||
@shixun = Shixun.find_by_identifier(params[:shixun_id])
|
||||
elsif params[:course_id]
|
||||
@course = Course.find(params[:course_id])
|
||||
elsif params[:org_subfield_id]
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ class BoardsController < ApplicationController
|
|||
@boards = @course.boards.includes(:last_message => :author).all
|
||||
if @course.boards.empty?
|
||||
@board = @course.boards.build
|
||||
@board.name = " #{l(:label_borad_course) }"
|
||||
@board.name = "#{l(:label_borad_course)}"
|
||||
@board.description = @course.name.to_s
|
||||
@board.project_id = -1
|
||||
if @board.save
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ class ChallengesController < ApplicationController
|
|||
end
|
||||
# 向jenkins端发送请求,构建pipeline片段,实时返回结果
|
||||
jenkins_shixuns = Redmine::Configuration['jenkins_shixuns']
|
||||
params = {:challengeStage => "#{@challenge.position}", :challengeType => "#{@challenge.evaluation_way.to_i}", :challengeProgramName => "#{@challenge.path}", :trainingID => "#{@shixun.id}"}
|
||||
params = {:challengeStage => "#{@challenge.position}", :challengeType => "#{@challenge.evaluation_way.to_i}", :challengeProgramName => "#{@challenge.exec_path}", :trainingID => "#{@shixun.id}"}
|
||||
uri = URI("#{jenkins_shixuns}/jenkins-exec/game/generatePipelineScriptForChallenge")
|
||||
res = uri_exec uri, {challengeInfo: params.to_json}
|
||||
if res['code'] == 0
|
||||
|
|
@ -70,7 +70,6 @@ class ChallengesController < ApplicationController
|
|||
def index
|
||||
# 顶部导航
|
||||
@challenges = @shixun.challenges.order("position desc")
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html
|
||||
|
|
@ -117,7 +116,7 @@ class ChallengesController < ApplicationController
|
|||
end
|
||||
# 向jenkins端发送请求,构建pipeline片段,实时返回结果
|
||||
jenkins_shixuns = Redmine::Configuration['jenkins_shixuns']
|
||||
params = {:challengeStage => "#{@challenge.position}", :challengeType => "#{@challenge.evaluation_way.to_i}", :challengeProgramName => "#{@challenge.path}", :trainingID => "#{@shixun.id}"}
|
||||
params = {:challengeStage => "#{@challenge.position}", :challengeType => "#{@challenge.evaluation_way.to_i}", :challengeProgramName => "#{@challenge.exec_path}", :trainingID => "#{@shixun.id}"}
|
||||
uri = URI("#{jenkins_shixuns}/jenkins-exec/game/generatePipelineScriptForChallenge")
|
||||
res = uri_exec uri, {challengeInfo: params.to_json}
|
||||
if res['code'] == 0
|
||||
|
|
@ -216,7 +215,11 @@ class ChallengesController < ApplicationController
|
|||
# Find project of id params[:id]
|
||||
def find_shixun
|
||||
shixun_id = params[:shixun_id] || (params[:challenge] && params[:challenge][:shixun_id])
|
||||
@shixun = Shixun.find(shixun_id)
|
||||
@shixun = Shixun.find_by_identifier(shixun_id)
|
||||
if @shixun.nil?
|
||||
render_404
|
||||
return
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
end
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ class GamesController < ApplicationController
|
|||
game_challenge = @game.challenge
|
||||
gitUrl = git_repository_url(@myshixun, "Myshixun")
|
||||
gitUrl = Base64.encode64(gitUrl)
|
||||
taskId = params[:id]
|
||||
taskId = @game.id
|
||||
jobName = "myshixun_#{@myshixun.id}"
|
||||
ActiveRecord::Base.transaction do
|
||||
@game.update_attributes!(:status => 1)
|
||||
|
|
@ -163,6 +163,7 @@ class GamesController < ApplicationController
|
|||
# 下一关自动开启
|
||||
if had_done != 1 && @game.status == 2
|
||||
@game.next_game.update_attribute(:status, 0)
|
||||
@myshixun.update_attribute(:status, 1)
|
||||
end
|
||||
test_sets = game_challenge.test_sets
|
||||
unless test_sets.blank?
|
||||
|
|
@ -202,7 +203,7 @@ class GamesController < ApplicationController
|
|||
next_game = @game.next_game
|
||||
next_game.update_attributes(:status => 0, :open_time => Time.now) if next_game.status == 3
|
||||
|
||||
redirect_to myshixun_game_path(next_game, :myshixun_id => @myshixun.id)
|
||||
redirect_to myshixun_game_path(next_game, :myshixun_id => @myshixun)
|
||||
|
||||
end
|
||||
|
||||
|
|
@ -291,13 +292,22 @@ class GamesController < ApplicationController
|
|||
# Find myshixun of id params[:id]
|
||||
def find_myshixun
|
||||
myshixun_id = params[:myshixun_id] || (params[:game] && params[:game][:myshixun_id])
|
||||
@myshixun = Myshixun.find(myshixun_id)
|
||||
@myshixun = Myshixun.find_by_identifier(myshixun_id)
|
||||
if @myshixun.nil?
|
||||
render_404
|
||||
return
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
end
|
||||
|
||||
def find_game
|
||||
@game = Game.find(params[:id])
|
||||
# myshixun_id = params[:myshixun_id]
|
||||
@game = Game.find_by_identifier(params[:id])
|
||||
if @game.nil?
|
||||
render_404
|
||||
return
|
||||
end
|
||||
@myshixun = @game.myshixun
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ class MyshixunsController < ApplicationController
|
|||
jsonTestDetails = JSON.parse(params[:jsonTestDetails])
|
||||
status = jsonTestDetails['status']
|
||||
game_id = jsonTestDetails['buildID']
|
||||
outPut = Base64.decode64(jsonTestDetails['outPut']) unless jsonTestDetails['outPut'].blank?
|
||||
outPut = Base64.urlsafe_decode64(jsonTestDetails['outPut']) unless jsonTestDetails['outPut'].blank?
|
||||
jenkins_testsets = jsonTestDetails['msg']
|
||||
# message = Base64.decode64(params[:msg]) unless params[:msg].blank?
|
||||
game = Game.find(game_id)
|
||||
|
|
@ -51,7 +51,7 @@ class MyshixunsController < ApplicationController
|
|||
private
|
||||
# Find myshixun of id params[:id]
|
||||
def find_myshixun
|
||||
@myshixun = Myshixun.find(params[:id])
|
||||
@myshixun = Myshixun.find_by_identifier(params[:id])
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
end
|
||||
|
|
|
|||
|
|
@ -900,7 +900,7 @@ update
|
|||
end
|
||||
|
||||
def find_project_and_repository
|
||||
@shixun = Shixun.find(params[:id])
|
||||
@shixun = Shixun.find_by_identifier(params[:id])
|
||||
@repository = @shixun.repository
|
||||
render_404 if @shixun.gpid.nil?
|
||||
@path = params[:path].is_a?(Array) ? params[:path].join('/') : params[:path].to_s
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
class ShixunsController < ApplicationController
|
||||
layout 'base_shixun'
|
||||
before_filter :require_login
|
||||
before_filter :find_shixun, :except => [ :index, :new, :create, :index]
|
||||
before_filter :find_shixun, :except => [ :index, :new, :create, :index, :search]
|
||||
before_filter :shixun_view_allow, :only => [:show]
|
||||
before_filter :require_manager, :only => [ :settings, :add_script, :publish]
|
||||
|
||||
|
|
@ -21,12 +21,28 @@ class ShixunsController < ApplicationController
|
|||
end
|
||||
|
||||
def index
|
||||
@shixuns = Shixun.all
|
||||
|
||||
@shixuns = Shixun.where(:authentication => 1).order('updated_at desc')
|
||||
@shixun_my_score = Game.sum(:final_score)
|
||||
@current_user_had_passed = Myshixun.where(:status => 1).count
|
||||
@shixuns_count = @shixuns.count
|
||||
render :layout => "base_edu"
|
||||
end
|
||||
|
||||
def search
|
||||
# 确定 sort 1升序 2 降序
|
||||
if params[:time_reorder]
|
||||
order = "#{Shixun.table_name}.created_at #{params[:time_reorder]}"
|
||||
elsif params[:hot_reorder]
|
||||
order = "myshixun_count #{params[:hot_reorder]}, #{Shixun.table_name}.updated_at #{params[:hot_reorder]}"
|
||||
else
|
||||
order = "#{Shixun.table_name}.created_at desc"
|
||||
end
|
||||
@shixuns = Shixun.where(:authentication => 1).reorder(order)
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
# jenkins回调脚本
|
||||
# gameID 及实训ID
|
||||
def publish
|
||||
|
|
@ -42,7 +58,7 @@ class ShixunsController < ApplicationController
|
|||
fragments << challenge_script
|
||||
# 每一关所有的测试集
|
||||
challenge.test_sets.each do |test_set|
|
||||
test_cases = {:caseId => test_set.id.to_s, :input => test_set.input, :output => test_set.output}
|
||||
test_cases = {:caseId => test_set.id.to_s, :input => test_set.input, :output => test_set.output, :isPublic => test_set.is_public}
|
||||
testSet << test_cases
|
||||
end
|
||||
test_sets_list = {:challengeStage => challenge.position.to_s, :challengeTestCases => testSet}
|
||||
|
|
@ -93,11 +109,14 @@ class ShixunsController < ApplicationController
|
|||
gshixun = @g.fork(@shixun.gpid, User.current.gid)
|
||||
if !gshixun.id.nil?
|
||||
myshixun = copy_myshixun(@shixun, gshixun)
|
||||
@shixun.update_attribute(:myshixun_count, (@shixun.myshixun_count + 1))
|
||||
challenges = @shixun.challenges
|
||||
# 之所以增加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, :open_time => Time.now)
|
||||
code = CODES.sample(12).join
|
||||
code = CODES.sample(12).join if Game.where(identifier: code).present?
|
||||
Game.create!(:challenge_id => challenge.id, :myshixun_id => myshixun.id, :status => status, :user_id => myshixun.user_id, :open_time => Time.now, :identifier => code)
|
||||
end
|
||||
else
|
||||
raise("网络异常,请稍后重试")
|
||||
|
|
@ -123,16 +142,20 @@ class ShixunsController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
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)
|
||||
def create
|
||||
identifier = generate_identifier
|
||||
@shixun = Shixun.new(params[:shixun])
|
||||
@shixun.user_id = User.current.id
|
||||
@shixun.language = params[:language]
|
||||
@shixun.identifier = identifier
|
||||
(params[:shixun][:is_public] == "1" ? @shixun.is_public = true : @shixun.is_public = false)
|
||||
respond_to do |format|
|
||||
if @shixun.save
|
||||
generate_identifier
|
||||
m = ShixunMember.new(:user_id => User.current.id, :role => 1)
|
||||
@shixun.shixun_members << m
|
||||
format.html { redirect_to @shixun, notice: l(:notice_successful_create) }
|
||||
format.html { redirect_to shixun_path @shixun, notice: l(:notice_successful_create) }
|
||||
format.js
|
||||
else
|
||||
format.html { render action: "new" }
|
||||
|
|
@ -147,6 +170,13 @@ class ShixunsController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
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)
|
||||
def generate_identifier
|
||||
code = CODES.sample(8).join
|
||||
return generate_identifier if Shixun.where(identifier: code).present?
|
||||
code
|
||||
end
|
||||
|
||||
def edit
|
||||
end
|
||||
|
||||
|
|
@ -209,7 +239,8 @@ class ShixunsController < ApplicationController
|
|||
|
||||
# Find shixun of id params[:id]
|
||||
def find_shixun
|
||||
@shixun = Shixun.find(params[:id])
|
||||
@shixun = Shixun.find_by_identifier(params[:id])
|
||||
render_404 if @shixun.nil?
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
end
|
||||
|
|
@ -232,14 +263,18 @@ class ShixunsController < ApplicationController
|
|||
# REDO: 新增类型copy的时候
|
||||
# 复制项目
|
||||
# gshixun --> gitlab project
|
||||
CODES = %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 copy_myshixun shixun, gshixun
|
||||
myshixun = Myshixun.new
|
||||
myshixun.attributes = shixun.attributes.dup.except("id","user_id","visits","gpid","status")
|
||||
myshixun.attributes = shixun.attributes.dup.except("id","user_id","visits","gpid","status", "identifier")
|
||||
myshixun.shixun_id = shixun.id
|
||||
myshixun.user_id = User.current.id
|
||||
myshixun.gpid = gshixun.id
|
||||
jenkins_shixuns = Redmine::Configuration['jenkins_shixuns']
|
||||
if myshixun.save!
|
||||
code = CODES.sample(10).join
|
||||
code = CODES.sample(10).join if Myshixun.where(identifier: code).present?
|
||||
myshixun.update_attribute(:identifier, code)
|
||||
MyshixunMember.create!(:myshixun_id => myshixun.id, :user_id => User.current.id, :role => 1)
|
||||
rep = Repository.new(:myshixun_id => myshixun.id, :identifier => gshixun.name,:project_id => -1, :shixun_id => -2)
|
||||
rep.type = "Repository::Gitlab"
|
||||
|
|
|
|||
|
|
@ -353,6 +353,14 @@ module ApplicationHelper
|
|||
super
|
||||
end
|
||||
|
||||
# 重置user_path,目的是将id转换成用户名
|
||||
# def shixun_path(resource, parameters = {})
|
||||
# if Fixnum === resource
|
||||
# resource = Shixun.find(resource)
|
||||
# end
|
||||
# super
|
||||
# end
|
||||
|
||||
# 历史数据(老版本库数据)处理完则可以修改该放放
|
||||
def get_rep_identifier_by_project project
|
||||
identifier = Repository.where(:project_id => project.id, :type => "Repository::Gitlab").first.try(:identifier)
|
||||
|
|
|
|||
|
|
@ -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, :open_time
|
||||
attr_accessible :myshixun_id, :user_id, :status, :final_score, :challenge_id, :open_time, :identifier
|
||||
belongs_to :myshixun,:touch=> true
|
||||
belongs_to :user
|
||||
belongs_to :challenge
|
||||
|
|
@ -9,6 +9,12 @@ class Game < ActiveRecord::Base
|
|||
has_many :test_sets, :dependent => :destroy
|
||||
has_many :challenge_samples, :dependent => :destroy
|
||||
|
||||
# id 转换成 challenge'position
|
||||
def to_param
|
||||
identifier
|
||||
end
|
||||
|
||||
|
||||
def last_game
|
||||
challenge = self.challenge
|
||||
last_challenge_id = challenge.last_challenge
|
||||
|
|
|
|||
|
|
@ -1,11 +1,16 @@
|
|||
class Myshixun < ActiveRecord::Base
|
||||
attr_accessible :description, :name, :parent_id, :user_id, :gpid, :forked_from, :visits, :is_public
|
||||
attr_accessible :description, :name, :parent_id, :user_id, :gpid, :forked_from, :visits, :is_public, :identifier
|
||||
has_many :users, :through => :myshixun_members
|
||||
has_many :myshixun_members
|
||||
has_one :repository
|
||||
has_many :games, :dependent => :destroy, :order => "games.id ASC"
|
||||
belongs_to :shixun
|
||||
|
||||
# id 转换成 identifier
|
||||
def to_param
|
||||
identifier
|
||||
end
|
||||
|
||||
# 当前任务:一个实训中只可能一个未完成任务(status 0或1只会存在一条记录)
|
||||
# status:0 可以测评的,正在测评的
|
||||
# 如果都完成,则当前任务为最后一个任务
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# status 控制实训的状态,0:未开启;1: 已开启(TPM); 2:已认证
|
||||
class Shixun < ActiveRecord::Base
|
||||
attr_accessible :description, :is_public, :name, :changeset_num, :status, :user_id, :gpid, :language
|
||||
attr_accessible :description, :is_public, :name, :changeset_num, :status, :user_id, :gpid, :language, :identifier, :authentication, :myshixun_count
|
||||
|
||||
has_many :users, :through => :shixun_members
|
||||
has_many :shixun_members
|
||||
|
|
@ -8,6 +8,11 @@ class Shixun < ActiveRecord::Base
|
|||
has_many :challenges, :dependent => :destroy, :order => "challenges.id ASC"
|
||||
has_many :myshixuns
|
||||
|
||||
# id 转换成 identifier
|
||||
def to_param
|
||||
identifier
|
||||
end
|
||||
|
||||
def owner
|
||||
User.find(self.user_id)
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
|
|
|
|||
|
|
@ -85,6 +85,10 @@
|
|||
<label class="panel-form-label fl">文件路径:</label>
|
||||
<%= f.text_field :path, :class => "panel-form-width-690 panel-box-sizing fl", :no_label => true, :placeholder => "进入实训后将默认打开该文件,如:app/controllers/welcome_controller.rb", :maxlength => "256" %>
|
||||
</li>
|
||||
<li class="clearfix">
|
||||
<label class="panel-form-label fl">执行文件:</label>
|
||||
<%= f.text_field :exec_path, :class => "panel-form-width-690 panel-box-sizing fl", :no_label => true, :placeholder => "输入关卡需要执行的文件路径,如:app/controllers/welcome_controller.rb", :maxlength => "256" %>
|
||||
</li>
|
||||
<li class="clearfix">
|
||||
<label class="panel-form-label fl">预备知识:</label>
|
||||
<div id="challenge_ready_konewlege" class="new_li">
|
||||
|
|
@ -167,7 +171,7 @@
|
|||
<button class="close fl mt8 mr10" type="button" onclick="$('#add_shixun_skill').slideToggle();" id="add_knowledge">+</button>
|
||||
<div class="task-tag tag-grey mt5 mr10 fl undis" id="add_shixun_skill">
|
||||
<button data-dismiss="alert" class="close fr mt3 ml5" type="button" onclick="$('#add_shixun_skill').slideToggle();">×</button>
|
||||
<input type="text" class="task-tag-input" onblur="add_tag();" placeholder="请输入知识/技能点" />
|
||||
<input type="text" class="task-tag-input" onblur="add_tag();" id="shixun_skill_input" placeholder="请输入知识/技能点" />
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
|
|
@ -297,6 +301,12 @@
|
|||
}
|
||||
})
|
||||
|
||||
// 知识技能点添加,清空输入框,并focus
|
||||
$("#add_knowledge").click(function(){
|
||||
$("#shixun_skill_input").val("");
|
||||
$("#shixun_skill_input").focus();
|
||||
});
|
||||
|
||||
});
|
||||
// 设置textarea的宽度到140以后出现滚动条
|
||||
var text1 = document.getElementById("textarea_sample_input_test");
|
||||
|
|
@ -409,6 +419,8 @@
|
|||
" </div>");
|
||||
$(".task-tag-input").attr("value","");
|
||||
}
|
||||
$("#shixun_skill_input").val("");
|
||||
$("#shixun_skill_input").focus();
|
||||
}
|
||||
|
||||
function close_tag(thisObj){
|
||||
|
|
|
|||
|
|
@ -52,6 +52,12 @@
|
|||
<%= @challenge.path.blank? ? "无" : (h @challenge.path.html_safe) %>
|
||||
</div>
|
||||
</li>
|
||||
<li class="clearfix">
|
||||
<label class="panel-form-label fl">执行文件:</label>
|
||||
<div class="fl task-bg-grey panel-box-sizing panel-form-width-690">
|
||||
<%= @challenge.exec_path.blank? ? "无" : (h @challenge.exec_path) %>
|
||||
</div>
|
||||
</li>
|
||||
<li class="clearfix challenge_bottom">
|
||||
<label class="panel-form-label fl">预备知识:</label>
|
||||
<div class="fl task-bg-grey panel-box-sizing panel-form-width-690 new_li" id="wordsView" style="width: 90%">
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
:class => "task-btn task-btn-blue mr15 mt8",
|
||||
:remote => true %>
|
||||
<% else %>
|
||||
<a href="javascript:void(0);" onclick="exit_shixun()" class="task-btn task-btn-blue mb10 mt6 mr15">退出实训</a>
|
||||
<a href="<%= shixuns_path() %>" class="task-btn task-btn-blue mb10 mt6 mr15">退出实训</a>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
@ -106,9 +106,4 @@
|
|||
|
||||
});
|
||||
}
|
||||
function exit_shixun(){
|
||||
window.opener=null;
|
||||
window.open('<%= shixuns_path() %>','_self');
|
||||
window.close();
|
||||
}
|
||||
</script>
|
||||
|
|
@ -2,9 +2,9 @@
|
|||
.CodeMirror{line-height: 1.2; font-size: 14px}
|
||||
</style>
|
||||
|
||||
<form action="/myshixuns/<%= @myshixun.id %>/games/<%= @game.id %>/file_update?path=<%= @path %>" method="post" id="file_update_id" data-remote="true">
|
||||
<form action="<%= file_update_myshixun_game_path(@game, :myshixun_id => @myshixun, :path => @path) %>" method="post" id="file_update_id" data-remote="true">
|
||||
<li class="clearfix" xmlns="http://www.w3.org/1999/html" id="edit_code_contents">
|
||||
<textarea class = "" id="challenge-answer-edit-small" name="content"><%= Redmine::CodesetUtil.replace_invalid_utf8(@content) %></textarea>
|
||||
<textarea class="" id="challenge-answer-edit-small" name="content"><%= Redmine::CodesetUtil.replace_invalid_utf8(@content) %></textarea>
|
||||
</li>
|
||||
</form>
|
||||
|
||||
|
|
@ -19,11 +19,11 @@
|
|||
var editor_CodeMirror = CodeMirror.fromTextArea(document.getElementById("challenge-answer-edit-small"), {
|
||||
mode: {name: "text/x-java",
|
||||
// version: 2,
|
||||
singleLineStringErrors: false},
|
||||
singleLineStringErrors: false},
|
||||
lineNumbers: true,
|
||||
theme: "ambiance",
|
||||
// extraKeys: {"Ctrl-Q": "autocomplete"}, // 快捷键
|
||||
indentUnit: 4, //代码缩进为一个tab的距离
|
||||
indentUnit: 2, //代码缩进为一个tab的距离
|
||||
matchBrackets: true,
|
||||
autoRefresh: true,
|
||||
smartIndent: true//智能换行
|
||||
|
|
@ -42,7 +42,7 @@
|
|||
$("#save_status").html("保存中...");
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '<%= file_update_myshixun_game_path(@myshixun.id, @game.id, :path => @path) %>',
|
||||
url: '<%= file_update_myshixun_game_path(@game, :myshixun_id => @myshixun, :path => @path) %>',
|
||||
data:{ content: $('#challenge-answer-edit-small').val()},
|
||||
success: function(data){
|
||||
$("#save_status").html("已保存");
|
||||
|
|
@ -65,6 +65,7 @@
|
|||
editor_CodeMirror.setSize("auto","auto");
|
||||
editor_CodeMirror.refresh();
|
||||
var h = $("#games_repository_contents").height() - $("#top_repository").height() - 10;
|
||||
$(".CodeMirror-scroll").css("min-height", h);
|
||||
$("#file_entry_content").find(".CodeMirror-scroll").css("min-height", h);
|
||||
$("#file_entry_content").find(".CodeMirror-scroll").css("max-height", h);
|
||||
});
|
||||
</script>
|
||||
|
|
@ -46,7 +46,7 @@
|
|||
<div id="tab_con_3" class="undis tab-info" >
|
||||
<div class="fit -scroll">
|
||||
<div class="-layout-v -fit">
|
||||
<div class="-flex -scroll task-padding16" id="game_answer_show"></div>
|
||||
<div class="-flex -scroll task-padding-new" id="game_answer_show"></div>
|
||||
<div class="undis" id="hidden_game_answer"><%= @game_challenge.answer %></div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -113,7 +113,8 @@
|
|||
flowChart : true, // 默认不解析
|
||||
sequenceDiagram : true // 默认不解析
|
||||
});
|
||||
myCodeMirror.setSize('auto','auto');//设置版本库codemirror的高度
|
||||
myCodeMirror.setSize("auto", "auto");//设置版本库codemirror的高度
|
||||
$("#game_answer_show").find(".CodeMirror-scroll").css("margin-bottom", 0);
|
||||
$("#game_answer_show" ).children(".CodeMirror").css("line-height", 1.2);
|
||||
$("#game_answer_show").children().css("border", 0);
|
||||
// 设置图片最大宽度不能超出边框
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
</div>
|
||||
<% else %>
|
||||
<% unless @entries.blank? %>
|
||||
<%= render :partial => 'tree', :locals => { :extend => false}%>
|
||||
<%= render :partial => 'tree', :locals => { :extend => false} %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -19,6 +19,9 @@
|
|||
data: {user: user, text: $("#error_contents").val(), game_id: '<%= @game.id %>', shixun_name:'<%= @myshixun.name %>', shixun_author_id:'<%= @game_challenge.user_id %>', position:'<%= @game_challenge.position %>'},
|
||||
type: "POST",
|
||||
success: function (data) {
|
||||
var htmlvalue = "<%= j (render :partial => 'games/send_success_pop') %>";
|
||||
pop_box_new(htmlvalue,460,300);
|
||||
$("#error_contents").val("");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
<div style="width:460px;">
|
||||
<div class="task-popup-title clearfix">
|
||||
<h3 class="fl color-grey">发送成功</h3>
|
||||
<a href="javascript:void(0);" onclick="hideModal()"><i class="fa fa-times-circle font-18 link-color-grey fr"></i></a>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="sy_popup_con" style="width:380px;">
|
||||
<ul class="sy_popup_add" >
|
||||
<li class="center mb30" style="line-height:20px">
|
||||
已发送给导师和管理员
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -37,7 +37,8 @@
|
|||
control = 0;
|
||||
}
|
||||
var h = $("#games_repository_contents").height() - $("#top_repository").height() - 10;
|
||||
$(".CodeMirror-scroll").css("min-height", h);
|
||||
$("#file_entry_content").find(".CodeMirror-scroll").css("min-height", h);
|
||||
$("#file_entry_content").find(".CodeMirror-scroll").css("max-height", h);
|
||||
}
|
||||
// 测评的扩大与缩小
|
||||
function valuation_extend_and_zoom(){
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
</div>
|
||||
<ul class="fl innner-nav">
|
||||
<li><%= link_to "智能课堂", user_course_community_path(User.current), :class => "new-nav-a", :target => "_blank" %></li>
|
||||
<li><%= link_to "游戏实训", user_project_community_path(User.current), :class => "new-nav-a", :target => "_blank" %></li>
|
||||
<li><%= link_to "项目实训", shixuns_path, :class => "new-nav-a", :target => "_blank" %></li>
|
||||
<li><%= link_to "论坛", forums_path, :class =>"new-nav-a", :target => "_blank" %></li>
|
||||
<li><%= link_to "帮助中心", "#{Setting.protocol}://#{Setting.host_name}/forums/1/memos/1168", :class => "new-nav-a", :target=>"_blank" %></li>
|
||||
<div class="cl"></div>
|
||||
|
|
|
|||
|
|
@ -18,8 +18,6 @@
|
|||
</div>
|
||||
<!--<input type="text" placeholder="请输入关键词进行搜索" class="new-search fl ml15 mr10">-->
|
||||
<ul class="fl innner-nav">
|
||||
<li><%= link_to "智能课堂", user_course_community_path(User.current), :class => "new-nav-a", :target => "_blank" %></li>
|
||||
<li><%= link_to "游戏实训", user_project_community_path(User.current), :class => "new-nav-a", :target => "_blank" %></li>
|
||||
<li><%= link_to "论坛", forums_path, :class =>"new-nav-a", :target => "_blank" %></li>
|
||||
<li><%= link_to "帮助中心", "#{Setting.protocol}://#{Setting.host_name}/forums/1/memos/1168", :class => "new-nav-a", :target=>"_blank" %></li>
|
||||
<div class="cl"></div>
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
</li>
|
||||
<li class="mb5 ml63">
|
||||
<label class="fl"> 语言 :</label>
|
||||
<%= select_tag :language, options_for_select(["Java","C","C++","Python","Ruby"], "Java"), :id => 'shixun[language]', :class => "ml5", :style => "height: 28px;" %>
|
||||
<%= select_tag :language, options_for_select(["Java","C","C++","Python","Ruby","Mysql-Java"], "Java"), :id => 'shixun[language]', :class => "ml5", :style => "height: 28px;" %>
|
||||
</li>
|
||||
<li class="mb5 ml70">
|
||||
<label > 公开 :</label>
|
||||
|
|
|
|||
|
|
@ -4,10 +4,14 @@
|
|||
<a href="javascript:void(0);" onclick="hideModal()"><i class="fa fa-times-circle font-18 link-color-grey fr"></i></a>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="sy_popup_con" style="width:380px;">
|
||||
<div class="sy_popup_con" style="width:360px;">
|
||||
<ul class="sy_popup_add" >
|
||||
<li class="center mb30" style="line-height:20px">
|
||||
服务器异常,请联系系统管理员
|
||||
<% if result %>
|
||||
发布成功
|
||||
<% else %>
|
||||
服务器异常,请联系系统管理员
|
||||
<% end %>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
</li>
|
||||
<li class="clearfix">
|
||||
<label class="panel-form-label fl">语言:</label>
|
||||
<%= select_tag :language, options_for_select(["Java","C","C++","Python","Ruby"], @shixun.language), :id => 'shixun[language]', :style => "height:40px;" %>
|
||||
<%= select_tag :language, options_for_select(["Java","C","C++","Python","Ruby","Mysql-Java"], @shixun.language), :id => 'shixun[language]', :style => "height:40px;" %>
|
||||
</li>
|
||||
<li class="clearfix">
|
||||
<label class="panel-form-label fl">公开:</label>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,36 @@
|
|||
<% @shixuns.each do |shixun| %>
|
||||
<div class="task-index-list-box fl ">
|
||||
<div class="task-mg8 task-mg8-hover">
|
||||
<div class="task-index-list-box-top">
|
||||
<span class="color-orange"><%= shixun.authentication ? "已审核" : "未审核" %></span>
|
||||
<h3 class="task-index-list-title task-hide"><%= shixun.name %></h3>
|
||||
<div class=" clearfix task-index-list-user">
|
||||
<%= link_to image_tag(url_to_avatar(shixun.owner), :width =>"60", :height => "60", :class => "panel-warp-img mr10 fl", :alt=>"头像"), user_path(shixun.owner)%>
|
||||
<%= link_to shixun.owner.try(:show_name), user_path(shixun.owner), :class => "task-index-name task-hide fl" %>
|
||||
</div>
|
||||
<a href="<%= shixun_path(shixun) %>">
|
||||
<div class="task-index-list-hover">
|
||||
<p><%= shixun.description %></p>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<ul class="task-index-list-box-bottom clearfix">
|
||||
<li><i class="fa fa-gamepad mr5 color-light-green" title="实训任务"></i><span><%= shixun.challenges.count %></span></li>
|
||||
<!--<li><i class="fa fa-comments-o mr5 color-light-green"></i><span>1255</span></li>-->
|
||||
<li><i class="fa fa-users mr5 color-light-green"></i><span><%= shixun.myshixuns.count %></span></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
<!--<div class="panel-pages mt20 ">-->
|
||||
<!--<a href="javascript:void(0);" class="pages-big">上一页</a>-->
|
||||
<!--<a href="javascript:void(0);" class="active ">1</a>-->
|
||||
<!--<a href="javascript:void(0);">2</a>-->
|
||||
<!--<a href="javascript:void(0);">3</a>-->
|
||||
<!--<a href="javascript:void(0);">...</a>-->
|
||||
<!--<a href="javascript:void(0);">31</a>-->
|
||||
<!--<a href="javascript:void(0);" class="pages-big">下一页</a>-->
|
||||
<!--<div class="cl"></div>-->
|
||||
</div>
|
||||
|
|
@ -8,14 +8,14 @@
|
|||
<% if allow_shixun_exec(@shixun) %>
|
||||
<% if User.current.id == @shixun.user_id %>
|
||||
<% if @shixun.status == 1 %>
|
||||
<a class="fr task-btn task-btn-orange">已发布</a>
|
||||
<%= link_to "重新发布", publish_shixun_path(@shixun, :type => "retry"), :class => "fr task-btn task-btn-orange font-14", :id => "challenge_begin", :remote => true %>
|
||||
<% else %>
|
||||
<%= link_to "发布实训", publish_shixun_path(@shixun), :class => "fr task-btn task-btn-orange", :id => "challenge_begin", :remote => true %>
|
||||
<%= link_to "发布实训", publish_shixun_path(@shixun), :class => "fr task-btn task-btn-orange font-14", :id => "challenge_begin", :remote => true %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% if @shixun.status == 1 %>
|
||||
<div id="bengin_challenge_task">
|
||||
<%= link_to "开始挑战", shixun_exec_shixun_path(@shixun), :class => "fr task-btn task-btn-orange", :id => "challenge_begin" %>
|
||||
<%= link_to "开始挑战", shixun_exec_shixun_path(@shixun), :class => "fr task-btn task-btn-orange font-14", :id => "challenge_begin", :onclick =>"$('#ajax-indicator').css('opacity','0.8').text('正在加载实训项目,请稍等……').show();" %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
|
|
|||
|
|
@ -1,42 +1,33 @@
|
|||
<div class="task-index " >
|
||||
<div class="task-index-head mt20 mb20">
|
||||
<div class="task-index-head-top">
|
||||
<h2 class="fl task-inde-head-title">游戏实训</h2>
|
||||
<%= link_to "创建", new_shixun_path, :class => "task-btn task-btn-green fr" %>
|
||||
<div class="cl"></div>
|
||||
<div class="task-index" >
|
||||
<div class="task-index-head mt20 mb20">
|
||||
<div class="task-index-head-top">
|
||||
<h2 class="fl task-inde-head-title">游戏实训</h2>
|
||||
<%= link_to "创建", new_shixun_path, :class => "task-btn task-btn-green fr" %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<ul class="task-index-head-info clearfix">
|
||||
<li><span class="color-orange font-bd"><%= @shixuns_count %></span><br/><span >全部实训</span></li>
|
||||
<li><span class="color-orange font-bd"><%= @current_user_had_passed %></span><br/><span>你已通过</span></li>
|
||||
<li><span class="color-orange font-bd"><%= @shixun_my_score %></span><br/><span>取得成绩</span></li>
|
||||
</ul>
|
||||
</div>
|
||||
<ul class="task-index-head-info clearfix">
|
||||
<li><span class="color-orange font-bd"><%= @shixuns_count %></span><br/><span >全部实训</span></li>
|
||||
<li><span class="color-orange font-bd">3</span><br/><span>你已通过</span></li>
|
||||
<li><span class="color-orange font-bd">280</span><br/><span>取得成绩</span></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="task-index-select mb20 clearfix">
|
||||
<li class="dropdown fl ml15 mr5 task-dropdown">
|
||||
<select class="fl header-search-select">
|
||||
<option>所有状态</option>
|
||||
<option>已 审 核</option>
|
||||
<option>审 核 中</option>
|
||||
</select>
|
||||
<!--<dropdown class="fl">-->
|
||||
<!--<input id="toggle3" type="checkbox">-->
|
||||
<!--<label for="toggle3" class="animate">所有状态<i class="fa fa-sort-down fr mt3"></i></label>-->
|
||||
<!--<ul class="animate">-->
|
||||
<!--<li class="animate">所有状态</li>-->
|
||||
<!--<li class="animate">已 审 核</li>-->
|
||||
<!--<li class="animate">审 核 中</li>-->
|
||||
<!--</ul>-->
|
||||
<!--</dropdown>-->
|
||||
|
||||
</li>
|
||||
<li class="dropdown fl ml15 mr5">
|
||||
<select class="fl header-search-select">
|
||||
<option>所有进展</option>
|
||||
<option>我已创建</option>
|
||||
<option>我未开启挑战</option>
|
||||
<option>我还未通关</option>
|
||||
<option>我已通关</option>
|
||||
</select>
|
||||
<div class="task-index-select mb20 clearfix">
|
||||
<!--<li class="dropdown fl ml15 mr5 task-dropdown">-->
|
||||
<!--<select class="fl header-search-select">-->
|
||||
<!--<option>所有状态</option>-->
|
||||
<!--<option>已 审 核</option>-->
|
||||
<!--<option>审 核 中</option>-->
|
||||
<!--</select>-->
|
||||
<!--<!–<dropdown class="fl">–>-->
|
||||
<!--<!–<input id="toggle3" type="checkbox">–>-->
|
||||
<!--<!–<label for="toggle3" class="animate">所有状态<i class="fa fa-sort-down fr mt3"></i></label>–>-->
|
||||
<!--<!–<ul class="animate">–>-->
|
||||
<!--<!–<li class="animate">所有状态</li>–>-->
|
||||
<!--<!–<li class="animate">已 审 核</li>–>-->
|
||||
<!--<!–<li class="animate">审 核 中</li>–>-->
|
||||
<!--<!–</ul>–>-->
|
||||
<!--<!–</dropdown>–>-->
|
||||
<%#= %>
|
||||
<!--<dropdown class="fl">
|
||||
<input id="toggle4" type="checkbox">
|
||||
<label for="toggle4" class="animate">所有进展<i class="fa fa-sort-down fr mt3"></i></label>
|
||||
|
|
@ -44,102 +35,101 @@
|
|||
<li class="animate">所有进展</li>
|
||||
<li class="animate">我已创建</li>
|
||||
<li class="animate">未开启挑战</li>
|
||||
<li class="animate">我还未通关</li>
|
||||
<!-- <li class="animate">我还未通关</li>
|
||||
<li class="animate">我已通关</li>
|
||||
</ul>
|
||||
</dropdown>-->
|
||||
</li>
|
||||
<form onsubmit="submitFn(this, event);" class="fl ml15">
|
||||
<div class="search-wrapper">
|
||||
<div class="input-holder">
|
||||
<input type="text" class="search-input" placeholder="搜索" />
|
||||
<button class="search-icon" onclick="searchToggle(this, event);"><i class="fa fa-search font-16 mt5"></i></button>
|
||||
</div>
|
||||
<span class="close" onclick="searchToggle(this, event);"><i class="fa fa-times font-16 mt5"></i></span>
|
||||
</div>
|
||||
</form>
|
||||
<p class=" color-grey fr">
|
||||
<div class="postSort fr" id="shixun_time">
|
||||
<a href="javascript:void(0);" class="linkGrey2 fl">时间排序</a>
|
||||
<a href="javascript:void(0);" id="time_reorder" class="fl"></a>
|
||||
</div>
|
||||
<div class="postSort fr" id="shixun_hot">
|
||||
<a href="javascript:void(0);" class="linkGrey2 fl">热度排序</a>
|
||||
<a href="javascript:void(0);" id="hot_reorder" class="sortArrowActiveD fl"></a>
|
||||
</div>
|
||||
<!--
|
||||
<a href="#" class="link-color-grey fr mr15">热度排序 </a>
|
||||
<span class=" mr5 ml5 fr">|</span>
|
||||
<a href="#" class="link-color-green fr">时间排序</a>-->
|
||||
<span class="fr">排序方式:</span>
|
||||
<span class="fr mr30">共 <span class="color-light-green">102</span> 个搜索结果</span>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="task-index-list clearfix mb20">
|
||||
<% @shixuns.each do |shixun| %>
|
||||
<div class="task-index-list-box fl ">
|
||||
<div class="task-mg8 task-mg8-hover">
|
||||
<div class="task-index-list-box-top">
|
||||
<span class="color-orange">未审核</span>
|
||||
<h3 class="task-index-list-title task-hide"><%= shixun.name %></h3>
|
||||
<div class=" clearfix task-index-list-user">
|
||||
<%= link_to image_tag(url_to_avatar(shixun.owner), :width =>"60", :height => "60", :class => "panel-warp-img mr10 fl", :alt=>"头像"),user_path(shixun.owner)%>
|
||||
<%= link_to shixun.owner.try(:show_name), user_path(shixun.owner), :class => "task-index-name task-hide fl" %>
|
||||
</div>
|
||||
<div class="task-index-list-hover">
|
||||
<p><%= shixun.description %></p>
|
||||
</dropdown>–>
|
||||
</li>-->
|
||||
<!-- <form onsubmit="submitFn(this, event);" class="fl ml15">
|
||||
<div class="search-wrapper">
|
||||
<div class="input-holder">
|
||||
<input type="text" class="search-input" placeholder="搜索" />
|
||||
<button class="search-icon" onclick="searchToggle(this, event);"><i class="fa fa-search font-16 mt5"></i></button>
|
||||
</div>
|
||||
<span class="close" onclick="searchToggle(this, event);"><i class="fa fa-times font-16 mt5"></i></span>
|
||||
</div>
|
||||
<ul class="task-index-list-box-bottom clearfix">
|
||||
<li><i class="fa fa-gamepad mr5 color-light-green" title="实训任务"></i><span><%= shixun.challenges.count %></span></li>
|
||||
<!--<li><i class="fa fa-comments-o mr5 color-light-green"></i><span>1255</span></li>-->
|
||||
<li><i class="fa fa-users mr5 color-light-green"></i><span><%= shixun.myshixuns.count %></span></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
<div class="panel-pages mt20 ">
|
||||
<a href="javascript:void(0);" class="pages-big">上一页</a>
|
||||
<a href="javascript:void(0);" class="active ">1</a>
|
||||
<a href="javascript:void(0);">2</a>
|
||||
<a href="javascript:void(0);">3</a>
|
||||
<a href="javascript:void(0);">...</a>
|
||||
<a href="javascript:void(0);">31</a>
|
||||
<a href="javascript:void(0);" class="pages-big">下一页</a>
|
||||
<div class="cl"></div>
|
||||
</form>-->
|
||||
<p class="color-grey fr">
|
||||
<div class="postSort fr" id="shixun_hot">
|
||||
<a href="javascript:void(0);" class="linkGrey2 fl">热度排序</a>
|
||||
<a href="javascript:void(0);" id="hot_reorder" class="fl"></a>
|
||||
</div>
|
||||
<div class="postSort fr" id="shixun_time">
|
||||
<a href="javascript:void(0);" class="linkGrey2 fl">时间排序</a>
|
||||
<a href="javascript:void(0);" id="time_reorder" class="sortArrowActiveD fl"></a>
|
||||
</div>
|
||||
<span class="fr">排序方式:</span>
|
||||
<!--<span class="fr mr30">共 <span class="color-light-green">102</span> 个搜索结果</span>-->
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="task-index-list clearfix mb20" id="shixun_list_content">
|
||||
<%= render "shixun_list" %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(function(){
|
||||
var nTime = $("#time_reorder");
|
||||
var nHot = $("#hot_reorder");
|
||||
$("#shixun_time").click(function(){
|
||||
nHot.removeClass("sortArrowActiveD sortArrowActiveU");
|
||||
if(nTime.hasClass("sortArrowActiveD")){
|
||||
nTime.removeClass("sortArrowActiveD");
|
||||
nTime.addClass("sortArrowActiveU");
|
||||
}else if(nTime.hasClass("sortArrowActiveU")){
|
||||
nTime.removeClass("sortArrowActiveU");
|
||||
nTime.addClass("sortArrowActiveD");
|
||||
}else{
|
||||
nTime.addClass("sortArrowActiveD");
|
||||
}
|
||||
});
|
||||
$("#shixun_hot").click(function(){
|
||||
nTime.removeClass("sortArrowActiveD sortArrowActiveU");
|
||||
if(nHot.hasClass("sortArrowActiveD")){
|
||||
nHot.removeClass("sortArrowActiveD");
|
||||
nHot.addClass("sortArrowActiveU");
|
||||
}else if(nHot.hasClass("sortArrowActiveU")){
|
||||
nHot.removeClass("sortArrowActiveU");
|
||||
nHot.addClass("sortArrowActiveD");
|
||||
}else{
|
||||
nHot.addClass("sortArrowActiveD");
|
||||
}
|
||||
});
|
||||
});
|
||||
$(function(){
|
||||
var nTime = $("#time_reorder");
|
||||
var nHot = $("#hot_reorder");
|
||||
$("#shixun_time").click(function(){
|
||||
nHot.removeClass("sortArrowActiveD sortArrowActiveU");
|
||||
if(nTime.hasClass("sortArrowActiveD")){
|
||||
$.ajax({
|
||||
url: '<%= search_shixuns_path() %>' + '.js',
|
||||
data: { time_reorder: 'asc' },
|
||||
success: function(){
|
||||
nTime.removeClass("sortArrowActiveD");
|
||||
nTime.addClass("sortArrowActiveU");
|
||||
}
|
||||
})
|
||||
}else if(nTime.hasClass("sortArrowActiveU")){
|
||||
$.ajax({
|
||||
url: '<%= search_shixuns_path() %>' + '.js',
|
||||
data: { time_reorder: 'desc'},
|
||||
success: function(){
|
||||
nTime.removeClass("sortArrowActiveU");
|
||||
nTime.addClass("sortArrowActiveD");
|
||||
}
|
||||
})
|
||||
}else{
|
||||
$.ajax({
|
||||
url: '<%= search_shixuns_path() %>' + '.js',
|
||||
data: { time_reorder: 'desc'},
|
||||
success: function(){
|
||||
nTime.addClass("sortArrowActiveD");
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
$("#shixun_hot").click(function(){
|
||||
nTime.removeClass("sortArrowActiveD sortArrowActiveU");
|
||||
if(nHot.hasClass("sortArrowActiveD")){
|
||||
$.ajax({
|
||||
url: '<%= search_shixuns_path() %>' + '.js',
|
||||
data: { hot_reorder: 'asc'},
|
||||
success: function(){
|
||||
nHot.removeClass("sortArrowActiveD");
|
||||
nHot.addClass("sortArrowActiveU");
|
||||
}
|
||||
})
|
||||
}else if(nHot.hasClass("sortArrowActiveU")){
|
||||
$.ajax({
|
||||
url: '<%= search_shixuns_path() %>' + '.js',
|
||||
data: { hot_reorder: 'desc'},
|
||||
success: function(){
|
||||
nHot.removeClass("sortArrowActiveU");
|
||||
nHot.addClass("sortArrowActiveD");
|
||||
}
|
||||
})
|
||||
}else{
|
||||
$.ajax({
|
||||
url: '<%= search_shixuns_path() %>' + '.js',
|
||||
data: { hot_reorder: 'desc'},
|
||||
success: function(){
|
||||
nHot.addClass("sortArrowActiveD");
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
|
@ -2,5 +2,7 @@
|
|||
var htmlvalue = "<%= escape_javascript(render :partial => 'shixuns/monitor_tip') %>";
|
||||
pop_box_new(htmlvalue,460,406);
|
||||
<% else %>
|
||||
var htmlvalue = "<%= escape_javascript(render :partial => 'shixuns/monitor_tip', :locals => {:result => true}) %>";
|
||||
pop_box_new(htmlvalue,460,406);
|
||||
$("#shixun_top").html('<%= escape_javascript(render :partial => 'shixuns/shixun_top') %>');
|
||||
<% end %>
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
$("#shixun_list_content").html('<%= escape_javascript( render :partial => 'shixuns/shixun_list') %>');
|
||||
|
|
@ -44,6 +44,7 @@ RedmineApp::Application.routes.draw do
|
|||
match 'publish', :via => [:get, :post]
|
||||
end
|
||||
collection do
|
||||
get 'search'
|
||||
end
|
||||
|
||||
resources :challenges do
|
||||
|
|
@ -69,7 +70,7 @@ RedmineApp::Application.routes.draw do
|
|||
collection do
|
||||
match 'training_task_status', :via => [:get, :post]
|
||||
end
|
||||
resources :games do
|
||||
resources :games, :path => "stages" do
|
||||
member do
|
||||
match 'game_build', :via => [:get, :post]
|
||||
match 'next_step', :via => [:get, :post]
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
class AddIdentifierToShixun < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :shixuns, :identifier, :string
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
class SyncIdentifierToShixun < ActiveRecord::Migration
|
||||
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)
|
||||
def up
|
||||
@shixuns = Shixun.all
|
||||
@shixuns.each do |shixun|
|
||||
code = CODES.sample(8).join
|
||||
code = CODES.sample(8).join if Shixun.where(identifier: code).present?
|
||||
shixun.update_attribute(:identifier, code)
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
class AddIdentifierToMyshixun < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :myshixuns, :identifier, :string
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
class AddShixunCountToShixuns < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :shixuns, :shixun_count, :integer, default: 0
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
class AddIdentifierToGames < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :games, :identifier, :string
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
class SyncGameIdentifier < ActiveRecord::Migration
|
||||
CODES = %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 up
|
||||
games = Game.all
|
||||
games.each do |game|
|
||||
code = CODES.sample(12).join
|
||||
code = CODES.sample(12).join if Game.where(identifier: code).present?
|
||||
game.update_attribute(:identifier, code)
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
class SyncIdentifierToMyshixun < ActiveRecord::Migration
|
||||
CODES = %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 up
|
||||
myshixuns = Myshixun.all
|
||||
myshixuns.each do |myshixun|
|
||||
code = CODES.sample(10).join
|
||||
code = CODES.sample(10).join if Myshixun.where(identifier: code).present?
|
||||
myshixun.update_attribute(:identifier, code)
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
class RenameShixunCount < ActiveRecord::Migration
|
||||
def up
|
||||
rename_column :shixuns, :shixun_count, :myshixun_count
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
class SyncMyshixunCount < ActiveRecord::Migration
|
||||
def up
|
||||
shixuns = Shixun.all
|
||||
shixuns.each do |shixun|
|
||||
myshixun_count = shixun.myshixuns.count
|
||||
shixun.update_attribute(:myshixun_count, myshixun_count)
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
class AddExecPathToChallenges < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :challenges, :exec_path, :string
|
||||
end
|
||||
end
|
||||
|
|
@ -129,4 +129,27 @@ a:hover.task-btn-ver{background:#5f7cab;}
|
|||
.break_word_firefox{white-space: pre-wrap !important;word-break: break-all;}
|
||||
|
||||
.pr {position:relative;}
|
||||
/***** Ajax indicator ******/
|
||||
#ajax-indicator {
|
||||
position: absolute; /* fixed not supported by IE */
|
||||
background-color:#eee;
|
||||
border: 1px solid #bbb;
|
||||
top:35%;
|
||||
left:40%;
|
||||
width:20%;
|
||||
font-weight:bold;
|
||||
text-align:center;
|
||||
padding:0.6em;
|
||||
z-index:100;
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
html>body #ajax-indicator { position: fixed; }
|
||||
|
||||
#ajax-indicator span {
|
||||
background-position: 0% 40%;
|
||||
background-repeat: no-repeat;
|
||||
background-image: url(/images/loading.gif);
|
||||
padding-left: 26px;
|
||||
vertical-align: bottom;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -185,6 +185,7 @@ input.knowledge_frame{height:30px;line-height:30px;border:none;background:#f3f5f
|
|||
.greytab-inner{ background:#fff; }
|
||||
.blacktab-inner{ background:#333;}
|
||||
.task-padding16{ padding:16px;}
|
||||
.task-padding-new{ padding-top: 16px}
|
||||
/* TPM统计 20170321byLB */
|
||||
.panel-warp-3{ width: 30%; background:#23b181; color:#fff; margin:2.5%; margin-right:0; position: relative; }
|
||||
.panel-warp-3-over{ background:#fff;opacity:0.8; color:#29bd8b; width: 100%; height:135px; position: absolute; top:0; left:0; text-align: center; padding-top:130px;}
|
||||
|
|
|
|||
Loading…
Reference in New Issue