mirror of https://github.com/fspc/BikeShed-1.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
568 B
36 lines
568 B
class TeamsController < AuthenticatedController
|
|
expose(:team) do
|
|
if params[:id]
|
|
Team.find(params[:id])
|
|
elsif params[:team]
|
|
Team.new(params[:team])
|
|
else
|
|
Team.new(:max_members => 16)
|
|
end
|
|
end
|
|
|
|
expose(:teams) { Team.order('lower(name)').paginate(:page => params[:page]) }
|
|
|
|
def index
|
|
end
|
|
|
|
def show
|
|
end
|
|
|
|
def new
|
|
end
|
|
|
|
def create
|
|
team.captain = current_user
|
|
if team.save
|
|
redirect_to teams_url
|
|
else
|
|
render :new
|
|
end
|
|
end
|
|
|
|
def join
|
|
current_user.teams << team
|
|
redirect_to team
|
|
end
|
|
end
|
|
|