29 lines
984 B
Ruby
29 lines
984 B
Ruby
# encoding: utf-8
|
|
module ChallengesHelper
|
|
|
|
def difficulty_type difficulty
|
|
case difficulty
|
|
when 1
|
|
"简单"
|
|
when 2
|
|
"中等"
|
|
when 3
|
|
"复杂"
|
|
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 title='待完成'><i class='fa fa-play-circle color-light-green fr font-18 mt5 -text-danger w20_center'></i></a>".html_safe
|
|
when 1
|
|
"<a title='评测中'><i class='fa fa-unlock-alt fr font-18 mt5 -text-danger w20_center'></i></a>".html_safe
|
|
when 2
|
|
"已完成 <a title='已解决'><i class='fa fa-check-circle fr font-18 mt5 color-light-green w20_center' ></i></a>".html_safe
|
|
when 3,nil
|
|
"未解锁 <a title='未解锁'><i class='fa fa-play-circle fr font-18 mt5 color-grey w20_center' ></i></a>".html_safe
|
|
end
|
|
end
|
|
end
|