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.
29 lines
705 B
29 lines
705 B
class Competitions::CompetitionModulesController < Competitions::BaseController
|
|
skip_before_action :require_login, only: [:index, :show]
|
|
|
|
before_action :require_business, only: [:update]
|
|
|
|
def index
|
|
@modules = current_competition.unhidden_competition_modules.order(position: :asc)
|
|
end
|
|
|
|
def show
|
|
@module = current_module
|
|
end
|
|
|
|
def update
|
|
md = current_module.competition_module_md_content || current_module.build_competition_module_md_content
|
|
md.name = params[:md_name]
|
|
md.content = params[:md_content]
|
|
md.save!
|
|
|
|
render_ok
|
|
end
|
|
|
|
private
|
|
|
|
def current_module
|
|
@_current_module ||= current_competition.unhidden_competition_modules.find(params[:id])
|
|
end
|
|
end
|