mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-03 11:50:49 +08:00
init project
This commit is contained in:
3
app/views/challenges/_challenge.json.jbuilder
Normal file
3
app/views/challenges/_challenge.json.jbuilder
Normal file
@@ -0,0 +1,3 @@
|
||||
json.name challenge.subject
|
||||
json.position challenge.position
|
||||
json.tag_count challenge.challenge_tags_count
|
||||
19
app/views/challenges/_top_common_data.jbuilder
Normal file
19
app/views/challenges/_top_common_data.jbuilder
Normal file
@@ -0,0 +1,19 @@
|
||||
# 新建关卡
|
||||
json.choice_url new_shixun_challenge_path(shixun_identifier, st: 1) if @power == 0
|
||||
json.practice_url new_shixun_challenge_path(shixun_identifier, st: 0) if @power == 0
|
||||
json.go_back_url shixun_challenges_path
|
||||
if @prev_challenge
|
||||
json.prev_challenge do
|
||||
json.id @prev_challenge.id
|
||||
json.st @prev_challenge.st
|
||||
end
|
||||
end
|
||||
if @next_challenge
|
||||
json.next_challenge do
|
||||
json.id @next_challenge.id
|
||||
json.st @next_challenge.st
|
||||
end
|
||||
end
|
||||
json.position @position
|
||||
json.name @challenge.try(:subject)
|
||||
|
||||
3
app/views/challenges/answer.json.jbuilder
Normal file
3
app/views/challenges/answer.json.jbuilder
Normal file
@@ -0,0 +1,3 @@
|
||||
json.array! @answers do |answer|
|
||||
json.(answer, :id, :name, :contents, :level, :score)
|
||||
end
|
||||
3
app/views/challenges/create.json.jbuilder
Normal file
3
app/views/challenges/create.json.jbuilder
Normal file
@@ -0,0 +1,3 @@
|
||||
json.status 1
|
||||
json.messages "新建成功"
|
||||
json.challenge_id @challenge.id
|
||||
@@ -0,0 +1 @@
|
||||
json.challenge_choose_id @challenge_choose.id
|
||||
2
app/views/challenges/crud_answer.json.jbuilder
Normal file
2
app/views/challenges/crud_answer.json.jbuilder
Normal file
@@ -0,0 +1,2 @@
|
||||
json.status 1
|
||||
json.message "操作成功"
|
||||
2
app/views/challenges/destroy.json.jbuilder
Normal file
2
app/views/challenges/destroy.json.jbuilder
Normal file
@@ -0,0 +1,2 @@
|
||||
json.status 1
|
||||
json.message "删除成功!"
|
||||
@@ -0,0 +1,2 @@
|
||||
json.status @status
|
||||
json.challenge_id @challenge.id
|
||||
26
app/views/challenges/edit.json.jbuilder
Normal file
26
app/views/challenges/edit.json.jbuilder
Normal file
@@ -0,0 +1,26 @@
|
||||
json.partial! "challenges/top_common_data", shixun_identifier: @shixun.identifier
|
||||
json.chooses do
|
||||
json.array! @chooses do |choose|
|
||||
json.choose_id choose.id
|
||||
json.type choose.category
|
||||
end
|
||||
end
|
||||
json.st @challenge.st
|
||||
|
||||
if @tab == 0
|
||||
# 本关任务tab的编辑模式
|
||||
json.(@challenge, :id, :subject, :task_pass, :difficulty, :score, :exec_time, :st)
|
||||
json.tags @challenge.challenge_tags.map(&:name)
|
||||
elsif @tab == 1
|
||||
# 评测设置的编辑模式
|
||||
json.(@challenge, :id, :path, :exec_path, :show_type, :original_picture_path, :expect_picture_path, :picture_path,
|
||||
:web_route, :test_set_score, :test_set_average, :exec_time)
|
||||
json.has_web_route @shixun.has_web_route?
|
||||
json.test_sets @challenge.test_sets do |set|
|
||||
json.hidden (set.is_public ? 0 : 1)
|
||||
json.(set, :input, :output, :score, :match_rule)
|
||||
end
|
||||
elsif @tab == 2
|
||||
# 参考答案
|
||||
json.(@challenge, :answer)
|
||||
end
|
||||
11
app/views/challenges/edit_choose_question.json.jbuilder
Normal file
11
app/views/challenges/edit_choose_question.json.jbuilder
Normal file
@@ -0,0 +1,11 @@
|
||||
json.(@challenge_choose, :challenge_id, :subject, :answer,
|
||||
:standard_answer, :score, :difficult,
|
||||
:position, :category)
|
||||
json.st @challenge.st
|
||||
# 选项的参数
|
||||
json.choose_contents @challenge_choose.challenge_questions do |question|
|
||||
json.(question, :option_name, :position, :right_key)
|
||||
end
|
||||
|
||||
json.tags @challenge_choose.challenge_tags.map(&:name)
|
||||
|
||||
32
app/views/challenges/index.json.jbuilder
Normal file
32
app/views/challenges/index.json.jbuilder
Normal file
@@ -0,0 +1,32 @@
|
||||
# 公共接口,新建关卡任务
|
||||
# json.partial! 'challenges/new_link', shixun_identifier: @shixun.identifier
|
||||
json.description @shixun.description
|
||||
json.power @editable
|
||||
json.shixun_identifier @shixun.identifier
|
||||
json.shixun_status @shixun.status
|
||||
json.is_jupyter @shixun.is_jupyter?
|
||||
json.allow_skip @shixun.task_pass
|
||||
|
||||
|
||||
# 列表
|
||||
if @challenges.present?
|
||||
json.challenge_list @challenges do |challenge|
|
||||
json.challenge_id challenge.id
|
||||
json.position challenge.position
|
||||
json.st challenge.st
|
||||
json.name challenge.subject
|
||||
json.score challenge.score
|
||||
json.passed_count challenge.user_passed_count
|
||||
json.playing_count challenge.playing_count
|
||||
json.name_url shixun_challenge_path(challenge, shixun_identifier: @shixun.identifier)
|
||||
#json.open_game challenge.open_game(@user.id, @shixun)
|
||||
if @editable
|
||||
json.edit_url edit_shixun_challenge_path(challenge, shixun_identifier: @shixun.identifier)
|
||||
json.delete_url shixun_challenge_path(challenge, shixun_identifier: @shixun.identifier)
|
||||
json.up_url index_up_shixun_challenge_path(challenge, :shixun_identifier => @shixun.identifier) unless challenge.position < 2
|
||||
json.down_url index_down_shixun_challenge_path(challenge, :shixun_identifier => @shixun.identifier) if @shixun.challenges_count != challenge.position
|
||||
end
|
||||
#json.passed challenge.has_passed?(@user.id)
|
||||
json.status challenge.user_tpi_status @user.id
|
||||
end
|
||||
end
|
||||
2
app/views/challenges/index_down.json.jbuilder
Normal file
2
app/views/challenges/index_down.json.jbuilder
Normal file
@@ -0,0 +1,2 @@
|
||||
json.status 1
|
||||
json.message "下移成功"
|
||||
2
app/views/challenges/index_up.json.jbuilder
Normal file
2
app/views/challenges/index_up.json.jbuilder
Normal file
@@ -0,0 +1,2 @@
|
||||
json.status 1
|
||||
json.message "上移成功"
|
||||
13
app/views/challenges/new.json.jbuilder
Normal file
13
app/views/challenges/new.json.jbuilder
Normal file
@@ -0,0 +1,13 @@
|
||||
# 导航栏公共数据
|
||||
json.partial! "challenges/top_common_data", shixun_identifier: @shixun.identifier
|
||||
|
||||
# st: 0 实践任务, 1 选择题任务
|
||||
json.st @st
|
||||
|
||||
# 过关任务的默认值
|
||||
json.task_pass_default @task_pass_default
|
||||
|
||||
json.submit_url shixun_challenges_path(@shixun, :st => @st)
|
||||
|
||||
|
||||
|
||||
10
app/views/challenges/show.json.jbuilder
Normal file
10
app/views/challenges/show.json.jbuilder
Normal file
@@ -0,0 +1,10 @@
|
||||
# 导航栏公共数据
|
||||
json.partial! "challenges/top_common_data", shixun_identifier: @shixun.identifier
|
||||
json.(@challenge, :id, :subject, :task_pass, :difficulty, :score, :exec_time, :st)
|
||||
json.tags @challenge.challenge_tags.map(&:name)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
3
app/views/challenges/show_choose_question.json.jbuilder
Normal file
3
app/views/challenges/show_choose_question.json.jbuilder
Normal file
@@ -0,0 +1,3 @@
|
||||
json.(@challenge_choose, :challenge_id, :subject, :answer,
|
||||
:standard_answer, :score, :difficult,
|
||||
:position, :category)
|
||||
3
app/views/challenges/update.json.jbuilder
Normal file
3
app/views/challenges/update.json.jbuilder
Normal file
@@ -0,0 +1,3 @@
|
||||
json.status 1
|
||||
json.messages "更新成功!"
|
||||
json.challenge_id @challenge.id
|
||||
@@ -0,0 +1 @@
|
||||
json.challenge_choose_id @challenge_choose.try(:id)
|
||||
Reference in New Issue
Block a user