Back buttons
This commit is contained in:
parent
67d2ef41b3
commit
b8674a126f
@ -2,16 +2,27 @@ class CompletionsController < ApplicationController
|
|||||||
include CompletionsConcern
|
include CompletionsConcern
|
||||||
|
|
||||||
before_action :set_contest
|
before_action :set_contest
|
||||||
|
before_action :set_contestant
|
||||||
before_action :set_data, only: %i[ create edit new update ]
|
before_action :set_data, only: %i[ create edit new update ]
|
||||||
before_action :set_completion, only: %i[ destroy edit update ]
|
before_action :set_completion, only: %i[ destroy edit update ]
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
authorize @contest
|
authorize @contest
|
||||||
|
|
||||||
|
if @contestant
|
||||||
|
@action_name = t("helpers.buttons.back_to_contestant")
|
||||||
|
@action_path = edit_contest_contestant_path(@contest, @contestant)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
authorize @contest
|
authorize @contest
|
||||||
|
|
||||||
|
if @contestant
|
||||||
|
@action_name = t("helpers.buttons.back_to_contestant")
|
||||||
|
@action_path = edit_contest_contestant_path(@contest, @contestant)
|
||||||
|
end
|
||||||
|
|
||||||
@completion = Completion.new
|
@completion = Completion.new
|
||||||
if params[:contestant_id]
|
if params[:contestant_id]
|
||||||
@completion.contestant_id = params[:contestant_id]
|
@completion.contestant_id = params[:contestant_id]
|
||||||
@ -27,6 +38,10 @@ class CompletionsController < ApplicationController
|
|||||||
extend_completions!(@completion.contestant)
|
extend_completions!(@completion.contestant)
|
||||||
redirect_to contest_path(@contest)
|
redirect_to contest_path(@contest)
|
||||||
else
|
else
|
||||||
|
if @contestant
|
||||||
|
@action_name = t("helpers.buttons.back_to_contestant")
|
||||||
|
@action_path = edit_contest_contestant_path(@contest, @contestant)
|
||||||
|
end
|
||||||
render :new, status: :unprocessable_entity
|
render :new, status: :unprocessable_entity
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -39,6 +54,10 @@ class CompletionsController < ApplicationController
|
|||||||
extend_completions!(@completion.contestant)
|
extend_completions!(@completion.contestant)
|
||||||
redirect_to @contest
|
redirect_to @contest
|
||||||
else
|
else
|
||||||
|
if @contestant
|
||||||
|
@action_name = t("helpers.buttons.back_to_contestant")
|
||||||
|
@action_path = edit_contest_contestant_path(@contest, @contestant)
|
||||||
|
end
|
||||||
render :edit, status: :unprocessable_entity
|
render :edit, status: :unprocessable_entity
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -60,6 +79,14 @@ class CompletionsController < ApplicationController
|
|||||||
@contest = Contest.find(params[:contest_id])
|
@contest = Contest.find(params[:contest_id])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def set_contestant
|
||||||
|
if params.key?(:contestant_id)
|
||||||
|
@contestant = Contestant.find(params[:contestant_id])
|
||||||
|
else
|
||||||
|
@contetant = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def set_data
|
def set_data
|
||||||
@contestants = @contest.contestants
|
@contestants = @contest.contestants
|
||||||
@puzzles = @contest.puzzles
|
@puzzles = @contest.puzzles
|
||||||
|
@ -5,11 +5,16 @@ class ContestantsController < ApplicationController
|
|||||||
|
|
||||||
def edit
|
def edit
|
||||||
authorize @contest
|
authorize @contest
|
||||||
|
|
||||||
|
@action_name = t("helpers.buttons.back")
|
||||||
|
@action_path = contest_path(@contest)
|
||||||
end
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
authorize @contest
|
authorize @contest
|
||||||
|
|
||||||
|
@action_name = t("helpers.buttons.back")
|
||||||
|
@action_path = contest_path(@contest)
|
||||||
@contestant = Contestant.new
|
@contestant = Contestant.new
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -21,6 +26,8 @@ class ContestantsController < ApplicationController
|
|||||||
if @contestant.save
|
if @contestant.save
|
||||||
redirect_to contest_path(@contest)
|
redirect_to contest_path(@contest)
|
||||||
else
|
else
|
||||||
|
@action_name = t("helpers.buttons.back")
|
||||||
|
@action_path = contest_path(@contest)
|
||||||
render :new, status: :unprocessable_entity
|
render :new, status: :unprocessable_entity
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -31,6 +38,8 @@ class ContestantsController < ApplicationController
|
|||||||
if @contestant.update(contestant_params)
|
if @contestant.update(contestant_params)
|
||||||
redirect_to @contest
|
redirect_to @contest
|
||||||
else
|
else
|
||||||
|
@action_name = t("helpers.buttons.back")
|
||||||
|
@action_path = contest_path(@contest)
|
||||||
render :edit, status: :unprocessable_entity
|
render :edit, status: :unprocessable_entity
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -45,6 +54,9 @@ class ContestantsController < ApplicationController
|
|||||||
def import
|
def import
|
||||||
authorize @contest
|
authorize @contest
|
||||||
|
|
||||||
|
@action_name = t("helpers.buttons.back")
|
||||||
|
@action_path = contest_path(@contest)
|
||||||
|
|
||||||
@csv_import = CsvImport.new
|
@csv_import = CsvImport.new
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -55,6 +67,8 @@ class ContestantsController < ApplicationController
|
|||||||
if @csv_import.save
|
if @csv_import.save
|
||||||
redirect_to "/contests/#{@contest.id}/import/#{@csv_import.id}"
|
redirect_to "/contests/#{@contest.id}/import/#{@csv_import.id}"
|
||||||
else
|
else
|
||||||
|
@action_name = t("helpers.buttons.back")
|
||||||
|
@action_path = contest_path(@contest)
|
||||||
render :import, status: :unprocessable_entity
|
render :import, status: :unprocessable_entity
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -23,6 +23,9 @@ class ContestsController < ApplicationController
|
|||||||
|
|
||||||
def edit
|
def edit
|
||||||
authorize @contest
|
authorize @contest
|
||||||
|
|
||||||
|
@action_name = t("helpers.buttons.back")
|
||||||
|
@action_path = contest_path(@contest)
|
||||||
end
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
|
@ -50,6 +50,9 @@ class MessagesController < ApplicationController
|
|||||||
def convert
|
def convert
|
||||||
authorize @contest
|
authorize @contest
|
||||||
|
|
||||||
|
@action_name = t("helpers.buttons.back")
|
||||||
|
@action_path = contest_path(@contest)
|
||||||
|
|
||||||
@message = Message.find(params[:message_id])
|
@message = Message.find(params[:message_id])
|
||||||
@completion = Completion.new()
|
@completion = Completion.new()
|
||||||
@completion.display_time_from_start = @message.display_time
|
@completion.display_time_from_start = @message.display_time
|
||||||
|
@ -4,11 +4,16 @@ class PuzzlesController < ApplicationController
|
|||||||
|
|
||||||
def edit
|
def edit
|
||||||
authorize @contest
|
authorize @contest
|
||||||
|
|
||||||
|
@action_name = t("helpers.buttons.back")
|
||||||
|
@action_path = contest_path(@contest)
|
||||||
end
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
authorize @contest
|
authorize @contest
|
||||||
|
|
||||||
|
@action_name = t("helpers.buttons.back")
|
||||||
|
@action_path = contest_path(@contest)
|
||||||
@puzzle = Puzzle.new
|
@puzzle = Puzzle.new
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -20,6 +25,8 @@ class PuzzlesController < ApplicationController
|
|||||||
if @puzzle.save
|
if @puzzle.save
|
||||||
redirect_to contest_path(@contest)
|
redirect_to contest_path(@contest)
|
||||||
else
|
else
|
||||||
|
@action_name = t("helpers.buttons.back")
|
||||||
|
@action_path = contest_path(@contest)
|
||||||
render :new, status: :unprocessable_entity
|
render :new, status: :unprocessable_entity
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -30,6 +37,8 @@ class PuzzlesController < ApplicationController
|
|||||||
if @puzzle.update(puzzle_params)
|
if @puzzle.update(puzzle_params)
|
||||||
redirect_to @contest
|
redirect_to @contest
|
||||||
else
|
else
|
||||||
|
@action_name = t("helpers.buttons.back")
|
||||||
|
@action_path = contest_path(@contest)
|
||||||
render :edit, status: :unprocessable_entity
|
render :edit, status: :unprocessable_entity
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
td
|
td
|
||||||
| #{completion.puzzle.name} - #{completion.puzzle.brand}
|
| #{completion.puzzle.name} - #{completion.puzzle.brand}
|
||||||
td
|
td
|
||||||
a.btn.btn-sm.btn-secondary.me-2 href=edit_contest_completion_path(@contest, completion, contestant.id)
|
a.btn.btn-sm.btn-secondary.me-2 href=edit_contest_completion_path(@contest, completion, contestant_id: contestant.id)
|
||||||
| Edit
|
| Edit
|
||||||
= link_to "Delete", contest_completion_path(contest, completion, contestant_id: contestant.id),
|
= link_to "Delete", contest_completion_path(contest, completion, contestant_id: contestant.id),
|
||||||
data: { turbo_method: :delete }, class: "btn btn-sm btn-secondary"
|
data: { turbo_method: :delete }, class: "btn btn-sm btn-secondary"
|
||||||
|
@ -117,6 +117,8 @@ en:
|
|||||||
teams:
|
teams:
|
||||||
singular: "team"
|
singular: "team"
|
||||||
plural: "teams"
|
plural: "teams"
|
||||||
|
upload_csv:
|
||||||
|
title: "Import participants"
|
||||||
helpers:
|
helpers:
|
||||||
badges:
|
badges:
|
||||||
registration: "registration"
|
registration: "registration"
|
||||||
@ -124,6 +126,8 @@ en:
|
|||||||
buttons:
|
buttons:
|
||||||
add: "Add"
|
add: "Add"
|
||||||
add_completion: "Add completion"
|
add_completion: "Add completion"
|
||||||
|
back: "⬅ Back to the contest"
|
||||||
|
back_to_contestant: "⬅ Back to the participant"
|
||||||
confirm: "Confirm"
|
confirm: "Confirm"
|
||||||
create: "Create"
|
create: "Create"
|
||||||
delete: "Delete"
|
delete: "Delete"
|
||||||
@ -133,7 +137,7 @@ en:
|
|||||||
field: "Field"
|
field: "Field"
|
||||||
messages:
|
messages:
|
||||||
convert:
|
convert:
|
||||||
title: "Convert message into completion"
|
title: "New completion"
|
||||||
plural: "messages"
|
plural: "messages"
|
||||||
singular: "message"
|
singular: "message"
|
||||||
nav:
|
nav:
|
||||||
|
@ -88,6 +88,8 @@ fr:
|
|||||||
teams:
|
teams:
|
||||||
singular: "équipe"
|
singular: "équipe"
|
||||||
plural: "équipes"
|
plural: "équipes"
|
||||||
|
upload_csv:
|
||||||
|
title: "Importer des participant.e.s"
|
||||||
helpers:
|
helpers:
|
||||||
badges:
|
badges:
|
||||||
registration: "auto-inscription"
|
registration: "auto-inscription"
|
||||||
@ -95,6 +97,8 @@ fr:
|
|||||||
buttons:
|
buttons:
|
||||||
add: "Ajouter"
|
add: "Ajouter"
|
||||||
add_completion: "Ajouter une complétion"
|
add_completion: "Ajouter une complétion"
|
||||||
|
back: "⬅ Revenir au concours"
|
||||||
|
back_to_contestant: "⬅ Revenir au/à la participant.e"
|
||||||
confirm: "Confirmer"
|
confirm: "Confirmer"
|
||||||
create: "Créer"
|
create: "Créer"
|
||||||
delete: "Supprimer"
|
delete: "Supprimer"
|
||||||
@ -104,7 +108,7 @@ fr:
|
|||||||
field: "Champ"
|
field: "Champ"
|
||||||
messages:
|
messages:
|
||||||
convert:
|
convert:
|
||||||
title: "Conversion d'un message en complétion"
|
title: "Ajout d'une complétion"
|
||||||
plural: "messages"
|
plural: "messages"
|
||||||
singular: "message"
|
singular: "message"
|
||||||
nav:
|
nav:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user