Add offline model and "new" form/controller
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
class ContestsController < ApplicationController
|
||||
before_action :set_contest, only: %i[ destroy edit show update ]
|
||||
skip_before_action :require_authentication, only: %i[ scoreboard ]
|
||||
skip_before_action :require_authentication, only: %i[ scoreboard offline_new ]
|
||||
|
||||
def index
|
||||
authorize :contest
|
||||
@@ -99,6 +99,21 @@ class ContestsController < ApplicationController
|
||||
render :scoreboard
|
||||
end
|
||||
|
||||
def offline_new
|
||||
@contest = Contest.find_by(slug: params[:id])
|
||||
unless @contest && @contest.public
|
||||
skip_authorization
|
||||
not_found and return
|
||||
end
|
||||
authorize :contest
|
||||
|
||||
I18n.locale = @contest.lang
|
||||
|
||||
@title = I18n.t("contests.scoreboard.title", name: @contest.name)
|
||||
|
||||
@offline = Offline.new
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_badges
|
||||
|
||||
Reference in New Issue
Block a user