Back buttons
This commit is contained in:
@@ -4,11 +4,16 @@ class PuzzlesController < ApplicationController
|
||||
|
||||
def edit
|
||||
authorize @contest
|
||||
|
||||
@action_name = t("helpers.buttons.back")
|
||||
@action_path = contest_path(@contest)
|
||||
end
|
||||
|
||||
def new
|
||||
authorize @contest
|
||||
|
||||
@action_name = t("helpers.buttons.back")
|
||||
@action_path = contest_path(@contest)
|
||||
@puzzle = Puzzle.new
|
||||
end
|
||||
|
||||
@@ -20,6 +25,8 @@ class PuzzlesController < ApplicationController
|
||||
if @puzzle.save
|
||||
redirect_to contest_path(@contest)
|
||||
else
|
||||
@action_name = t("helpers.buttons.back")
|
||||
@action_path = contest_path(@contest)
|
||||
render :new, status: :unprocessable_entity
|
||||
end
|
||||
end
|
||||
@@ -30,6 +37,8 @@ class PuzzlesController < ApplicationController
|
||||
if @puzzle.update(puzzle_params)
|
||||
redirect_to @contest
|
||||
else
|
||||
@action_name = t("helpers.buttons.back")
|
||||
@action_path = contest_path(@contest)
|
||||
render :edit, status: :unprocessable_entity
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user