Improve contest view
Some checks are pending
CI / scan_ruby (push) Waiting to run
CI / scan_js (push) Waiting to run
CI / lint (push) Waiting to run
CI / test (push) Waiting to run

This commit is contained in:
sto
2025-03-16 09:22:27 +01:00
parent 7ec51b6d85
commit 785e523ebe
5 changed files with 39 additions and 20 deletions

View File

@@ -1,6 +1,6 @@
class PuzzlesController < ApplicationController
before_action :set_contest
before_action :set_puzzle, only: %i[ show destroy ]
before_action :set_puzzle, only: %i[ edit destroy show update]
def index
@puzzles = Puzzle.all
@@ -9,6 +9,10 @@ class PuzzlesController < ApplicationController
def show
end
def edit
@title = "Edit contest puzzle"
end
def new
@puzzle = Puzzle.new
@title = "New contest puzzle"
@@ -25,6 +29,14 @@ class PuzzlesController < ApplicationController
end
end
def update
if @puzzle.update(puzzle_params)
redirect_to @contest
else
render :edit, status: :unprocessable_entity
end
end
def destroy
@puzzle.destroy
redirect_to puzzles_path