Merge settings & core indexes into a single nav
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
class ContestsController < ApplicationController
|
||||
include CompletionsConcern
|
||||
|
||||
before_action :set_contest, only: %i[ destroy edit show update ]
|
||||
before_action :set_contest, only: %i[ destroy show update ]
|
||||
before_action :set_settings_contest, only: %i[ settings_general_edit settings_general_update settings_offline_edit settings_offline_update settings_categories_edit ]
|
||||
before_action :offline_setup, only: %i[ offline_new offline_create offline_edit offline_update offline_completed ]
|
||||
skip_before_action :require_authentication, only: %i[ scoreboard offline_new offline_create offline_edit offline_update offline_completed ]
|
||||
@@ -19,35 +19,16 @@ class ContestsController < ApplicationController
|
||||
redirect_to contest_contestants_path(@contest)
|
||||
end
|
||||
|
||||
def edit
|
||||
authorize @contest
|
||||
|
||||
@action_name = t("helpers.buttons.back")
|
||||
@action_path = contest_path(@contest)
|
||||
end
|
||||
|
||||
def settings_general_edit
|
||||
authorize @contest
|
||||
|
||||
@action_name = t("helpers.buttons.back")
|
||||
@action_path = contest_path(@contest)
|
||||
@title = t("contests.edit.title")
|
||||
end
|
||||
|
||||
def settings_offline_edit
|
||||
authorize @contest
|
||||
|
||||
@action_name = t("helpers.buttons.back")
|
||||
@action_path = contest_path(@contest)
|
||||
@title = t("contests.edit.title")
|
||||
end
|
||||
|
||||
def settings_categories_edit
|
||||
authorize @contest
|
||||
|
||||
@action_name = t("helpers.buttons.back")
|
||||
@action_path = contest_path(@contest)
|
||||
@title = t("contests.edit.title")
|
||||
end
|
||||
|
||||
def settings_general_update
|
||||
@@ -56,9 +37,6 @@ class ContestsController < ApplicationController
|
||||
if @contest.update(settings_general_params)
|
||||
redirect_to "/contests/#{@contest.id}/settings/general", notice: t("contests.edit.notice")
|
||||
else
|
||||
@action_name = t("helpers.buttons.back")
|
||||
@action_path = contest_path(@contest)
|
||||
@title = t("contests.edit.title")
|
||||
render :settings_general_edit, status: :unprocessable_entity
|
||||
end
|
||||
end
|
||||
@@ -69,9 +47,6 @@ class ContestsController < ApplicationController
|
||||
if @contest.update(settings_offline_params)
|
||||
redirect_to "/contests/#{@contest.id}/settings/offline", notice: t("contests.edit.notice")
|
||||
else
|
||||
@action_name = t("helpers.buttons.back")
|
||||
@action_path = contest_path(@contest)
|
||||
@title = t("contests.edit.title")
|
||||
render :settings_offline_edit, status: :unprocessable_entity
|
||||
end
|
||||
end
|
||||
@@ -100,8 +75,6 @@ class ContestsController < ApplicationController
|
||||
if @contest.update(contest_params)
|
||||
redirect_to @contest, notice: t("contests.edit.notice")
|
||||
else
|
||||
@action_name = t("helpers.buttons.back")
|
||||
@action_path = contest_path(@contest)
|
||||
render :edit, status: :unprocessable_entity
|
||||
end
|
||||
end
|
||||
@@ -135,9 +108,12 @@ class ContestsController < ApplicationController
|
||||
@contestants = @contestants.select { |contestant| !contestant.offline.present? }
|
||||
end
|
||||
@puzzles = @contest.puzzles.order(:id)
|
||||
@action_name = t("helpers.buttons.refresh")
|
||||
if params.key?(:category)
|
||||
if params.key?(:hide_offline) && params.key?(:category)
|
||||
@action_path = "/public/#{@contest.friendly_id}?hide_offline=#{params[:hide_offline]}&category=#{params[:category]}"
|
||||
elsif params.key?(:category)
|
||||
@action_path = "/public/#{@contest.friendly_id}?category=#{params[:category]}"
|
||||
elsif params.key?(:hide_offline)
|
||||
@action_path = "/public/#{@contest.friendly_id}?hide_offline=#{params[:hide_offline]}"
|
||||
else
|
||||
@action_path = "/public/#{@contest.friendly_id}"
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user