You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.3 KiB
44 lines
1.3 KiB
# encoding: utf-8
|
|
module ChallengesHelper
|
|
|
|
def difficulty_type difficulty
|
|
case difficulty
|
|
when 1
|
|
"简单"
|
|
when 2
|
|
"中等"
|
|
when 3
|
|
"复杂"
|
|
end
|
|
end
|
|
|
|
def show_challenge_file_type type
|
|
case type
|
|
when 1
|
|
"图片"
|
|
when 2
|
|
"apk/exe"
|
|
when 3
|
|
"txt"
|
|
when 4
|
|
"html"
|
|
when -1
|
|
"无"
|
|
end
|
|
end
|
|
|
|
def find_game_status challenge_id
|
|
game = Game.where(:challenge_id => challenge_id, :user_id => User.current.id).first
|
|
case game.try(:status)
|
|
when 0
|
|
"待完成 <a href='javascript:void(0);'><i data-tip-down='点击开始' class='fa fa-play-circle color-light-green fr font-24 -text-danger w20_center'></i></a>".html_safe
|
|
when 1
|
|
"<i data-tip-down='评测中' class='fa fa-unlock-alt fr font-20 mt5 -text-danger w20_center'></i></a>".html_safe
|
|
when 2
|
|
"已完成 <a href='javascript:void(0);'><i data-tip-down='已解决' class='fa fa-check-circle fr font-24 color-light-green w20_center' ></i></a>".html_safe
|
|
when 3,nil
|
|
"未开始 <a><i data-tip-down='请先完成前序关卡。无法点击' class='fa fa-play-circle fr font-24 color-grey w20_center' ></i></a>".html_safe
|
|
end
|
|
end
|
|
end
|