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.
|
|
|
class CompetitionModule < ApplicationRecord
|
|
|
|
default_scope { order('position ASC') }
|
|
|
|
|
|
|
|
belongs_to :competition
|
|
|
|
|
|
|
|
has_one :competition_module_md_content, dependent: :destroy
|
|
|
|
|
|
|
|
def module_url
|
|
|
|
case module_type
|
|
|
|
when "home"
|
|
|
|
"/competitions/#{competition.identifier}"
|
|
|
|
when "inform"
|
|
|
|
"/competitions/#{competition.identifier}/informs?status=1"
|
|
|
|
when "manual"
|
|
|
|
"/competitions/#{competition.identifier}/informs?status=2"
|
|
|
|
when "chart"
|
|
|
|
"/competitions/#{competition.identifier}/charts"
|
|
|
|
when "enroll"
|
|
|
|
"/competitions/#{competition.identifier}/competition_teams"
|
|
|
|
else
|
|
|
|
url || "/competitions/#{competition.identifier}/md_content?md_content_id=#{competition_module_md_content&.id}"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|