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.
25 lines
772 B
25 lines
772 B
class CompetitionModule < ApplicationRecord
|
|
default_scope { order('position ASC') }
|
|
|
|
belongs_to :competition
|
|
|
|
has_one :competition_module_md_content, dependent: :destroy
|
|
|
|
def module_url
|
|
case name
|
|
when "首页", "赛制介绍"
|
|
"/competitions/#{competition.identifier}"
|
|
when "通知公告"
|
|
"/competitions/#{competition.identifier}/informs?status=1"
|
|
when "参赛手册"
|
|
"/competitions/#{competition.identifier}/informs?status=2"
|
|
when "排行榜"
|
|
"/competitions/#{competition.identifier}/charts"
|
|
when "报名"
|
|
"/competitions/#{competition.identifier}/competition_teams"
|
|
else
|
|
url || "/competitions/#{competition.identifier}/md_content?md_content_id=#{competition_module_md_content&.id}"
|
|
end
|
|
end
|
|
end
|