+
+
+ <%= link_to (@user.identities.formal.present? ? t('.update_from_mernis') : t('.create_from_mernis') ), save_identity_from_mernis_user_path, class: "btn btn-outline-primary btn-sm" %>
- <% end %>
- <% else %>
-
+
+
+ <% @identities.each do |identity| %>
+
+
- Kullanıcının kimlik bilgisi bulunmuyor. MERNİS'ten getir.
+
+
+ <%= t('activerecord.attributes.identity.name') %> |
+
+
+ <%= fa_icon('gavel', text: t('activerecord.enums.identity.names.formal')) if identity.formal? %>
+ <%= fa_icon('user', text: t('activerecord.enums.identity.names.informal')) if identity.informal? %>
+
+ |
+
+
+ <%= t('activerecord.attributes.identity.last_name') %> |
+ <%= identity.last_name %> |
+
+
+ <%= t('activerecord.attributes.identity.first_name') %> |
+ <%= identity.first_name %> |
+
+
+ <%= t('activerecord.attributes.identity.mothers_name') %> |
+ <%= identity.mothers_name %> |
+
+
+ <%= t('activerecord.attributes.identity.fathers_name') %> |
+ <%= identity.fathers_name %> |
+
+
+ <%= t('activerecord.attributes.identity.gender') %> |
+ <%= enum_t(identity, :gender) %> |
+
+
+ <%= t('activerecord.attributes.identity.marital_status') %> |
+ <%= enum_t(identity, :marital_status) %> |
+
+
+ <%= t('activerecord.attributes.identity.place_of_birth') %> |
+ <%= identity.place_of_birth %> |
+
+
+ <%= t('activerecord.attributes.identity.date_of_birth') %> |
+ <%= identity.date_of_birth %> |
+
+
+ <%= t('activerecord.attributes.identity.registered_to') %> |
+ <%= identity.registered_to %> |
+
+
diff --git a/app/views/users/_search.html.erb b/app/views/users/_search.html.erb
index 805757076..f0b909f1a 100644
--- a/app/views/users/_search.html.erb
+++ b/app/views/users/_search.html.erb
@@ -3,7 +3,7 @@
diff --git a/config/locales/defaults/en.yml b/config/locales/defaults/en.yml
index 5389858bf..3331da262 100644
--- a/config/locales/defaults/en.yml
+++ b/config/locales/defaults/en.yml
@@ -15,4 +15,8 @@ en:
created_at: Created At
updated_at: Updated At
'yes': 'Yes'
- 'no': 'No'
\ No newline at end of file
+ 'no': 'No'
+ detailed_search: Detailed Search
+ reset: Reset
+ smart_search: Smart Search
+
\ No newline at end of file
diff --git a/config/locales/defaults/tr.yml b/config/locales/defaults/tr.yml
index 38e143959..7ab6e5181 100644
--- a/config/locales/defaults/tr.yml
+++ b/config/locales/defaults/tr.yml
@@ -15,4 +15,7 @@ tr:
created_at: Oluşturulma Tarihi
updated_at: Güncellenme Tarihi
'yes': Evet
- 'no': Hayır
\ No newline at end of file
+ 'no': Hayır
+ detailed_search: Detaylı Arama
+ reset: Reset
+ smart_search: Akıllı Arama
diff --git a/config/locales/layouts/shared/sidebar_en.yml b/config/locales/layouts/shared/sidebar_en.yml
index 0c214525e..2108c895c 100644
--- a/config/locales/layouts/shared/sidebar_en.yml
+++ b/config/locales/layouts/shared/sidebar_en.yml
@@ -28,3 +28,6 @@ en:
unit_types: Unit Types
university_types: University Types
studies: Academic Studies
+ committees: Committees
+ committee_units: Committee Units
+ agenda_types: Agenda Types
diff --git a/config/locales/layouts/shared/sidebar_tr.yml b/config/locales/layouts/shared/sidebar_tr.yml
index 2ea5a54f0..c8afc602b 100644
--- a/config/locales/layouts/shared/sidebar_tr.yml
+++ b/config/locales/layouts/shared/sidebar_tr.yml
@@ -28,3 +28,6 @@ tr:
unit_types: Birim Türleri
university_types: Üniversite Türleri
studies: Akademik Çalışmalar
+ committees: Kurullar/Komisyonlar
+ committee_units: Kurul/Komisyon Birimleri
+ agenda_types: Gündem Türleri
diff --git a/config/locales/models/committees/en.yml b/config/locales/models/committees/en.yml
new file mode 100644
index 000000000..00692b054
--- /dev/null
+++ b/config/locales/models/committees/en.yml
@@ -0,0 +1,75 @@
+en:
+ activerecord:
+ attributes:
+ agenda: &agenda_attributes
+ description: Agenda Description
+ agenda_type_id: Agenda Type
+ status: Agenda Status
+ agenda_type: &agenda_type_attributes
+ name: Name of Agenda Type
+ enums:
+ agenda:
+ statuses:
+ recent: Yeni
+ decided: Karar Verildi
+ delayed: Ertelendi
+ helpers:
+ submit:
+ agenda:
+ create: Create Agenda
+ update: Update Agenda
+ agenda_type:
+ create: Create Agenda Type
+ update: Update Agenda Type
+ committee:
+ agendas:
+ index:
+ <<: *agenda_attributes
+ new_agenda_link: Create a New Agenda
+ card_header: Agendas
+ unit: Unit
+ agenda_type: Agenda Type
+ new:
+ form_title: Create a Agenda
+ edit:
+ form_title: Update a Agenda
+ create:
+ success: Agenda successfully created.
+ update:
+ success: Agenda successfully updated.
+ destroy:
+ success: Agenda successfully deleted.
+ warning: Agenda can not be deleted!
+ agenda_types:
+ index:
+ <<: *agenda_type_attributes
+ new_agenda_type_link: Create a New Agenda Type
+ card_header: Agenda Types
+ new:
+ form_title: Create a Agenda Type
+ edit:
+ form_title: Update the Agenda Type
+ create:
+ success: Agenda Type successfully created.
+ update:
+ success: Agenda Type successfully updated.
+ destroy:
+ success: Agenda Type successfully deleted.
+ warning: Agenda Type can not be deleted!
+ dashboard:
+ index:
+ name: Committee / Commission Name
+ detsis_id: DETSIS ID
+ yoksis_id: YOKSIS ID
+ unit_status: Unit Status
+ unit_type: Unit Type
+ district: Location
+ card_header: Committee / Commission
+ new_committee_link: Create a New Committee/Commission
+ show:
+ description: Description
+ unit: Parent Unit
+ agenda_type: Agenda Type
+ status: Agenda Status
+ actions: Actions
+ agenda_card_header: Agendas
diff --git a/config/locales/models/committees/tr.yml b/config/locales/models/committees/tr.yml
new file mode 100644
index 000000000..e496b05e6
--- /dev/null
+++ b/config/locales/models/committees/tr.yml
@@ -0,0 +1,77 @@
+tr:
+ activerecord:
+ attributes:
+ agenda: &agenda_attributes
+ description: Gündem Açıklaması
+ agenda_type_id: Gündem Türü
+ status: Gündem Durumu
+ agenda_type: &agenda_type_attributes
+ name: Gündem Türü Adı
+ dashboard:
+ name: Kurul / Komisyon Adı
+ enums:
+ agenda:
+ statuses:
+ recent: Yeni
+ decided: Karar Verildi
+ delayed: Ertelendi
+ helpers:
+ submit:
+ agenda:
+ create: Gündem Oluştur
+ update: Gündem Güncelle
+ agenda_type:
+ create: Gündem Türü Oluştur
+ update: Gündem Türü Güncelle
+ committee:
+ agendas:
+ index:
+ <<: *agenda_attributes
+ new_agenda_link: Yeni Bir Gündem Oluştur
+ card_header: Gündemler
+ unit: Birim
+ agenda_type: Gündem Türü
+ new:
+ form_title: Gündem Oluştur
+ edit:
+ form_title: Gündem Güncelle
+ create:
+ success: Gündem başarıyla oluşturuldu.
+ update:
+ success: Gündem başarıyla güncellendi.
+ destroy:
+ success: Gündem başarıyla silindi.
+ warning: Gündem silinemedi!
+ agenda_types:
+ index:
+ <<: *agenda_type_attributes
+ new_agenda_type_link: Yeni Bir Gündem Türü Oluştur
+ card_header: Gündem Türleri
+ new:
+ form_title: Gündem Türü Oluştur
+ edit:
+ form_title: Gündem Türü Güncelle
+ create:
+ success: Gündem Türü başarıyla oluşturuldu.
+ update:
+ success: Gündem Türü başarıyla güncellendi.
+ destroy:
+ success: Gündem Türü başarıyla silindi.
+ warning: Gündem Türü silinemedi!
+ dashboard:
+ index:
+ name: Kurul / Komisyon Adı
+ detsis_id: DETSIS ID
+ yoksis_id: YOKSIS ID
+ unit_status: Birim Durumu
+ unit_type: Birim Türü
+ district: Bulunduğu İlçe
+ card_header: Kurul / Komisyon
+ new_committee_link: Yeni Bir Kurul/Komisyon Oluştur
+ show:
+ description: Açıklama
+ unit: Üst Birim
+ agenda_type: Gündem Türü
+ status: Gündem Durumu
+ actions: İşlemler
+ agenda_card_header: Gündemler
diff --git a/config/locales/models/curriculums/en.yml b/config/locales/models/curriculums/en.yml
index 2ea424001..37165d2b8 100644
--- a/config/locales/models/curriculums/en.yml
+++ b/config/locales/models/curriculums/en.yml
@@ -1,28 +1,29 @@
en:
- course_attributes: &course_attributes
- credit: Credit
- code: Code
- education_type: Education Type
- laboratory: Laboratory
- language: Language
- name: Name
- practice: Practice
- status: Status
- theoric: Theoric
- unit: Unit
activerecord:
+ attributes:
+ course: &course_attributes
+ credit: Credit
+ code: Code
+ program_type: Program Type
+ laboratory: Laboratory
+ language: Language
+ name: Name
+ practice: Practice
+ status: Status
+ theoric: Theoric
+ unit: Unit
models:
course: Course
enums:
course:
- education_types:
+ program_types:
+ associate: Associate
undergraduate: Undergraduate
master: Master
doctoral: Doctoral
statuses:
passive: Passive
active: Active
- abrogated: Abrogated
curriculum:
courses:
new:
@@ -36,6 +37,9 @@ en:
error: An error occured when deleting the course.
update:
success: Course successfully updated.
+ search:
+ smart_search_placeholder: Course name or code
+ <<: *course_attributes
show:
<<: *course_attributes
index:
diff --git a/config/locales/models/curriculums/tr.yml b/config/locales/models/curriculums/tr.yml
index 1abc41a4f..94bb9963a 100644
--- a/config/locales/models/curriculums/tr.yml
+++ b/config/locales/models/curriculums/tr.yml
@@ -1,28 +1,29 @@
tr:
- course_attributes: &course_attributes
- credit: Kredi
- code: Dersin Kodu
- education_type: Eğitim Türü
- laboratory: Laboratuvar
- language: Dil
- name: Dersin Adı
- practice: Uygulama
- status: Durumu
- theoric: Teorik
- unit: Birim
activerecord:
+ attributes:
+ course: &course_attributes
+ credit: Kredi
+ code: Dersin Kodu
+ program_type: Program Türü
+ laboratory: Laboratuvar
+ language: Dil
+ name: Dersin Adı
+ practice: Uygulama
+ status: Durumu
+ theoric: Teorik
+ unit: Birim
models:
course: Ders
enums:
course:
- education_types:
- undergraduate: Önlisans/Lisans
+ program_types:
+ associate: Önlisans
+ undergraduate: Lisans
master: Yüksek Lisans
doctoral: Doktora
statuses:
passive: Pasif
active: Aktif
- abrogated: Yürürlükten Kaldırılmış
curriculum:
courses:
new:
@@ -36,6 +37,9 @@ tr:
error: Ders silinirken bir hata oluştu.
update:
success: Ders başarıyla güncellendi.
+ search:
+ smart_search_placeholder: Ders adı veya kodu
+ <<: *course_attributes
show:
<<: *course_attributes
index:
diff --git a/config/locales/models/units/en.yml b/config/locales/models/units/en.yml
index 4bbc3d1a6..aa475f6bc 100644
--- a/config/locales/models/units/en.yml
+++ b/config/locales/models/units/en.yml
@@ -26,8 +26,6 @@ en:
units: Units
search:
smart_search_placeholder: Unit name or YOKSIS ID
- smart_search: Smart Search
- detailed_search: Detailed Search
duration: Duration of Instruction
unit_status: Unit Status
unit_instruction_language: Language of Instruction
diff --git a/config/locales/models/units/tr.yml b/config/locales/models/units/tr.yml
index 41adc82eb..2118d6afd 100644
--- a/config/locales/models/units/tr.yml
+++ b/config/locales/models/units/tr.yml
@@ -26,8 +26,6 @@ tr:
units: Birimler
search:
smart_search_placeholder: Birim adı veya YOKSIS numarası
- smart_search: Akıllı Arama
- detailed_search: Detaylı Arama
duration: Öğretim Süresi
unit_status: Birim Durumu
unit_instruction_language: Öğretim Dili
diff --git a/config/locales/models/user/en.yml b/config/locales/models/user/en.yml
index f16cb074a..acde8fd3e 100644
--- a/config/locales/models/user/en.yml
+++ b/config/locales/models/user/en.yml
@@ -73,6 +73,12 @@ en:
identities: Identities
account:
<<: *user_attributes
+ addresses:
+ update_from_mernis: Update from MERNIS
+ create_from_mernis: Create from MERNIS
+ identities:
+ update_from_mernis: Update from MERNIS
+ create_from_mernis: Create from MERNIS
employees:
active: Is Active?
title: Title
@@ -88,9 +94,7 @@ en:
addresses: Addresses
employees: Employees
search:
- smart_search: Smart Search
smart_search_placeholder: TC/YU number, e-mail address, first of last name
- detailed_search: Detailed Search
edit:
form_title: Edit Account
new:
@@ -102,3 +106,9 @@ en:
destroy:
success: User successfully deleted!
warning: User can not be deleted.
+ save_address_from_mernis:
+ wait: The address was recently created or updated. You can update the address once a week.
+ will_update: We have received your request to create or update addresses, the address will be updated within a few seconds.
+ save_identity_from_mernis:
+ wait: The identity was recently created or updated. You can update the identity once a week.
+ will_update: We have received your request for an identity creation or an update, and within a few seconds/minutes the identity will be updated.
diff --git a/config/locales/models/user/tr.yml b/config/locales/models/user/tr.yml
index 060ceff5b..0a50c77bb 100644
--- a/config/locales/models/user/tr.yml
+++ b/config/locales/models/user/tr.yml
@@ -73,6 +73,12 @@ tr:
identities: Kimlik Bilgileri
account:
<<: *user_attributes
+ addresses:
+ update_from_mernis: MERNİS'ten Güncelle
+ create_from_mernis: MERNİS'ten Oluştur
+ identities:
+ update_from_mernis: MERNİS'ten Güncelle
+ create_from_mernis: MERNİS'ten Oluştur
employees:
active: Aktif mi?
title: Ünvan
@@ -88,9 +94,7 @@ tr:
addresses: Adres Bilgileri
employees: Personel İşlemleri
search:
- smart_search: Akıllı Arama
smart_search_placeholder: TC/YU numarası, e-mail adresi, ad veya soyad
- detailed_search: Detaylı Arama
edit:
form_title: Hesabı Düzenle
new:
@@ -102,3 +106,9 @@ tr:
destroy:
success: Kullanıcı başarıyla silindi!
warning: Kullanıcı silinemedi!
+ save_address_from_mernis:
+ wait: Adres yakın bir zamanda oluşturulmuş veya güncellenmiş. Adresi haftada bir güncelleyebilirsiniz.
+ will_update: Adres oluşturma veya güncelleme talebinizi aldık, bir kaç saniye/dakika içerisinde adres güncellenecek.
+ save_identity_from_mernis:
+ wait: Kimlik yakın bir zamanda oluşturulmuş veya güncellenmiş. Kimliği haftada bir güncelleyebilirsiniz.
+ will_update: Kimlik oluşturma veya güncelleme talebinizi aldık, bir kaç saniye/dakika içerisinde kimlik güncellenecek.
diff --git a/config/routes.rb b/config/routes.rb
index fb6c50933..f569aa53c 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -34,7 +34,7 @@
resources :calendar_titles, except: :show
resources :calendar_types
end
-
+
resources :languages
resources :units
@@ -52,6 +52,8 @@
end
resources :users do
+ get 'save_address_from_mernis', on: :member
+ get 'save_identity_from_mernis', on: :member
scope module: :account do
resources :employees, except: %i[index show]
resources :duties, except: %i[index show]
@@ -91,4 +93,10 @@
get '/studies/projects', to: 'projects#index'
get '/studies/certifications', to: 'certifications#index'
end
+
+ resources :agenda_types, except: :show, module: :committee
+
+ resources :committees, only: %i[index show], controller: 'committee/dashboard' do
+ resources :agendas, except: :show, module: :committee
+ end
end
diff --git a/db/migrate/20180621072455_create_courses.rb b/db/migrate/20180621072455_create_courses.rb
old mode 100755
new mode 100644
index d462dcbc8..8221f6e8d
--- a/db/migrate/20180621072455_create_courses.rb
+++ b/db/migrate/20180621072455_create_courses.rb
@@ -1,7 +1,7 @@
class CreateCourses < ActiveRecord::Migration[5.2]
def change
create_table :courses do |t|
- t.string :name, null: false
+ t.string :name, null: false
t.string :code, null: false
t.integer :theoric, null: false
t.integer :practice, null: false
@@ -15,4 +15,4 @@ def change
t.timestamps
end
end
-end
\ No newline at end of file
+end
diff --git a/db/migrate/20180912131204_create_agenda_types.rb b/db/migrate/20180912131204_create_agenda_types.rb
new file mode 100644
index 000000000..46e9c9892
--- /dev/null
+++ b/db/migrate/20180912131204_create_agenda_types.rb
@@ -0,0 +1,8 @@
+class CreateAgendaTypes < ActiveRecord::Migration[5.2]
+ def change
+ create_table :agenda_types do |t|
+ t.string :name, null: false
+ t.timestamps
+ end
+ end
+end
diff --git a/db/migrate/20180913075455_create_agendas.rb b/db/migrate/20180913075455_create_agendas.rb
new file mode 100644
index 000000000..92694cf2c
--- /dev/null
+++ b/db/migrate/20180913075455_create_agendas.rb
@@ -0,0 +1,11 @@
+class CreateAgendas < ActiveRecord::Migration[5.2]
+ def change
+ create_table :agendas do |t|
+ t.text :description, null: false
+ t.references :unit, foreign_key: true
+ t.references :agenda_type, foreign_key: true
+ t.integer :status, null: false, default: 0
+ t.timestamps
+ end
+ end
+end
diff --git a/db/migrate/20180917205042_remove_language_and_abrogated_date_from_courses.rb b/db/migrate/20180917205042_remove_language_and_abrogated_date_from_courses.rb
new file mode 100644
index 000000000..5268ecbf6
--- /dev/null
+++ b/db/migrate/20180917205042_remove_language_and_abrogated_date_from_courses.rb
@@ -0,0 +1,6 @@
+class RemoveLanguageAndAbrogatedDateFromCourses < ActiveRecord::Migration[5.2]
+ def change
+ remove_column :courses, :language, :string
+ remove_column :courses, :abrogated_date, :date
+ end
+end
diff --git a/db/migrate/20180917205119_rename_education_type_to_program_type.rb b/db/migrate/20180917205119_rename_education_type_to_program_type.rb
new file mode 100644
index 000000000..52fd35361
--- /dev/null
+++ b/db/migrate/20180917205119_rename_education_type_to_program_type.rb
@@ -0,0 +1,5 @@
+class RenameEducationTypeToProgramType < ActiveRecord::Migration[5.2]
+ def change
+ rename_column :courses, :education_type, :program_type
+ end
+end
diff --git a/db/migrate/20180917205157_add_language_id_to_courses.rb b/db/migrate/20180917205157_add_language_id_to_courses.rb
new file mode 100644
index 000000000..a0c42283d
--- /dev/null
+++ b/db/migrate/20180917205157_add_language_id_to_courses.rb
@@ -0,0 +1,6 @@
+class AddLanguageIdToCourses < ActiveRecord::Migration[5.2]
+ def change
+ add_column :courses, :language_id, :integer, foreign_key: true
+ add_index :courses, :language_id
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 6632e1bd7..c467127d0 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 2018_09_10_105541) do
+ActiveRecord::Schema.define(version: 2018_09_17_205157) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -73,6 +73,23 @@
t.integer "code", null: false
end
+ create_table "agenda_types", force: :cascade do |t|
+ t.string "name", null: false
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ end
+
+ create_table "agendas", force: :cascade do |t|
+ t.text "description", null: false
+ t.bigint "unit_id"
+ t.bigint "agenda_type_id"
+ t.integer "status", default: 0, null: false
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ t.index ["agenda_type_id"], name: "index_agendas_on_agenda_type_id"
+ t.index ["unit_id"], name: "index_agendas_on_unit_id"
+ end
+
create_table "articles", force: :cascade do |t|
t.integer "yoksis_id", null: false
t.integer "scope"
@@ -184,12 +201,12 @@
t.integer "laboratory", null: false
t.decimal "credit", precision: 5, scale: 2, default: "0.0", null: false
t.bigint "unit_id"
- t.integer "education_type", null: false
- t.string "language", null: false
+ t.integer "program_type", null: false
t.integer "status", null: false
- t.date "abrogated_date"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
+ t.integer "language_id"
+ t.index ["language_id"], name: "index_courses_on_language_id"
t.index ["unit_id"], name: "index_courses_on_unit_id"
end
@@ -433,7 +450,7 @@
t.string "preferred_language", default: "tr"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
- t.datetime "password_changed_at", default: -> { "now()" }, null: false
+ t.datetime "password_changed_at", default: -> { "CURRENT_TIMESTAMP" }, null: false
t.integer "articles_count"
t.integer "projects_count"
t.string "slug"
@@ -456,6 +473,8 @@
add_foreign_key "academic_calendars", "calendar_types"
add_foreign_key "addresses", "districts"
add_foreign_key "addresses", "users"
+ add_foreign_key "agendas", "agenda_types"
+ add_foreign_key "agendas", "units"
add_foreign_key "articles", "users"
add_foreign_key "calendar_events", "academic_calendars"
add_foreign_key "calendar_events", "calendar_titles"
diff --git a/db/seeds.rb b/db/seeds.rb
index 2c47b5407..828f0b058 100644
--- a/db/seeds.rb
+++ b/db/seeds.rb
@@ -54,6 +54,9 @@
# Import Academic Staff from YOKSIS
Rake::Task['yoksis:fetch_academic_staff'].invoke
+# Create UnitType for Committee/Commission
+UnitType.create(name: 'Kurul / Komisyon', code: 200)
+
# Produced data for beta environment
if Rails.env.beta? || Rails.env.development?
Dir[Rails.root.join('db', 'beta_seed', '*.rb')].sort.each do |seed|
diff --git a/docs/product/.gitignore b/docs/product/.gitignore
deleted file mode 100644
index 0a10022bc..000000000
--- a/docs/product/.gitignore
+++ /dev/null
@@ -1,8 +0,0 @@
-*.pdf
-*.PDF
-*.docx
-*.DOCX
-*.doc
-*.DOC
-*.zip
-*.ZIP
diff --git a/lib/tasks/post_deploy/create_unit_type_for_committee.rake b/lib/tasks/post_deploy/create_unit_type_for_committee.rake
new file mode 100644
index 000000000..24eb77a4f
--- /dev/null
+++ b/lib/tasks/post_deploy/create_unit_type_for_committee.rake
@@ -0,0 +1,5 @@
+# frozen_string_literal: true
+
+task create_unit_type_for_committee: :environment do
+ UnitType.create(name: 'Kurul / Komisyon', code: 200)
+end
diff --git a/test/controllers/accounts/duties_controller_test.rb b/test/controllers/accounts/duties_controller_test.rb
new file mode 100644
index 000000000..44c6de592
--- /dev/null
+++ b/test/controllers/accounts/duties_controller_test.rb
@@ -0,0 +1,70 @@
+# frozen_string_literal: true
+
+require 'test_helper'
+
+module Accounts
+ class DutiesController < ActionDispatch::IntegrationTest
+ setup do
+ @user = users(:serhat)
+ @unit = units(:cbu)
+ sign_in @user
+ end
+
+ test 'should get new' do
+ get new_user_duty_path(@user)
+ assert_response :success
+ end
+
+ test 'should create duty' do
+ assert_difference('@user.duties.count') do
+ post user_duties_path(@user), params: {
+ duty: {
+ employee_id: employees(:serhat_active).id, unit_id: @unit.id, temporary: true, start_date: '01.09.2018'
+ }
+ }
+ end
+
+ duty = @user.duties.last
+
+ assert_equal employees(:serhat_active), duty.employee
+ assert_equal @unit, duty.unit
+ assert_equal true, duty.temporary
+
+ assert_redirected_to user_path(@user)
+ assert_equal translate('.create.success'), flash[:notice]
+ end
+
+ test 'should update duty' do
+ duty = @user.duties.first
+
+ patch user_duty_path(@user, duty), params: {
+ duty: {
+ unit_id: @unit.id, temporary: true
+ }
+ }
+
+ duty.reload
+
+ assert_equal @unit, duty.unit
+ assert_equal true, duty.temporary
+
+ assert_redirected_to user_path(@user)
+ assert_equal translate('.update.success'), flash[:notice]
+ end
+
+ test 'should destroy duty' do
+ assert_difference('@user.duties.count', -1) do
+ delete user_duty_path(@user, @user.duties.last)
+ end
+
+ assert_redirected_to user_path(@user)
+ assert_equal translate('.destroy.success'), flash[:notice]
+ end
+
+ private
+
+ def translate(key)
+ t("account.duties#{key}")
+ end
+ end
+end
diff --git a/test/controllers/accounts/employees_controller_test.rb b/test/controllers/accounts/employees_controller_test.rb
new file mode 100644
index 000000000..31f7c9735
--- /dev/null
+++ b/test/controllers/accounts/employees_controller_test.rb
@@ -0,0 +1,69 @@
+# frozen_string_literal: true
+
+require 'test_helper'
+
+module Accounts
+ class EmployeesController < ActionDispatch::IntegrationTest
+ setup do
+ @user = users(:serhat)
+ @title = titles(:chief)
+ sign_in @user
+ end
+
+ test 'should get new' do
+ get new_user_employee_path(@user)
+ assert_response :success
+ end
+
+ test 'should create employee' do
+ assert_difference('@user.employees.count') do
+ post user_employees_path(@user), params: {
+ employee: {
+ title_id: @title.id, active: false
+ }
+ }
+ end
+
+ employee = @user.employees.last
+
+ assert_equal @title, employee.title
+ assert_equal false, employee.active
+
+ assert_redirected_to user_path(@user)
+ assert_equal translate('.create.success'), flash[:notice]
+ end
+
+ test 'should update employee' do
+ employee = @user.employees.first
+
+ patch user_employee_path(@user, employee), params: {
+ employee: {
+ title_id: @title.id, active: false
+ }
+ }
+
+ employee.reload
+
+ assert_equal @title, employee.title
+ assert_equal false, employee.active
+
+ assert_redirected_to user_path(@user)
+ assert_equal translate('.update.success'), flash[:notice]
+ end
+
+ test 'should destroy employee' do
+ assert_difference('@user.employees.count', -1) do
+ delete user_employee_path(@user, @user.employees.last)
+ end
+
+ assert_redirected_to user_path(@user)
+ assert_equal translate('.destroy.success'), flash[:notice]
+ end
+
+ private
+
+ def translate(key)
+ t("account.employees#{key}")
+ end
+ end
+end
diff --git a/test/controllers/accounts/positions_controller_test.rb b/test/controllers/accounts/positions_controller_test.rb
new file mode 100644
index 000000000..296406b33
--- /dev/null
+++ b/test/controllers/accounts/positions_controller_test.rb
@@ -0,0 +1,71 @@
+# frozen_string_literal: true
+
+require 'test_helper'
+
+module Accounts
+ class PositionsController < ActionDispatch::IntegrationTest
+ setup do
+ @user = users(:serhat)
+ @administrative_function = administrative_functions(:yok_member)
+ @duty = duties(:baum)
+ sign_in @user
+ end
+
+ test 'should get new' do
+ get new_user_position_path(@user)
+ assert_response :success
+ end
+
+ test 'should create position' do
+ assert_difference('@user.positions.count') do
+ post user_positions_path(@user), params: {
+ position: {
+ administrative_function_id: @administrative_function.id, duty_id: @duty.id,
+ start_date: '01.01.2013', end_date: '01.01.2015'
+ }
+ }
+ end
+
+ position = @user.positions.last
+
+ assert_equal @administrative_function, position.administrative_function
+ assert_equal @duty, position.duty
+
+ assert_redirected_to user_path(@user)
+ assert_equal translate('.create.success'), flash[:notice]
+ end
+
+ test 'should update position' do
+ position = @user.positions.first
+
+ patch user_position_path(@user, position), params: {
+ position: {
+ duty_id: @duty.id, administrative_function_id: @administrative_function.id
+ }
+ }
+
+ position.reload
+
+ assert_equal @duty, position.duty
+ assert_equal @administrative_function, position.administrative_function
+
+ assert_redirected_to user_path(@user)
+ assert_equal translate('.update.success'), flash[:notice]
+ end
+
+ test 'should destroy position' do
+ assert_difference('@user.positions.count', -1) do
+ delete user_position_path(@user, @user.positions.last)
+ end
+
+ assert_redirected_to user_path(@user)
+ assert_equal translate('.destroy.success'), flash[:notice]
+ end
+
+ private
+
+ def translate(key)
+ t("account.positions#{key}")
+ end
+ end
+end
diff --git a/test/controllers/committee/agenda_types_controller_test.rb b/test/controllers/committee/agenda_types_controller_test.rb
new file mode 100644
index 000000000..98e78f13e
--- /dev/null
+++ b/test/controllers/committee/agenda_types_controller_test.rb
@@ -0,0 +1,72 @@
+# frozen_string_literal: true
+
+require 'test_helper'
+
+module Committee
+ class AgendaTypesControllerTest < ActionDispatch::IntegrationTest
+ setup do
+ sign_in users(:serhat)
+ @agenda_type = agenda_types(:one)
+ end
+
+ test 'should get index' do
+ get agenda_types_path
+ assert_response :success
+ assert_select '#add-button', translate('.index.new_agenda_type_link')
+ end
+
+ test 'should get new' do
+ get new_agenda_type_path
+ assert_response :success
+ end
+
+ test 'should create agenda type' do
+ assert_difference('AgendaType.count') do
+ post agenda_types_path, params: {
+ agenda_type: { name: 'Yeni Müfredat Oluşturma' }
+ }
+ end
+
+ agenda_type = AgendaType.last
+
+ assert_equal 'Yeni Müfredat Oluşturma', agenda_type.name
+ assert_redirected_to agenda_types_path
+ assert_equal translate('.create.success'), flash[:notice]
+ end
+
+ test 'should get edit' do
+ get edit_agenda_type_path(@agenda_type)
+ assert_response :success
+ assert_select '.card-header strong', translate('.edit.form_title')
+ end
+
+ test 'should update agenda type' do
+ agenda_type = AgendaType.last
+ patch agenda_type_path(agenda_type),
+ params: {
+ agenda_type: { name: 'Yeni Müfredat' }
+ }
+
+ agenda_type.reload
+
+ assert_equal 'Yeni Müfredat', agenda_type.name
+ assert_redirected_to agenda_types_path
+ assert_equal translate('.update.success'), flash[:notice]
+ end
+
+ test 'should destroy agenda type' do
+ assert_difference('AgendaType.count', -1) do
+ delete agenda_type_path(AgendaType.last)
+ end
+
+ assert_redirected_to agenda_types_path
+ assert_equal translate('.destroy.success'), flash[:notice]
+ end
+
+ private
+
+ def translate(key)
+ t("committee.agenda_types#{key}")
+ end
+ end
+end
diff --git a/test/controllers/committee/agendas_controller_test.rb b/test/controllers/committee/agendas_controller_test.rb
new file mode 100644
index 000000000..03ca63f05
--- /dev/null
+++ b/test/controllers/committee/agendas_controller_test.rb
@@ -0,0 +1,88 @@
+# frozen_string_literal: true
+
+require 'test_helper'
+
+module Committee
+ class AgendasControllerTest < ActionDispatch::IntegrationTest
+ setup do
+ sign_in users(:serhat)
+ @agenda = agendas(:one)
+ @committee = units(:mühendislik_fakültesi_yönetim_kurulu)
+ end
+
+ test 'should get index' do
+ get committee_agendas_path(@committee)
+ assert_response :success
+ assert_select '#add-button', translate('.index.new_agenda_link')
+ end
+
+ test 'should get new' do
+ get new_committee_agenda_path(@committee)
+ assert_response :success
+ end
+
+ test 'should create agenda' do
+ assert_difference('Agenda.count') do
+ post committee_agendas_path(@committee),
+ params: {
+ agenda: {
+ description: 'Test Agenda', status: :recent,
+ unit_id: units(:mühendislik_fakültesi_yönetim_kurulu).id,
+ agenda_type_id: agenda_types(:two).id
+ }
+ }
+ end
+
+ agenda = Agenda.last
+
+ assert_equal 'Test Agenda', agenda.description
+ assert_equal units(:mühendislik_fakültesi_yönetim_kurulu).id, agenda.unit.id
+ assert_equal 'recent', agenda.status
+ assert_equal agenda_types(:two).id, agenda.agenda_type_id
+ assert_redirected_to committee_agendas_path(@committee)
+ assert_equal translate('.create.success'), flash[:notice]
+ end
+
+ test 'should get edit' do
+ get edit_committee_agenda_path(@committee, @agenda)
+ assert_response :success
+ assert_select '.card-header strong', translate('.edit.form_title')
+ end
+
+ test 'should update agenda' do
+ agenda = Agenda.last
+ patch committee_agenda_path(@committee, agenda),
+ params: {
+ agenda: {
+ description: 'Test Agenda Update', status: :recent,
+ unit_id: units(:mühendislik_fakültesi_yönetim_kurulu).id,
+ agenda_type_id: agenda_types(:one).id
+ }
+ }
+
+ agenda.reload
+
+ assert_equal 'Test Agenda Update', agenda.description
+ assert_equal units(:mühendislik_fakültesi_yönetim_kurulu).id, agenda.unit_id
+ assert_equal 'recent', agenda.status
+ assert_equal agenda_types(:one).id, agenda.agenda_type_id
+ assert_redirected_to committee_agendas_path(@committee)
+ assert_equal translate('.update.success'), flash[:notice]
+ end
+
+ test 'should destroy agenda type' do
+ assert_difference('Agenda.count', -1) do
+ delete committee_agenda_path(@committee, Agenda.last)
+ end
+
+ assert_redirected_to committee_agendas_path(@committee)
+ assert_equal translate('.destroy.success'), flash[:notice]
+ end
+
+ private
+
+ def translate(key)
+ t("committee.agendas#{key}")
+ end
+ end
+end
diff --git a/test/controllers/curriculum/courses_controller_test.rb b/test/controllers/curriculum/courses_controller_test.rb
index 57c99d61e..9bd7fc801 100644
--- a/test/controllers/curriculum/courses_controller_test.rb
+++ b/test/controllers/curriculum/courses_controller_test.rb
@@ -13,6 +13,8 @@ class CoursesControllerTest < ActionDispatch::IntegrationTest
get courses_path
assert_response :success
assert_select '#add-button', translate('.index.add_new_course')
+ assert_select '#collapseSmartSearchLink', t('smart_search')
+ assert_select '#collapseDetailedSearchLink', t('detailed_search')
end
test 'should get show' do
@@ -29,17 +31,18 @@ class CoursesControllerTest < ActionDispatch::IntegrationTest
assert_difference('Course.count') do
post courses_path, params: {
course: {
- name: 'Test Course', code: 'TTC', theoric: 3, practice: 0,
- laboratory: 0, unit_id: units(:omu).id, education_type: :undergraduate,
- language: 'Türkçe', status: :active
+ name: 'Test Controller Course', code: 'TTC', theoric: 3, practice: 0,
+ laboratory: 0, unit_id: units(:omu).id, program_type: :undergraduate,
+ language_id: languages(:turkce).id, status: :active
}
}
end
- course = Course.unscope(:order).last
+ course = Course.last
- assert_equal 'Test Course', course.name
+ assert_equal 'Test Controller Course', course.name
assert_equal 3.0, course.credit.to_f
+ assert_equal 'undergraduate', course.program_type
assert_equal units(:omu), course.unit
assert course.active?
assert_redirected_to courses_path
@@ -53,7 +56,7 @@ class CoursesControllerTest < ActionDispatch::IntegrationTest
end
test 'should update course' do
- course = Course.unscope(:order).last
+ course = Course.last
patch course_path(course), params: {
course: {
name: 'Test Course Update', code: 'TTCU', theoric: 4, practice: 2
diff --git a/test/fixtures/agenda_types.yml b/test/fixtures/agenda_types.yml
new file mode 100644
index 000000000..7b9e904ec
--- /dev/null
+++ b/test/fixtures/agenda_types.yml
@@ -0,0 +1,8 @@
+one:
+ name: Ders Ekleme
+
+two:
+ name: Müfredat Değişikliği
+
+three:
+ name: Diğer
diff --git a/test/fixtures/agendas.yml b/test/fixtures/agendas.yml
new file mode 100644
index 000000000..8eb96668a
--- /dev/null
+++ b/test/fixtures/agendas.yml
@@ -0,0 +1,11 @@
+one:
+ description: Gündemdeki maddelerin okunması ve bir önceki fakülte yönetim kurulu kararlarının onaylanması.
+ unit: mühendislik_fakültesi_yönetim_kurulu
+ agenda_type: three
+ status: newly
+
+two:
+ description: 2018-2019 Eğitim öğretim yılı danışmanlık hizmetleri verecek personelin belirlenmesi konusunun görülmesi.
+ unit: mühendislik_fakültesi_yönetim_kurulu
+ agenda_type: three
+ status: newly
diff --git a/test/fixtures/courses.yml b/test/fixtures/courses.yml
index bf12389ad..5bb58419b 100644
--- a/test/fixtures/courses.yml
+++ b/test/fixtures/courses.yml
@@ -6,10 +6,9 @@ ati:
credit: 2
laboratory: 0
unit: omu
- education_type: :undergraduate
- language: Türkçe
- status: :active
- abrogated_date: nil
+ program_type: undergraduate
+ language: turkce
+ status: active
ydi:
name: İngilizce
@@ -19,10 +18,9 @@ ydi:
credit: 2
laboratory: 1
unit: omu
- education_type: :undergraduate
- language: İngilizce
- status: :active
- abrogated_date: nil
+ program_type: undergraduate
+ language: ingilizce
+ status: active
test:
name: 'Test Course'
@@ -32,10 +30,9 @@ test:
credit: 3
laboratory: 0
unit: omu
- education_type: :undergraduate
- language: Türkçe
- status: :active
- abrogated_date: nil
+ program_type: undergraduate
+ language: turkce
+ status: active
fi_tarihi:
name: 'Fi Tarihi'
@@ -45,7 +42,6 @@ fi_tarihi:
credit: 2
laboratory: 0
unit: omu
- education_type: :undergraduate
- language: Türkçe
- status: :abrogated
- abrogated_date: 15.05.2018
\ No newline at end of file
+ program_type: undergraduate
+ language: turkce
+ status: passive
\ No newline at end of file
diff --git a/test/fixtures/positions.yml b/test/fixtures/positions.yml
index f84c1466d..781c80cdd 100644
--- a/test/fixtures/positions.yml
+++ b/test/fixtures/positions.yml
@@ -1,7 +1,7 @@
baum_dean:
administrative_function: dean
duty: baum
- start_date: 01.01.2017
+ start_date: 01.01.2016
end_date: <%= Time.zone.now - 2.years %>
omu_rector:
administrative_function: rector
diff --git a/test/fixtures/units.yml b/test/fixtures/units.yml
index d01d5f9f2..43e32d69f 100644
--- a/test/fixtures/units.yml
+++ b/test/fixtures/units.yml
@@ -54,3 +54,15 @@ baum:
unit_status: active
unit_instruction_language: turkish
unit_instruction_type: normal_education
+
+mühendislik_fakültesi_yönetim_kurulu:
+ name: Mühendislik Fakültesi Yönetim Kurulu
+ yoksis_id:
+ detsis_id: 96980227
+ founded_at:
+ duration:
+ unit_type:
+ district: atakum
+ unit_status: active
+ unit_instruction_language:
+ unit_instruction_type:
\ No newline at end of file
diff --git a/test/helpers/enum_i18n_helper_test.rb b/test/helpers/enum_i18n_helper_test.rb
index 945d65003..7406e4ad0 100644
--- a/test/helpers/enum_i18n_helper_test.rb
+++ b/test/helpers/enum_i18n_helper_test.rb
@@ -5,7 +5,7 @@
class EnumI18nHelperTest < ActionView::TestCase
test 'enum_options_for_select method' do
assert_equal enum_options_for_select(Course, :status), [
- %w[Pasif passive], %w[Aktif active], ['Yürürlükten Kaldırılmış', 'abrogated']
+ %w[Pasif passive], %w[Aktif active]
]
end
end
diff --git a/test/models/committees/agenda_test.rb b/test/models/committees/agenda_test.rb
new file mode 100644
index 000000000..ab38e0394
--- /dev/null
+++ b/test/models/committees/agenda_test.rb
@@ -0,0 +1,27 @@
+# frozen_string_literal: true
+
+require 'test_helper'
+
+class AgendaTest < ActiveSupport::TestCase
+ # relations
+ %i[
+ unit
+ agenda_type
+ ].each do |property|
+ test "a agenda can communicate with #{property}" do
+ assert agendas(:one).send(property)
+ end
+ end
+
+ # validations: presence
+ %i[
+ description
+ status
+ ].each do |property|
+ test "presence validations for #{property} of a agenda" do
+ agendas(:one).send("#{property}=", nil)
+ assert_not agendas(:one).valid?
+ assert_not_empty agendas(:one).errors[property]
+ end
+ end
+end
diff --git a/test/models/committees/agenda_type_test.rb b/test/models/committees/agenda_type_test.rb
new file mode 100644
index 000000000..6af7898e2
--- /dev/null
+++ b/test/models/committees/agenda_type_test.rb
@@ -0,0 +1,12 @@
+# frozen_string_literal: true
+
+require 'test_helper'
+
+class AgendaTypeTest < ActiveSupport::TestCase
+ # validations: presence
+ test 'should not save agenda_type without name' do
+ agenda_types(:one).name = nil
+ assert_not agenda_types(:one).valid?
+ assert_not_empty agenda_types(:one).errors[:name]
+ end
+end
diff --git a/test/models/curriculums/course_test.rb b/test/models/curriculums/course_test.rb
index 1b5567404..6d30e2740 100644
--- a/test/models/curriculums/course_test.rb
+++ b/test/models/curriculums/course_test.rb
@@ -3,71 +3,69 @@
require 'test_helper'
class CourseTest < ActiveSupport::TestCase
- test 'course can communicate with unit' do
- assert courses(:ati).unit
+ setup do
+ @course = courses(:test)
+ end
+
+ %i[
+ unit
+ language
+ ].each do |property|
+ test "course can communicate with #{property}" do
+ assert @course.send(property)
+ end
end
# validations: presence
%i[
code
- education_type
+ program_type
laboratory
language
name
practice
status
theoric
+ unit
].each do |property|
test "presence validations for #{property} of a course" do
- courses(:ati).send("#{property}=", nil)
- assert_not courses(:ati).valid?
- assert_not_empty courses(:ati).errors[property]
+ @course.send("#{property}=", nil)
+ assert_not @course.valid?
+ assert_not_empty @course.errors[property]
end
end
- test 'presence validations for abrogated_date of a course' do
- courses(:fi_tarihi).abrogated_date = nil
- assert_not courses(:fi_tarihi).valid?
- assert_not_empty courses(:fi_tarihi).errors[:abrogated_date]
- end
-
# validations: uniqueness
test 'uniqueness validations for code of a course' do
- fake = courses(:ati).dup
+ fake = @course.dup
assert_not fake.valid?
assert_not_empty fake.errors[:code]
end
test 'uniqueness validations for name of a course' do
- fake = courses(:ati).dup
+ fake = @course.dup
+ fake.code = 'TB01'
assert_not fake.valid?
- fake.code = 'TEST001'
- assert fake.valid?
+ assert_not_empty fake.errors[:name]
end
# callbacks
test 'callbacks must titlecase the name for a course' do
- course = courses(:test).dup
+ course = @course.dup
course.update(code: 'DD101', name: 'deNEme dErSi')
assert_equal course.name, 'Deneme Dersi'
end
- test 'callbacks must set value the abrogated date for a course' do
- course = courses(:test).dup
- course.update(code: 'DD101', status: :abrogated)
- assert_equal course.abrogated_date, Time.zone.today
- end
-
test 'callbacks must set value the credit for a course' do
- course = courses(:test).dup
+ course = @course.dup
course.update(code: 'DD101', theoric: 10, practice: 3)
assert_equal course.credit, 11.5
end
# enums
{
- status: { passive: 0, active: 1, abrogated: 2 },
- education_type: { undergraduate: 0, master: 1, doctoral: 2 }
+ status: { passive: 0, active: 1 },
+ program_type: { associate: 0, undergraduate: 1, master: 2, doctoral: 3 }
}.each do |property, hash|
hash.each do |key, value|
test "have a #{key} value of #{property} enum" do
diff --git a/test/models/language_test.rb b/test/models/language_test.rb
index 5453f236b..3a93fbefd 100644
--- a/test/models/language_test.rb
+++ b/test/models/language_test.rb
@@ -7,6 +7,10 @@ class LanguageTest < ActiveSupport::TestCase
@language = languages(:turkce)
end
+ test 'langugage can communicate with courses' do
+ assert @language.courses
+ end
+
# validations: presence
%i[
name