Add team switch
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
class ContestsController < ApplicationController
|
||||
before_action :set_contest, only: %i[ show destroy ]
|
||||
before_action :set_contest, only: %i[ destroy edit show update ]
|
||||
|
||||
def index
|
||||
@contests = current_user.contests
|
||||
@@ -7,7 +7,11 @@ class ContestsController < ApplicationController
|
||||
end
|
||||
|
||||
def show
|
||||
@title = "Contest: #{@contest.name}"
|
||||
@title = @contest.name
|
||||
end
|
||||
|
||||
def edit
|
||||
@title = "Edit contest settings"
|
||||
end
|
||||
|
||||
def new
|
||||
@@ -25,6 +29,14 @@ class ContestsController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
if @contest.update(contest_params)
|
||||
redirect_to @contest
|
||||
else
|
||||
render :edit, status: :unprocessable_entity
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
end
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
class UsersController < ApplicationController
|
||||
before_action :set_user, only: %i[ destroy edit update show ]
|
||||
before_action :set_user, only: %i[ destroy edit show update ]
|
||||
|
||||
def index
|
||||
@title = "All users"
|
||||
|
Reference in New Issue
Block a user