This repository has been archived by the owner on Jun 16, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #580 from omu/develop
Merge develop into master
- Loading branch information
Showing
142 changed files
with
3,827 additions
and
969 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
app/controllers/course_management/course_groups_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# frozen_string_literal: true | ||
|
||
module CourseManagement | ||
class CourseGroupsController < ApplicationController | ||
include PagyBackendWithHelpers | ||
|
||
before_action :set_course_group, only: %i[show edit update destroy] | ||
|
||
def index | ||
@course_groups = pagy_by_search(CourseGroup.includes(:unit, :course_group_type)) | ||
end | ||
|
||
def show | ||
@courses = @course_group.courses | ||
end | ||
|
||
def new | ||
@course_group = CourseGroup.new | ||
end | ||
|
||
def create | ||
@course_group = CourseGroup.new(course_group_params) | ||
@course_group.save ? redirect_with('success') : render(:new) | ||
end | ||
|
||
def edit; end | ||
|
||
def update | ||
@course_group.update(course_group_params) ? redirect_with('success') : render(:edit) | ||
end | ||
|
||
def destroy | ||
@course_group.destroy ? redirect_with('success') : redirect_with('warning') | ||
end | ||
|
||
private | ||
|
||
def redirect_with(message) | ||
redirect_to(course_groups_path, notice: t(".#{message}")) | ||
end | ||
|
||
def set_course_group | ||
@course_group = CourseGroup.find(params[:id]) | ||
end | ||
|
||
def course_group_params | ||
params.require(:course_group) | ||
.permit(:name, :total_ects_condition, :unit_id, :course_group_type_id, course_ids: []) | ||
end | ||
end | ||
end |
51 changes: 0 additions & 51 deletions
51
app/controllers/course_management/course_unit_groups_controller.rb
This file was deleted.
Oops, something went wrong.
53 changes: 53 additions & 0 deletions
53
app/controllers/course_management/curriculum_course_groups_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# frozen_string_literal: true | ||
|
||
module CourseManagement | ||
class CurriculumCourseGroupsController < ApplicationController | ||
before_action :set_semester, only: %i[new create edit update destroy] | ||
before_action :set_curriculum_course_group, only: %i[edit update destroy] | ||
|
||
def new | ||
@curriculum_course_group = @semester.curriculum_course_groups.new | ||
end | ||
|
||
def edit | ||
@curriculum_course_group.build_curriculum_courses | ||
end | ||
|
||
def create | ||
@curriculum_course_group = @semester.curriculum_course_groups.new(curriculum_course_params) | ||
@curriculum_course_group.save ? redirect_with('success') : render(:new) | ||
end | ||
|
||
def update | ||
@curriculum_course_group.update(curriculum_course_params) ? redirect_with('success') : render(:edit) | ||
end | ||
|
||
def destroy | ||
message = @curriculum_course_group.destroy ? 'success' : 'error' | ||
redirect_with(message) | ||
end | ||
|
||
private | ||
|
||
def redirect_with(message) | ||
redirect_to curriculum_path(@semester.curriculum), flash: { notice: t(".#{message}") } | ||
end | ||
|
||
def set_curriculum_course_group | ||
@curriculum_course_group = @semester.curriculum_course_groups.find(params[:id]) | ||
end | ||
|
||
def set_semester | ||
@semester = CurriculumSemesterDecorator.new( | ||
CurriculumSemester.find(params[:curriculum_semester_id]) | ||
) | ||
end | ||
|
||
def curriculum_course_params | ||
params.require(:curriculum_course_group).permit( | ||
:course_group_id, :ects, | ||
curriculum_courses_attributes: %i[id course_id ects curriculum_semester_id] | ||
) | ||
end | ||
end | ||
end |
48 changes: 48 additions & 0 deletions
48
app/controllers/course_management/curriculum_courses_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# frozen_string_literal: true | ||
|
||
module CourseManagement | ||
class CurriculumCoursesController < ApplicationController | ||
before_action :set_semester, only: %i[new create edit update destroy] | ||
before_action :set_curriculum_course, only: %i[edit update destroy] | ||
|
||
def new | ||
@curriculum_course = @semester.curriculum_courses.new | ||
end | ||
|
||
def edit; end | ||
|
||
def create | ||
@curriculum_course = @semester.curriculum_courses.new(curriculum_course_params) | ||
@curriculum_course.save ? redirect_with('success') : render(:new) | ||
end | ||
|
||
def update | ||
@curriculum_course.update(curriculum_course_params) ? redirect_with('success') : render(:edit) | ||
end | ||
|
||
def destroy | ||
message = @curriculum_course.destroy ? 'success' : 'error' | ||
redirect_with(message) | ||
end | ||
|
||
private | ||
|
||
def redirect_with(message) | ||
redirect_to curriculum_path(@semester.curriculum), flash: { notice: t(".#{message}") } | ||
end | ||
|
||
def set_curriculum_course | ||
@curriculum_course = @semester.curriculum_courses.find(params[:id]) | ||
end | ||
|
||
def set_semester | ||
@semester = CurriculumSemesterDecorator.new( | ||
CurriculumSemester.find(params[:curriculum_semester_id]) | ||
) | ||
end | ||
|
||
def curriculum_course_params | ||
params.require(:curriculum_course).permit(:course_id, :ects) | ||
end | ||
end | ||
end |
46 changes: 0 additions & 46 deletions
46
app/controllers/course_management/curriculum_semester_courses_controller.rb
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.