Class: Gaku::ClassGroupsController
- Inherits:
-
GakuController
- Object
- CoreController
- GakuController
- Gaku::ClassGroupsController
- Defined in:
- app/controllers/gaku/class_groups_controller.rb
Instance Method Summary collapse
- #advanced_search ⇒ Object
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #search ⇒ Object
- #search_semester ⇒ Object
- #semester_advanced_search ⇒ Object
- #update ⇒ Object
- #with_semester ⇒ Object
- #without_semester ⇒ Object
Methods inherited from GakuController
Instance Method Details
#advanced_search ⇒ Object
56 57 58 59 60 61 |
# File 'app/controllers/gaku/class_groups_controller.rb', line 56 def advanced_search @semesters = Semester.with_class_group.map { |p| [p.to_s, p.id] } @search = ClassGroup.search(params[:q]) results = @search.result(distinct: true) @class_groups = results.page(params[:page]) end |
#create ⇒ Object
23 24 25 26 27 28 |
# File 'app/controllers/gaku/class_groups_controller.rb', line 23 def create @class_group = ClassGroup.new(class_group_params) @class_group.save set_count respond_with @class_group end |
#destroy ⇒ Object
12 13 14 15 16 |
# File 'app/controllers/gaku/class_groups_controller.rb', line 12 def destroy @class_group.destroy set_count respond_with @class_group end |
#edit ⇒ Object
30 31 32 |
# File 'app/controllers/gaku/class_groups_controller.rb', line 30 def edit # @class_group_course_enrollment = ClassGroupCourseEnrollment.new end |
#index ⇒ Object
39 40 41 42 |
# File 'app/controllers/gaku/class_groups_controller.rb', line 39 def index @semesters = Semester.with_class_group.active.includes(:class_groups) @count = @semesters.count end |
#new ⇒ Object
18 19 20 21 |
# File 'app/controllers/gaku/class_groups_controller.rb', line 18 def new @class_group = ClassGroup.new respond_with @class_group end |
#search ⇒ Object
78 79 80 81 82 83 84 85 |
# File 'app/controllers/gaku/class_groups_controller.rb', line 78 def search @semesters = Semester.with_class_group.map { |p| [p.to_s, p.id] } @search = ClassGroup.without_semester.search(params[:q]) results = @search.result(distinct: true) @class_groups = results.page(params[:page]) @count = results.count render :without_semester, layout: 'gaku/layouts/index' end |
#search_semester ⇒ Object
70 71 72 73 74 75 76 |
# File 'app/controllers/gaku/class_groups_controller.rb', line 70 def search_semester @search = Semester.includes(:class_groups).search(params[:q]) results = @search.result(distinct: true) @semesters = results.page(params[:page]) @count = results.count render :with_semester, layout: 'gaku/layouts/index' end |
#semester_advanced_search ⇒ Object
63 64 65 66 67 68 |
# File 'app/controllers/gaku/class_groups_controller.rb', line 63 def semester_advanced_search @search = Semester.with_class_group.includes(:class_groups).search(params[:q]) results = @search.result(distinct: true) @semesters = results.page(params[:page]) @semesters_for_select = Semester.with_class_group.map { |p| [p.to_s, p.id] } end |
#update ⇒ Object
34 35 36 37 |
# File 'app/controllers/gaku/class_groups_controller.rb', line 34 def update @class_group.update(class_group_params) respond_with @class_group, location: [:edit, @class_group] end |
#with_semester ⇒ Object
44 45 46 47 48 |
# File 'app/controllers/gaku/class_groups_controller.rb', line 44 def with_semester @semesters = Semester.with_class_group.includes(:class_groups) @count = @semesters.count render :with_semester, layout: 'gaku/layouts/index' end |
#without_semester ⇒ Object
50 51 52 53 54 |
# File 'app/controllers/gaku/class_groups_controller.rb', line 50 def without_semester @class_groups = ClassGroup.without_semester.includes(:semester_connectors) @count = @class_groups.count render :without_semester, layout: 'gaku/layouts/index' end |