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 #540 from omu/develop
Browse files Browse the repository at this point in the history
Merge develop into master
  • Loading branch information
msdundar authored Nov 14, 2018
2 parents 96c0f35 + bb20a99 commit 2ad2677
Show file tree
Hide file tree
Showing 64 changed files with 377 additions and 483 deletions.
3 changes: 0 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ jobs:
- restore_cache:
<<: *restore_yarn
- run: bundle --path vendor/bundle --without development
- run: bundle install
- run: bin/yarn install
- run: bundle exec rake db:create db:schema:load
- run: bundle exec rake test
Expand All @@ -105,7 +104,6 @@ jobs:
- restore_cache:
<<: *restore_yarn
- run: bundle --path vendor/bundle --without development
- run: bundle install
- run: bin/yarn install
- run: bundle exec rake quality:rails
- run: bin/yarn run lint
Expand All @@ -119,7 +117,6 @@ jobs:
- restore_cache:
<<: *restore_yarn
- run: bundle --path vendor/bundle --without development
- run: bundle install
- run: bin/yarn install
- run: bundle exec rake security:all
deploy_develop:
Expand Down
6 changes: 6 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
source 'https://rubygems.org'
ruby File.read('.ruby-version')

git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?('/')
"https://github.com/#{repo_name}.git"
end

# core
gem 'bootsnap', '>= 1.1.0', require: false
gem 'pg'
Expand Down Expand Up @@ -74,6 +79,7 @@ group :development do
gem 'letter_opener'
gem 'listen', '>= 3.0.5', '< 3.2'
gem 'pry-rails'
gem 'rack-mini-profiler'
gem 'ruby-progressbar'
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
Expand Down
17 changes: 10 additions & 7 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ GEM
arel (9.0.0)
ast (2.4.0)
aws-eventstream (1.0.1)
aws-partitions (1.110.0)
aws-sdk-core (3.37.0)
aws-partitions (1.111.0)
aws-sdk-core (3.38.0)
aws-eventstream (~> 1.0)
aws-partitions (~> 1.0)
aws-sigv4 (~> 1.0)
Expand All @@ -71,7 +71,7 @@ GEM
msgpack (~> 1.0)
brakeman (4.3.1)
builder (3.2.3)
bullet (5.8.1)
bullet (5.9.0)
activesupport (>= 3.0.0)
uniform_notifier (~> 1.11)
bundler-audit (0.6.0)
Expand Down Expand Up @@ -156,7 +156,7 @@ GEM
mini_mime (>= 0.1.1)
marcel (0.3.3)
mimemagic (~> 0.3.2)
method_source (0.9.1)
method_source (0.9.2)
mimemagic (0.3.2)
mini_magick (4.9.2)
mini_mime (1.0.1)
Expand All @@ -169,7 +169,7 @@ GEM
nokogiri (1.8.5)
mini_portile2 (~> 2.3.0)
orm_adapter (0.5.0)
pagy (0.22.0)
pagy (0.23.1)
parallel (1.12.1)
parser (2.5.3.0)
ast (~> 2.4.0)
Expand All @@ -179,14 +179,16 @@ GEM
activesupport (>= 4.2)
arel (>= 6)
powerpack (0.1.2)
pry (0.12.0)
pry (0.12.2)
coderay (~> 1.1.0)
method_source (~> 0.9.0)
pry-rails (0.3.7)
pry (>= 0.10.4)
public_suffix (3.0.3)
puma (3.12.0)
rack (2.0.6)
rack-mini-profiler (1.0.0)
rack (>= 1.2.0)
rack-protection (2.0.4)
rack
rack-test (1.1.0)
Expand Down Expand Up @@ -280,7 +282,7 @@ GEM
activesupport (>= 4.0)
sprockets (>= 3.0.0)
swearjar (1.3.0)
thor (0.20.0)
thor (0.20.3)
thread_safe (0.3.6)
tilt (2.0.8)
tzinfo (1.2.5)
Expand Down Expand Up @@ -342,6 +344,7 @@ DEPENDENCIES
pg_search
pry-rails
puma (~> 3.11)
rack-mini-profiler
rails (~> 5.2.1)
redis
rollbar
Expand Down
Binary file modified app/assets/images/public_profile/lecture-hall.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ def register
else
redirect_with_warning('.warning')
end

@prospective_student.update(registered: true)
end

private
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/units_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class UnitsController < ApplicationController
def index
units = Unit.includes(
:unit_status, :unit_instruction_language, :unit_instruction_type, :unit_type, district: [:city]
)
).order(:name)

@pagy, @units = pagy(units.dynamic_search(search_params(Unit)))
end
Expand Down
9 changes: 9 additions & 0 deletions app/models/available_course.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# frozen_string_literal: true

class AvailableCourse < ApplicationRecord
# relations
belongs_to :academic_term
belongs_to :curriculum
belongs_to :course
has_many :groups, class_name: 'AvailableCourseGroup', dependent: :destroy
end
12 changes: 12 additions & 0 deletions app/models/available_course_group.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# frozen_string_literal: true

class AvailableCourseGroup < ApplicationRecord
# relations
belongs_to :available_course
has_many :lecturers, class_name: 'AvailableCourseLecturer', foreign_key: :group_id,
inverse_of: :group, dependent: :destroy

# validations
validates :name, presence: true, uniqueness: { scope: :available_course }
validates :quota, numericality: { only_integer: true, greater_than_or_equal_to: 1 }, allow_blank: true
end
13 changes: 13 additions & 0 deletions app/models/available_course_lecturer.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

class AvailableCourseLecturer < ApplicationRecord
# relations
belongs_to :group, class_name: 'AvailableCourseGroup'
belongs_to :lecturer, class_name: 'Employee'

# validations
validates :coordinator, presence: true, inclusion: { in: [true, false] }

# scopes
scope :coordinator, -> { where(coordinator: true) }
end
1 change: 1 addition & 0 deletions app/models/curriculum.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class Curriculum < ApplicationRecord
has_many :semesters, class_name: 'CurriculumSemester',
inverse_of: :curriculum, dependent: :destroy
has_many :courses, through: :semesters
has_many :available_courses, dependent: :destroy

# nested models
accepts_nested_attributes_for :semesters, reject_if: :all_blank, allow_destroy: true
Expand Down
1 change: 1 addition & 0 deletions app/models/employee.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class Employee < ApplicationRecord
has_many :units, through: :duties
has_many :positions, through: :duties
has_many :administrative_functions, through: :duties
has_many :available_course_lecturers, foreign_key: :lecturer_id, inverse_of: :lecturer, dependent: :destroy

# validations
validates :title_id, uniqueness: { scope: %i[user active] }
Expand Down
2 changes: 1 addition & 1 deletion app/models/prospective_student.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class ProspectiveStudent < ApplicationRecord
using: { tsearch: { prefix: true } }
)

search_keys :meb_status, :military_status, :obs_status, :unit_id, :student_entrance_type_id
search_keys :meb_status, :military_status, :obs_status, :unit_id, :student_entrance_type_id, :registered

# relations
belongs_to :unit
Expand Down
10 changes: 8 additions & 2 deletions app/models/unit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@ class Unit < ApplicationRecord

pg_search_scope(
:search,
against: %i[name yoksis_id],
against: %i[name yoksis_id detsis_id],
using: { tsearch: { prefix: true } }
)

# dynamic_search
search_keys :duration, :unit_status_id, :unit_instruction_type_id, :unit_instruction_language_id

# callbacks
before_save :cache_ancestry

# relations
has_ancestry
belongs_to :district
Expand Down Expand Up @@ -66,9 +69,12 @@ class Unit < ApplicationRecord
.or(institutes)
.or(rectorships)
}

scope :curriculumable, -> { coursable }

def cache_ancestry
self.names_depth_cache = path.map(&:name).reverse.join(' / ')
end

# custom methods
def subprograms
descendants.programs
Expand Down
4 changes: 2 additions & 2 deletions app/views/account/duties/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<%= f.input :unit_id,
collection: Unit.active.without_programs.order(:name),
required: true,
label_method: lambda { |unit| "#{unit.name} (#{unit.parent.try(:name)})" } %>
label_method: :names_depth_cache %>
</div>
<div class='form-group col-sm-4'>
<%= f.input :start_date, required: true %>
Expand All @@ -28,7 +28,7 @@
<%= f.input :end_date, include_blank: true %>
</div>
<div class='form-group col-sm-12'>
<%= f.input :temporary, required: true %>
<%= f.input :temporary %>
</div>
<div class='form-group col-sm-12'>
<%= f.button :submit, class: 'btn btn-outline-success btn-sm' %>
Expand Down
4 changes: 3 additions & 1 deletion app/views/course_management/courses/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
<% end %>
<div class='row mt-3'>
<div class='form-group col-sm-4'>
<%= f.association :unit, collection: Unit.coursable.active.order(:name) %>
<%= f.association :unit,
collection: Unit.active.coursable.order(:name),
label_method: :names_depth_cache %>
</div>
<div class='form-group col-sm-4'>
<%= f.input :name %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/course_management/courses/_search.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<div class="form-group">
<%= label_tag(:unit_id, t('.unit')) %>
<%= select_tag(:unit_id,
options_from_collection_for_select(Unit.coursable.active, :id, :name, params[:unit_id]),
options_from_collection_for_select(Unit.active.coursable.order(:name), :id, :names_depth_cache, params[:unit_id]),
include_blank: true,
class: 'form-control',
style: 'width: 100%') %>
Expand Down
4 changes: 3 additions & 1 deletion app/views/course_management/curriculums/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
<%= f.input :name %>
</div>
<div class='form-group col-sm-6'>
<%= f.association :unit, collection: Unit.active.curriculumable %>
<%= f.association :unit,
collection: Unit.active.curriculumable.order(:name),
label_method: :names_depth_cache %>
</div>
<div class='form-group col-sm-6'>
<%= f.association :programs,
Expand Down
2 changes: 1 addition & 1 deletion app/views/course_management/curriculums/_search.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<div class="form-group">
<%= label_tag(:unit_id, t('.unit')) %>
<%= select_tag(:unit_id,
options_from_collection_for_select(Unit.active.departments, :id, :name, params[:unit_id]),
options_from_collection_for_select(Unit.active.departments.order(:name), :id, :name, params[:unit_id]),
include_blank: true,
class: 'form-control') %>
</div>
Expand Down
15 changes: 12 additions & 3 deletions app/views/student_management/prospective_students/_search.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,16 @@
class: 'form-control' %>
</div>
</div>
<div class="col-sm-4">
<div class="col-sm-3">
<div class="form-group">
<%= label_tag :registered, t('.registration_status') %>
<%= select_tag(:registered,
options_for_select([[t('.registered'), true], [t('.not_registered'), false]], params[:registered]),
include_blank: true,
class: 'form-control') %>
</div>
</div>
<div class="col-sm-3">
<div class="form-group">
<%= label_tag :meb_status, t('.meb_status') %>
<%= select_tag(:meb_status,
Expand All @@ -42,7 +51,7 @@
class: 'form-control') %>
</div>
</div>
<div class="col-sm-4">
<div class="col-sm-3">
<div class="form-group">
<%= label_tag :military_status, t('.military_status') %>
<%= select_tag(:military_status,
Expand All @@ -51,7 +60,7 @@
class: 'form-control') %>
</div>
</div>
<div class="col-sm-4">
<div class="col-sm-3">
<div class="form-group">
<%= label_tag :obs_status, t('.obs_status') %>
<%= select_tag(:obs_status,
Expand Down
10 changes: 8 additions & 2 deletions app/views/units/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,19 @@
</div>

<div class='form-group col-sm-6'>
<%= f.association :district, collection: City.includes(:districts).order(:name), as: :grouped_select, group_method: :districts, group_label_method: :name, input_html: { id: 'district_list' } %>
<%= f.association :district,
collection: City.includes(:districts).order(:name),
as: :grouped_select,
group_method: :districts,
group_label_method: :name,
input_html: { id: 'district_list' }
%>
</div>
<div class='form-group col-sm-6'>
<%= f.input :parent_id, as: :select,
collection: Unit.partially_passive.or(Unit.active).order(:name),
input_html: { id: 'parent_unit_list' },
label_method: lambda {|unit| "#{unit.name} (#{unit.parent.try(:name)})"}
label_method: :names_depth_cache
%>
</div>
<div class='form-group col-sm-12'>
Expand Down
3 changes: 3 additions & 0 deletions config/locales/models/student_management/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ en:
must_see_recruiting_office: Must see recruiting unit
nationality: Nationality
not_graduated_or_unknown: Not Graduated/Unknown
not_registered: Not Registered
obs_registered_program: Registered To
obs_status: Studentship Status
obs_status_date: Studentship Status Check Date
Expand All @@ -37,6 +38,8 @@ en:
placement_score_type: Placement Score Type
placement_type: Placement Type
preference_order: Preference Order
registration_status: Registration Status
registered: Registered
registration_city: Registration City
registration_district: Registration District
smart_search_placeholder: Prospective student id number, first name or last name.
Expand Down
3 changes: 3 additions & 0 deletions config/locales/models/student_management/tr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ tr:
must_see_recruiting_office: Askerlik Şubesiyle Görüşmeli
nationality: Uyruk
not_graduated_or_unknown: Mezun Değil/Bilinmiyor
not_registered: Kayıtlanmamış
obs_registered_program: Öğrenci Olarak Kayıtlı Olduğu Program
obs_status: Öğrencilik Durumu
obs_status_date: Öğrencilik Durum Kontrol Tarihi
Expand All @@ -37,6 +38,8 @@ tr:
placement_score_type: Yerleşme Puan Türü
placement_type: Yerleşme Türü
preference_order: Tercih Sırası
registration_status: Kayıt Durumu
registered: Kayıtlanmış
registration_city: Nüfusa Kayıtlı Olduğu İl
registration_district: Nüfusa Kayıtlı Olduğu İlçe
smart_search_placeholder: Yerleşen öğrenci kimlik numarası, adı veya soyadı
Expand Down
2 changes: 1 addition & 1 deletion config/locales/models/units/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ en:
form_title: Create a Unit
search:
duration: Duration of Instruction
smart_search_placeholder: Unit name or YOKSIS ID
smart_search_placeholder: Unit name, YOKSIS ID or DETSIS ID
unit_instruction_language: Language of Instruction
unit_instruction_type: Instruction Type
unit_status: Unit Status
Expand Down
2 changes: 1 addition & 1 deletion config/locales/models/units/tr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ tr:
form_title: Birim Oluştur
search:
duration: Öğretim Süresi
smart_search_placeholder: Birim adı veya YOKSIS numarası
smart_search_placeholder: Birim adı, YOKSIS veya DETSIS numarası
unit_instruction_language: Öğretim Dili
unit_instruction_type: Öğretim Türü
unit_status: Birim Durumu
Expand Down
Loading

0 comments on commit 2ad2677

Please sign in to comment.