Skip to content
This repository has been archived by the owner on Jun 16, 2021. It is now read-only.

Commit

Permalink
Merge pull request #580 from omu/develop
Browse files Browse the repository at this point in the history
Merge develop into master
  • Loading branch information
msdundar authored Dec 7, 2018
2 parents 04171ca + 5710166 commit 28918c8
Show file tree
Hide file tree
Showing 142 changed files with 3,827 additions and 969 deletions.
74 changes: 37 additions & 37 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
GEM
remote: https://rubygems.org/
specs:
actioncable (5.2.1.1)
actionpack (= 5.2.1.1)
actioncable (5.2.2)
actionpack (= 5.2.2)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailer (5.2.1.1)
actionpack (= 5.2.1.1)
actionview (= 5.2.1.1)
activejob (= 5.2.1.1)
actionmailer (5.2.2)
actionpack (= 5.2.2)
actionview (= 5.2.2)
activejob (= 5.2.2)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (5.2.1.1)
actionview (= 5.2.1.1)
activesupport (= 5.2.1.1)
actionpack (5.2.2)
actionview (= 5.2.2)
activesupport (= 5.2.2)
rack (~> 2.0)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.2.1.1)
activesupport (= 5.2.1.1)
actionview (5.2.2)
activesupport (= 5.2.2)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
activejob (5.2.1.1)
activesupport (= 5.2.1.1)
activejob (5.2.2)
activesupport (= 5.2.2)
globalid (>= 0.3.6)
activemodel (5.2.1.1)
activesupport (= 5.2.1.1)
activerecord (5.2.1.1)
activemodel (= 5.2.1.1)
activesupport (= 5.2.1.1)
activemodel (5.2.2)
activesupport (= 5.2.2)
activerecord (5.2.2)
activemodel (= 5.2.2)
activesupport (= 5.2.2)
arel (>= 9.0)
activestorage (5.2.1.1)
actionpack (= 5.2.1.1)
activerecord (= 5.2.1.1)
activestorage (5.2.2)
actionpack (= 5.2.2)
activerecord (= 5.2.2)
marcel (~> 0.3.1)
activesupport (5.2.1.1)
activesupport (5.2.2)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
Expand Down Expand Up @@ -173,7 +173,7 @@ GEM
nokogiri (1.8.5)
mini_portile2 (~> 2.3.0)
orm_adapter (0.5.0)
pagy (1.1.0)
pagy (1.2.0)
parallel (1.12.1)
parser (2.5.3.0)
ast (~> 2.4.0)
Expand All @@ -197,27 +197,27 @@ GEM
rack
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (5.2.1.1)
actioncable (= 5.2.1.1)
actionmailer (= 5.2.1.1)
actionpack (= 5.2.1.1)
actionview (= 5.2.1.1)
activejob (= 5.2.1.1)
activemodel (= 5.2.1.1)
activerecord (= 5.2.1.1)
activestorage (= 5.2.1.1)
activesupport (= 5.2.1.1)
rails (5.2.2)
actioncable (= 5.2.2)
actionmailer (= 5.2.2)
actionpack (= 5.2.2)
actionview (= 5.2.2)
activejob (= 5.2.2)
activemodel (= 5.2.2)
activerecord (= 5.2.2)
activestorage (= 5.2.2)
activesupport (= 5.2.2)
bundler (>= 1.3.0)
railties (= 5.2.1.1)
railties (= 5.2.2)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.0.4)
loofah (~> 2.2, >= 2.2.2)
railties (5.2.1.1)
actionpack (= 5.2.1.1)
activesupport (= 5.2.1.1)
railties (5.2.2)
actionpack (= 5.2.2)
activesupport (= 5.2.2)
method_source
rake (>= 0.8.7)
thor (>= 0.19.0, < 2.0)
Expand Down
2 changes: 2 additions & 0 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@
//= require jquery.maskedinput/src/jquery.maskedinput
//= require Chart.bundle
//= require chartkick
//= require flatpickr/dist/flatpickr.min
//= require flatpickr/dist/l10n/tr
2 changes: 2 additions & 0 deletions app/assets/stylesheets/application.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@
*= require toastr/build/toastr.min
*= require select2/dist/css/select2.min
*= require custom/select2
*= require flatpickr/dist/flatpickr.min
*= require flatpickr/dist/themes/material_red
*/
51 changes: 51 additions & 0 deletions app/controllers/course_management/course_groups_controller.rb
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 app/controllers/course_management/course_unit_groups_controller.rb

This file was deleted.

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 app/controllers/course_management/curriculum_courses_controller.rb
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

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def index

def show
@semesters = @curriculum.semesters
.includes(curriculum_semester_courses: :course)
.includes(curriculum_course_groups: :course_group)
.order(:year, :sequence)
.group_by(&:year)
end
Expand Down
Loading

0 comments on commit 28918c8

Please sign in to comment.