Class: Scholarship::TeamsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Scholarship::TeamsController
show all
- Includes:
- Applicat::Mvc::Controller::Resource, BaseController
- Defined in:
- app/controllers/scholarship/teams_controller.rb
Instance Method Summary
collapse
#application_navigation, #navigation_product_name, #navigation_product_path
Instance Method Details
#create ⇒ Object
23
24
25
26
27
28
29
30
31
32
|
# File 'app/controllers/scholarship/teams_controller.rb', line 23
def create
@team = Scholarship::Team.new(params[:scholarship_team])
@team.leader = current_user
if @team.save
redirect_to @team, notice: t('general.form.successfully_created')
else
render :new
end
end
|
#destroy ⇒ Object
45
46
47
48
|
# File 'app/controllers/scholarship/teams_controller.rb', line 45
def destroy
@team.destroy
redirect_to scholarship_teams_path, notice: t('general.form.destroyed')
end
|
#edit ⇒ Object
34
35
|
# File 'app/controllers/scholarship/teams_controller.rb', line 34
def edit
end
|
#index ⇒ Object
11
12
13
14
|
# File 'app/controllers/scholarship/teams_controller.rb', line 11
def index
@teams = Scholarship::Team.order(:name)
@teams = @teams.paginate(page: params[:page], per_page: 25)
end
|
#new ⇒ Object
19
20
21
|
# File 'app/controllers/scholarship/teams_controller.rb', line 19
def new
@team = Scholarship::Team.new(kind: 'sponsored')
end
|
#resource ⇒ Object
50
51
52
|
# File 'app/controllers/scholarship/teams_controller.rb', line 50
def resource
@team
end
|
#show ⇒ Object
16
17
|
# File 'app/controllers/scholarship/teams_controller.rb', line 16
def show
end
|
#update ⇒ Object
37
38
39
40
41
42
43
|
# File 'app/controllers/scholarship/teams_controller.rb', line 37
def update
if @team.update_attributes(params[:scholarship_team])
redirect_to @team, notice: t('general.form.successfully_updated')
else
render :edit
end
end
|