Class: Scholarship::ProgramsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Scholarship::ProgramsController
show all
- Includes:
- Applicat::Mvc::Controller::Resource, BaseController
- Defined in:
- app/controllers/scholarship/programs_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
|
# File 'app/controllers/scholarship/programs_controller.rb', line 23
def create
@program = Scholarship::Program.new(params[:scholarship_program])
if @program.save
redirect_to @program, notice: t('general.form.successfully_created')
else
render :new
end
end
|
#destroy ⇒ Object
44
45
46
47
|
# File 'app/controllers/scholarship/programs_controller.rb', line 44
def destroy
@program.destroy
redirect_to organization_scholarship_programs_path(@program.organization), notice: t('general.form.destroyed')
end
|
#edit ⇒ Object
33
34
|
# File 'app/controllers/scholarship/programs_controller.rb', line 33
def edit
end
|
#index ⇒ Object
11
12
13
14
15
|
# File 'app/controllers/scholarship/programs_controller.rb', line 11
def index
@organization = find_parent Scholarship::Program::PARENT_TYPES
@programs = @organization ? @organization.scholarship_programs.order(:name) : Scholarship::Program.order(:name)
@programs = @programs.paginate(page: params[:page], per_page: 25)
end
|
#new ⇒ Object
20
21
|
# File 'app/controllers/scholarship/programs_controller.rb', line 20
def new
end
|
#resource ⇒ Object
49
50
51
|
# File 'app/controllers/scholarship/programs_controller.rb', line 49
def resource
@program
end
|
#show ⇒ Object
17
18
|
# File 'app/controllers/scholarship/programs_controller.rb', line 17
def show
end
|
#update ⇒ Object
36
37
38
39
40
41
42
|
# File 'app/controllers/scholarship/programs_controller.rb', line 36
def update
if @program.update_attributes(params[:scholarship_program])
redirect_to @program, notice: t('general.form.successfully_updated')
else
render :edit
end
end
|