diff --git a/.circleci/config.yml b/.circleci/config.yml index eb54def91..2b9f143fa 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -32,7 +32,7 @@ repository: &repository # build image ruby_2_6: &ruby_2_6 docker: - - image: circleci/ruby:2.6.1-node-browsers + - image: circleci/ruby:2.6.2-node-browsers <<: *rails_environment - image: circleci/postgres:11.1-alpine <<: *postgres_environment diff --git a/.env.sample b/.env.sample deleted file mode 100644 index ad8def178..000000000 --- a/.env.sample +++ /dev/null @@ -1,3 +0,0 @@ -RDS_USERNAME=DB_USERNAME -RDS_PASSWORD=DB_PASSWORD -RDS_HOSTNAME=DB_HOST \ No newline at end of file diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 309bb82b5..594b2dcfc 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -40,7 +40,7 @@ Organizasyon sırları kurumsal bir `keepass` hesabında tutulmaktadır. Bu sır - Master.key ve API Anahtarları -Proje sırları `credentials.yml.enc` dosyasında tutulmaktadır. Bu dosyaya erişim bilgilerini [sistem grubu](https://github.com/orgs/omu/teams/ops)'ndan veya `keepass` üzerinden edindikten sonra RAILS_MASTER_KEY isimli bir ortam değişkeni ile anahtarı sisteminize tanımlayın. +Proje sırları `credentials.yml.enc` dosyasında tutulmaktadır. Bu dosyaya erişim bilgilerini [sistem grubu](https://github.com/orgs/omu/teams/ops)'ndan veya `keepass` üzerinden edindikten sonra RAILS_MASTER_KEY ve TENANT_MASTER_KEY ortam değişkenlerini sisteminize tanımlayın. - VPN diff --git a/.gitignore b/.gitignore index 82faf21d9..cb63c6400 100644 --- a/.gitignore +++ b/.gitignore @@ -4,8 +4,9 @@ # or operating system, you probably want to add a global ignore instead: # git config --global core.excludesfile '~/.gitignore_global' -# Ignore bundler config. +# Ignore bundler config and vendor directory /.bundle +/vendor/* # Ignore the default SQLite database. /db/*.sqlite3 @@ -16,25 +17,20 @@ /tmp/* !/log/.keep !/tmp/.keep +.byebug_history # Ignore uploaded files in development. /storage/* !/storage/.keep -/public/assets -.byebug_history - -# Ignore master key for decrypting credentials and more. -/config/master.key +# Ignore yarn dependencies and assets /public/packs /public/packs-test /node_modules /yarn-error.log yarn-debug.log* .yarn-integrity - -# Ignore local bundler directory -/vendor/* +/public/assets # Ignore misc. /bin/dokku @@ -44,8 +40,9 @@ yarn-debug.log* .envrc /.local/ -# Ignore dokku deploy key +# Ignore sensitives config/deploy_key +/config/master.key # Ignore auto-generated PDFs of markdown files .pdf diff --git a/.hound.yml b/.hound.yml deleted file mode 100644 index f534df8c6..000000000 --- a/.hound.yml +++ /dev/null @@ -1,2 +0,0 @@ -rubocop: - config_file: .rubocop.yml diff --git a/.markdownlintrc b/.markdownlintrc new file mode 100644 index 000000000..d0f2c22d0 --- /dev/null +++ b/.markdownlintrc @@ -0,0 +1,19 @@ +{ + "default": true, + "MD003": { + "style": "setext_with_atx" + }, + "MD004": { + "style": "sublist" + }, + "MD013": { + "code_blocks": false, + "tables": false, + }, + "MD024": { + "allow_different_nesting": true + }, + "MD029": { + "style": "ordered" + } +} diff --git a/.rubocop.yml b/.rubocop.yml index c94266d0c..ffe2d1117 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -4,14 +4,15 @@ Style/AsciiComments: Enabled: false Style/Lambda: Enabled: false +Style/FormatStringToken: + EnforcedStyle: template Documentation: Enabled: false Rails/UnknownEnv: Environments: - - production - development + - production - test - - beta Metrics/LineLength: Max: 120 Exclude: @@ -19,7 +20,7 @@ Metrics/LineLength: Metrics/BlockLength: Exclude: - config/routes/**/* - - lib/tasks/**/*.rake # Won't fix + - lib/tasks/**/*.rake Metrics/ClassLength: Exclude: - test/**/*.rb @@ -27,14 +28,14 @@ AllCops: TargetRubyVersion: 2.6 # Do not exclude files from ALL COPS unless it's really necessary! Exclude: - - app/controllers/concerns/reference_resource.rb + - app/controllers/concerns/yoksis_resource.rb - bin/**/* - - vendor/bundle/**/* - - node_modules/**/* - db/schema.rb - db/migrate/*.rb - config/initializers/simple_form.rb - config/initializers/simple_form_bootstrap.rb - config/environments/*.rb - config/routes.rb + - node_modules/**/* - Vagrantfile + - vendor/bundle/**/* diff --git a/.ruby-version b/.ruby-version index 6a6a3d8e3..097a15a2a 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.6.1 +2.6.2 diff --git a/Dockerfile b/Dockerfile index 7de0a2516..fd7b2cc47 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,16 +1,19 @@ -FROM ondokuz/ruby-stretch:1.16.1 +FROM ondokuz/ruby-stretch:1.17.1 ENV PATH=/app/bin:$PATH ARG NOKUL_TENANT=omu ENV NOKUL_TENANT=$NOKUL_TENANT -ARG RAILS_ENV=beta +ARG RAILS_ENV=development ENV RAILS_ENV=$RAILS_ENV ARG RAILS_MASTER_KEY ENV RAILS_MASTER_KEY=$RAILS_MASTER_KEY +ARG TENANT_MASTER_KEY +ENV TENANT_MASTER_KEY=$TENANT_MASTER_KEY + ENV RAILS_SERVE_STATIC_FILES=enabled ENV RAILS_LOG_TO_STDOUT=enabled diff --git a/Gemfile b/Gemfile index 78df86eaa..d062f24cb 100644 --- a/Gemfile +++ b/Gemfile @@ -39,7 +39,7 @@ gem 'webpacker' gem 'chartkick' gem 'cocoon' gem 'font-awesome-rails' -gem 'groupdate' # for chartkick +gem 'groupdate' gem 'pagy' gem 'simple_form' gem 'wicked_pdf' diff --git a/Gemfile.lock b/Gemfile.lock index 389d5207b..2768aba95 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -8,7 +8,7 @@ GIT GIT remote: https://github.com/rails/rails.git - revision: 43fc7b476b483a89dacf9964ccf288f6bc6e1595 + revision: efb706daad0e2e1039c6abb4879c837ef8bf4d10 specs: actioncable (6.0.0.beta3) actionpack (= 6.0.0.beta3) @@ -63,7 +63,7 @@ GIT i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) - zeitwerk (~> 1.3, >= 1.3.3) + zeitwerk (~> 1.4) rails (6.0.0.beta3) actioncable (= 6.0.0.beta3) actionmailbox (= 6.0.0.beta3) @@ -98,9 +98,9 @@ GIT GIT remote: https://github.com/rollbar/rollbar-gem.git - revision: a026a7b0fb942e52a892e99a574cc796b7cbd52e + revision: 83ef1acca2b0b1d1b74ff8ef29435ca82e8ca1d6 specs: - rollbar (2.19.2) + rollbar (2.19.3) multi_json PATH @@ -133,18 +133,17 @@ GEM io-like (~> 0.3.0) ast (2.4.0) aws-eventstream (1.0.2) - aws-partitions (1.144.0) - aws-sdk-core (3.47.0) + aws-partitions (1.145.0) + aws-sdk-core (3.48.2) aws-eventstream (~> 1.0, >= 1.0.2) aws-partitions (~> 1.0) aws-sigv4 (~> 1.1) - http-2 (~> 0.10) jmespath (~> 1.0) - aws-sdk-kms (1.14.0) - aws-sdk-core (~> 3, >= 3.47.0) + aws-sdk-kms (1.16.0) + aws-sdk-core (~> 3, >= 3.48.2) aws-sigv4 (~> 1.1) - aws-sdk-s3 (1.32.0) - aws-sdk-core (~> 3, >= 3.47.0) + aws-sdk-s3 (1.34.0) + aws-sdk-core (~> 3, >= 3.48.2) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.0) aws-sigv4 (1.1.0) @@ -161,13 +160,13 @@ GEM bindex (0.5.0) bootsnap (1.4.1) msgpack (~> 1.0) - brakeman (4.4.0) + brakeman (4.5.0) builder (3.2.3) bundler-audit (0.6.1) bundler (>= 1.2.0, < 3) thor (~> 0.18) - byebug (11.0.0) - capybara (3.14.0) + byebug (11.0.1) + capybara (3.15.0) addressable mini_mime (>= 0.1.3) nokogiri (~> 1.8) @@ -233,7 +232,6 @@ GEM activesupport (>= 4.2) hashdiff (0.3.8) html_tokenizer (0.0.7) - http-2 (0.10.1) i18n (1.6.0) concurrent-ruby (~> 1.0) image_processing (1.8.0) @@ -278,9 +276,9 @@ GEM nokogiri (1.10.1) mini_portile2 (~> 2.4.0) orm_adapter (0.5.0) - pagy (2.1.1) + pagy (2.1.3) parallel (1.14.0) - parser (2.6.0.0) + parser (2.6.2.0) ast (~> 2.4.0) pg (1.1.4) pg_search (2.1.4) @@ -288,7 +286,6 @@ GEM activesupport (>= 4.2) pghero (2.2.0) activerecord - powerpack (0.1.2) pry (0.12.2) coderay (~> 1.1.0) method_source (~> 0.9.0) @@ -296,7 +293,7 @@ GEM pry (>= 0.10.4) psych (3.1.0) public_suffix (3.0.3) - puma (3.12.0) + puma (3.12.1) pwned (1.2.1) rack (2.0.6) rack-attack (5.4.2) @@ -327,15 +324,14 @@ GEM responders (2.4.1) actionpack (>= 4.2.0, < 6.0) railties (>= 4.2.0, < 6.0) - rubocop (0.65.0) + rubocop (0.66.0) jaro_winkler (~> 1.5.1) parallel (~> 1.10) parser (>= 2.5, != 2.5.1.1) - powerpack (~> 0.1) psych (>= 3.1.0) rainbow (>= 2.2.2, < 4.0) ruby-progressbar (~> 1.7) - unicode-display_width (~> 1.4.0) + unicode-display_width (>= 1.4.0, < 1.6) ruby-progressbar (1.10.0) ruby-vips (2.0.13) ffi (~> 1.9) @@ -394,7 +390,7 @@ GEM unf (0.1.4) unf_ext unf_ext (0.0.7.5) - unicode-display_width (1.4.1) + unicode-display_width (1.5.0) uniform_notifier (1.12.1) warden (1.2.8) rack (>= 2.0.6) @@ -409,10 +405,11 @@ GEM websocket-driver (0.7.0) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.3) - wicked_pdf (1.1.0) + wicked_pdf (1.2.1) + activesupport xpath (3.2.0) nokogiri (~> 1.8) - zeitwerk (1.3.3) + zeitwerk (1.4.0) PLATFORMS ruby @@ -478,7 +475,7 @@ DEPENDENCIES wicked_pdf RUBY VERSION - ruby 2.6.1p33 + ruby 2.6.2p47 BUNDLED WITH 2.0.1 diff --git a/app.json b/app.json index 4cc7ac0db..e5ca9bfda 100644 --- a/app.json +++ b/app.json @@ -1,10 +1,13 @@ { "name": "nokul", + "slug": "nokul", "description": "Nokul, nitelikli okul universiteler icin ogrenci ve personel otomasyonudur.", "keywords": [ "dokku", "rails" ], + "repository": "https://github.com/omu/nokul", + "version": "0.5.8", "scripts": { "dokku": { "predeploy": "bin/plugdo bundle install -j4 --path /app/vendor/bundle --without development:test && bundle exec rails assets:precompile", diff --git a/app/controllers/admin/yoksis_dashboard_controller.rb b/app/controllers/admin/yoksis_dashboard_controller.rb deleted file mode 100644 index 3e79f5cda..000000000 --- a/app/controllers/admin/yoksis_dashboard_controller.rb +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true - -module Admin - class YoksisDashboardController < ApplicationController - def index; end - end -end diff --git a/app/controllers/calendar_management/calendar_event_types_controller.rb b/app/controllers/calendar_management/calendar_event_types_controller.rb index 46166c3ac..2aca19e0d 100644 --- a/app/controllers/calendar_management/calendar_event_types_controller.rb +++ b/app/controllers/calendar_management/calendar_event_types_controller.rb @@ -16,14 +16,14 @@ def new def create @calendar_event_type = CalendarEventType.new(calendar_event_type_params) - @calendar_event_type.save ? redirect_to(index_path, notice: t('.success')) : render(:new) + @calendar_event_type.save ? redirect_to(:calendar_event_types, notice: t('.success')) : render(:new) end def edit; end def update if @calendar_event_type.update(calendar_event_type_params) - redirect_to(index_path, notice: t('.success')) + redirect_to(:calendar_event_types, notice: t('.success')) else render(:edit) end @@ -31,18 +31,14 @@ def update def destroy if @calendar_event_type.destroy - redirect_to(index_path, notice: t('.success')) + redirect_to(:calendar_event_types, notice: t('.success')) else - redirect_to(index_path, alert: t('.warning')) + redirect_to(:calendar_event_types, alert: t('.warning')) end end private - def index_path - %i[calendar_management calendar_event_types] - end - def set_calendar_event_type @calendar_event_type = CalendarEventType.find(params[:id]) end diff --git a/app/controllers/calendar_management/calendars_controller.rb b/app/controllers/calendar_management/calendars_controller.rb index 777884551..9dc245831 100644 --- a/app/controllers/calendar_management/calendars_controller.rb +++ b/app/controllers/calendar_management/calendars_controller.rb @@ -25,20 +25,20 @@ def new def create @calendar = Calendar.new(calendar_params) - @calendar.save ? redirect_to(index_path, notice: t('.success')) : render(:new) + @calendar.save ? redirect_to(:calendars, notice: t('.success')) : render(:new) end def edit; end def update - @calendar.update(calendar_params) ? redirect_to(index_path, notice: t('.success')) : render(:edit) + @calendar.update(calendar_params) ? redirect_to(:calendars, notice: t('.success')) : render(:edit) end def destroy if @calendar.destroy - redirect_to(index_path, notice: t('.success')) + redirect_to(:calendars, notice: t('.success')) else - redirect_to(index_path, alert: t('.warning')) + redirect_to(:calendars, alert: t('.warning')) end end @@ -46,11 +46,11 @@ def duplicate @calendar = Calendar.find(params[:calendar_id]) @duplicate_record = DuplicateService.new(@calendar, 'name').duplicate - redirect_to(index_path, alert: t('.warning')) && return unless @duplicate_record + redirect_to(:calendars, alert: t('.warning')) && return unless @duplicate_record AcademicCalendars::DuplicateEventsService.new(@calendar, @duplicate_record) - redirect_to([:edit, :calendar_management, @duplicate_record], notice: t('.success')) + redirect_to([:edit, @duplicate_record], notice: t('.success')) end def units @@ -59,10 +59,6 @@ def units private - def index_path - %i[calendar_management calendars] - end - def set_calendar @calendar = Calendar.includes(calendar_events: [:calendar_event_type]).find(params[:id]) end diff --git a/app/controllers/concerns/reference_resource.rb b/app/controllers/concerns/reference_resource.rb index 4cf4da08b..2dd99b75d 100644 --- a/app/controllers/concerns/reference_resource.rb +++ b/app/controllers/concerns/reference_resource.rb @@ -1,53 +1,13 @@ # frozen_string_literal: true module ReferenceResource - extend ActiveSupport::Concern - include SearchableModule + def self.included(base) + base.class_eval do + include YoksisResource - included do - before_action :set_variables - before_action :set_resource, only: %i[edit update destroy] - - def index - value = pagy_by_search(@model_name.order(:name)) - instance_variable_set("@#{controller_name}", value) - end - - def new - instance_variable_set(@singular_variable.to_sym, @model_name.new) - end - - def create - instance_variable_set(@singular_variable.to_sym, @model_name.new(secure_params)) - instance_variable_get(@singular_variable).save ? redirect_with('success') : render(:new) - end - - def update - if instance_variable_get(@singular_variable).update(secure_params) - flash[:notice] = t('.success') - redirect_to action: :index - else - render(:edit) + def redirect_with(message) + redirect_to(send("reference_#{controller_name}_path"), notice: t(".#{message}")) end end - - def destroy - instance_variable_get(@singular_variable).destroy ? redirect_with('success') : redirect_with('warning') - end - - private - - def set_variables - @singular_variable = "@#{controller_name.singularize}" - @model_name = controller_name.classify.constantize - end - - def set_resource - instance_variable_set(@singular_variable.to_sym, @model_name.find(params[:id])) - end - - def redirect_with(message) - redirect_to(send("admin_#{controller_name}_path"), notice: t(".#{message}")) - end end end diff --git a/app/controllers/concerns/yoksis_resource.rb b/app/controllers/concerns/yoksis_resource.rb new file mode 100644 index 000000000..84ad425cb --- /dev/null +++ b/app/controllers/concerns/yoksis_resource.rb @@ -0,0 +1,53 @@ +# frozen_string_literal: true + +module YoksisResource + extend ActiveSupport::Concern + include SearchableModule + + included do + before_action :set_variables + before_action :set_resource, only: %i[edit update destroy] + + def index + value = pagy_by_search(@model_name.order(:name)) + instance_variable_set("@#{controller_name}", value) + end + + def new + instance_variable_set(@singular_variable.to_sym, @model_name.new) + end + + def create + instance_variable_set(@singular_variable.to_sym, @model_name.new(secure_params)) + instance_variable_get(@singular_variable).save ? redirect_with('success') : render(:new) + end + + def update + if instance_variable_get(@singular_variable).update(secure_params) + flash[:notice] = t('.success') + redirect_to action: :index + else + render(:edit) + end + end + + def destroy + instance_variable_get(@singular_variable).destroy ? redirect_with('success') : redirect_with('warning') + end + + private + + def set_variables + @singular_variable = "@#{controller_name.singularize}" + @model_name = controller_name.classify.constantize + end + + def set_resource + instance_variable_set(@singular_variable.to_sym, @model_name.find(params[:id])) + end + + def redirect_with(message) + redirect_to(send("yoksis_#{controller_name}_path"), notice: t(".#{message}")) + end + end +end diff --git a/app/controllers/course_management/available_courses_controller.rb b/app/controllers/course_management/available_courses_controller.rb index dcc565eff..cff3d6719 100644 --- a/app/controllers/course_management/available_courses_controller.rb +++ b/app/controllers/course_management/available_courses_controller.rb @@ -22,15 +22,12 @@ def show def new @available_course = AvailableCourse.new + @available_course.groups.build.lecturers.build end def create @available_course = AvailableCourse.new(available_course_params) - if @available_course.save - redirect_to new_available_course_available_course_group_path(@available_course) - else - render(:new) - end + @available_course.save ? redirect_to(@available_course, notice: t('.success')) : render(:new) end def edit; end @@ -60,7 +57,9 @@ def set_available_course def available_course_params params.require(:available_course).permit( - :curriculum_id, :course_id, :unit_id, :coordinator_id + :curriculum_id, :course_id, :unit_id, :coordinator_id, + groups_attributes: [:id, :name, :quota, :_destroy, + lecturers_attributes: %i[id lecturer_id coordinator _destroy]] ) end end diff --git a/app/controllers/first_registration/prospective_students_controller.rb b/app/controllers/first_registration/prospective_students_controller.rb index d1b772e46..fb5a2717f 100644 --- a/app/controllers/first_registration/prospective_students_controller.rb +++ b/app/controllers/first_registration/prospective_students_controller.rb @@ -23,14 +23,14 @@ def new def create @prospective_student = ProspectiveStudent.new(prospective_student_params) - @prospective_student.save ? redirect_to(index_path, notice: t('.success')) : render(:new) + @prospective_student.save ? redirect_to(:prospective_students, notice: t('.success')) : render(:new) end def edit; end def update if @prospective_student.update(prospective_student_params) - redirect_to([:first_registration, @prospective_student], notice: t('.success')) + redirect_to(@prospective_student, notice: t('.success')) else render(:edit) end @@ -41,24 +41,21 @@ def register if prospective_student.register @prospective_student.update(registered: true, archived: true) - redirect_to(index_path, notice: t('.success')) + redirect_to(:prospective_students, notice: t('.success')) else - redirect_to(index_path, alert: t('.warning')) + redirect_to(:prospective_students, alert: t('.warning')) end end private - def index_path - %i[first_registration prospective_students] - end - def set_prospective_student @prospective_student = ProspectiveStudent.find(params[:id]) end def can_register? - redirect_to(index_path, alert: t('.can_not_register')) unless @prospective_student.can_temporarily_register? + alert = '.can_not_register' + redirect_to(:prospective_students, alert: t(alert)) unless @prospective_student.can_temporarily_register? end # rubocop:disable Metrics/MethodLength diff --git a/app/controllers/first_registration/registration_documents_controller.rb b/app/controllers/first_registration/registration_documents_controller.rb index 18ea656b8..6fd23a074 100644 --- a/app/controllers/first_registration/registration_documents_controller.rb +++ b/app/controllers/first_registration/registration_documents_controller.rb @@ -21,7 +21,7 @@ def new def create @registration_document = RegistrationDocument.new(registration_document_params) if @registration_document.save - redirect_to(index_path, notice: t('.success')) + redirect_to(:registration_documents, notice: t('.success')) else render(:new) end @@ -31,7 +31,7 @@ def edit; end def update if @registration_document.update(registration_document_params) - redirect_to(index_path, notice: t('.success')) + redirect_to(:registration_documents, notice: t('.success')) else render(:edit) end @@ -39,18 +39,14 @@ def update def destroy if @registration_document.destroy - redirect_to(index_path, notice: t('.success')) + redirect_to(:registration_documents, notice: t('.success')) else - redirect_to(index_path, alert: t('.warning')) + redirect_to(:registration_documents, alert: t('.warning')) end end private - def index_path - [:first_registration, 'registration_documents'] - end - def set_registration_document @registration_document = RegistrationDocument.find(params[:id]) end diff --git a/app/controllers/admin/cities_controller.rb b/app/controllers/location/cities_controller.rb similarity index 64% rename from app/controllers/admin/cities_controller.rb rename to app/controllers/location/cities_controller.rb index f3f039632..e4c77f023 100644 --- a/app/controllers/admin/cities_controller.rb +++ b/app/controllers/location/cities_controller.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module Admin +module Location class CitiesController < ApplicationController include SearchableModule @@ -17,20 +17,20 @@ def new def create @city = @country.cities.new(city_params) - @city.save ? redirect_to([:admin, @country, @city], notice: t('.success')) : render(:new) + @city.save ? redirect_to([@country, @city], notice: t('.success')) : render(:new) end def edit; end def update - @city.update(city_params) ? redirect_to([:admin, @country, @city], notice: t('.success')) : render(:edit) + @city.update(city_params) ? redirect_to([@country, @city], notice: t('.success')) : render(:edit) end def destroy if @city.destroy - redirect_to([:admin, @country], notice: t('.success')) + redirect_to(@country, notice: t('.success')) else - redirect_to([:admin, @country], alert: t('.warning')) + redirect_to(@country, alert: t('.warning')) end end @@ -45,7 +45,7 @@ def set_city end def city_params - params.require(:city).permit(:name, :alpha_2_code) + params.require(:city).permit(:name, :alpha_2_code, :latitude, :longitude) end end end diff --git a/app/controllers/admin/countries_controller.rb b/app/controllers/location/countries_controller.rb similarity index 52% rename from app/controllers/admin/countries_controller.rb rename to app/controllers/location/countries_controller.rb index 16eb980ce..186f258ed 100644 --- a/app/controllers/admin/countries_controller.rb +++ b/app/controllers/location/countries_controller.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module Admin +module Location class CountriesController < ApplicationController include SearchableModule @@ -20,35 +20,30 @@ def new def create @country = Country.new(country_params) - @country.save ? redirect_to([:admin, @country], notice: t('.success')) : render(:new) + @country.save ? redirect_to(@country, notice: t('.success')) : render(:new) end def edit; end def update - @country.update(country_params) ? redirect_to([:admin, @country], notice: t('.success')) : render(:edit) + @country.update(country_params) ? redirect_to(@country, notice: t('.success')) : render(:edit) end def destroy - if @country.destroy - redirect_to(index_path, notice: t('.success')) - else - redirect_to(index_path, alert: t('.warning')) - end + @country.destroy ? redirect_to(:countries, notice: t('.success')) : redirect_to(:countries, alert: t('.warning')) end private - def index_path - %i[admin countries] - end - def set_country @country = Country.find(params[:id]) end def country_params - params.require(:country).permit(:name, :alpha_2_code, :alpha_3_code, :numeric_code, :mernis_code, :yoksis_code) + params.require(:country).permit( + :name, :alpha_2_code, :alpha_3_code, :numeric_code, :mernis_code, :yoksis_code, :continent, :currency_code, + :latitude, :longitude, :phone_code, :region, :start_of_week, :subregion, :un_locode, :world_region + ) end end end diff --git a/app/controllers/admin/districts_controller.rb b/app/controllers/location/districts_controller.rb similarity index 95% rename from app/controllers/admin/districts_controller.rb rename to app/controllers/location/districts_controller.rb index 6e8c37c45..68721f090 100644 --- a/app/controllers/admin/districts_controller.rb +++ b/app/controllers/location/districts_controller.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module Admin +module Location class DistrictsController < ApplicationController before_action :set_city before_action :set_district, only: %i[edit update destroy] @@ -35,7 +35,7 @@ def destroy private def index_path - [:admin, @city.country, @city] + [@city.country, @city] end def set_city diff --git a/app/controllers/public_profile_controller.rb b/app/controllers/public_profile_controller.rb deleted file mode 100644 index b7336e931..000000000 --- a/app/controllers/public_profile_controller.rb +++ /dev/null @@ -1,37 +0,0 @@ -# frozen_string_literal: true - -class PublicProfileController < ApplicationController - include SearchableModule - - skip_before_action :authenticate_user! - before_action :set_user, only: %i[show vcard] - before_action :set_employee, only: %i[show vcard] - before_action :check_identity, only: %i[show vcard] - - def show; end - - def index - @users = User.joins(:employees).search(params[:term]) - end - - def vcard - send_data VcardBuilderService.new(@identity).generate, type: 'text/vcard; charset=utf-8; header=present', - filename: 'contact.vcf' - end - - private - - def set_user - @user = User.includes(:articles, duties: [:unit]).friendly.find(params[:id]) - end - - def set_employee - @employee = @user.employees.includes(:title, positions: [:administrative_function]).active.first - not_found unless @employee - end - - def check_identity - @identity = @user.identities.user_identity - not_found if @identity.blank? - end -end diff --git a/app/controllers/reference/academic_terms_controller.rb b/app/controllers/reference/academic_terms_controller.rb new file mode 100644 index 000000000..8953a1cdb --- /dev/null +++ b/app/controllers/reference/academic_terms_controller.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Reference + class AcademicTermsController < ApplicationController + include ReferenceResource + + def index + @academic_terms = pagy_by_search(AcademicTerm.order(:year, :term)) + end + + private + + def secure_params + params.require(:academic_term).permit(:year, :term, :start_of_term, :end_of_term, :active) + end + end +end diff --git a/app/controllers/admin/assessment_methods_controller.rb b/app/controllers/reference/assessment_methods_controller.rb similarity index 93% rename from app/controllers/admin/assessment_methods_controller.rb rename to app/controllers/reference/assessment_methods_controller.rb index d4f2dd0c4..9550b8848 100644 --- a/app/controllers/admin/assessment_methods_controller.rb +++ b/app/controllers/reference/assessment_methods_controller.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module Admin +module Reference class AssessmentMethodsController < ApplicationController include ReferenceResource diff --git a/app/controllers/reference/dashboard_controller.rb b/app/controllers/reference/dashboard_controller.rb new file mode 100644 index 000000000..d1b4106bd --- /dev/null +++ b/app/controllers/reference/dashboard_controller.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +module Reference + class DashboardController < ApplicationController + def index; end + end +end diff --git a/app/controllers/admin/document_types_controller.rb b/app/controllers/reference/document_types_controller.rb similarity index 93% rename from app/controllers/admin/document_types_controller.rb rename to app/controllers/reference/document_types_controller.rb index d47254d41..ba610c689 100644 --- a/app/controllers/admin/document_types_controller.rb +++ b/app/controllers/reference/document_types_controller.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module Admin +module Reference class DocumentTypesController < ApplicationController include ReferenceResource diff --git a/app/controllers/admin/evaluation_types_controller.rb b/app/controllers/reference/evaluation_types_controller.rb similarity index 93% rename from app/controllers/admin/evaluation_types_controller.rb rename to app/controllers/reference/evaluation_types_controller.rb index d307b8ccd..6e3bdccff 100644 --- a/app/controllers/admin/evaluation_types_controller.rb +++ b/app/controllers/reference/evaluation_types_controller.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module Admin +module Reference class EvaluationTypesController < ApplicationController include ReferenceResource diff --git a/app/controllers/admin/high_school_types_controller.rb b/app/controllers/reference/high_school_types_controller.rb similarity index 93% rename from app/controllers/admin/high_school_types_controller.rb rename to app/controllers/reference/high_school_types_controller.rb index c96a5b08f..34dc62376 100644 --- a/app/controllers/admin/high_school_types_controller.rb +++ b/app/controllers/reference/high_school_types_controller.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module Admin +module Reference class HighSchoolTypesController < ApplicationController include ReferenceResource diff --git a/app/controllers/admin/languages_controller.rb b/app/controllers/reference/languages_controller.rb similarity index 92% rename from app/controllers/admin/languages_controller.rb rename to app/controllers/reference/languages_controller.rb index 23c2c104d..0882e7acb 100644 --- a/app/controllers/admin/languages_controller.rb +++ b/app/controllers/reference/languages_controller.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module Admin +module Reference class LanguagesController < ApplicationController include ReferenceResource diff --git a/app/controllers/admin/titles_controller.rb b/app/controllers/reference/titles_controller.rb similarity index 92% rename from app/controllers/admin/titles_controller.rb rename to app/controllers/reference/titles_controller.rb index 9ee2281da..1fa986f7f 100644 --- a/app/controllers/admin/titles_controller.rb +++ b/app/controllers/reference/titles_controller.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module Admin +module Reference class TitlesController < ApplicationController include ReferenceResource diff --git a/app/controllers/references/academic_terms_controller.rb b/app/controllers/references/academic_terms_controller.rb deleted file mode 100644 index 7d6116247..000000000 --- a/app/controllers/references/academic_terms_controller.rb +++ /dev/null @@ -1,46 +0,0 @@ -# frozen_string_literal: true - -module References - class AcademicTermsController < ApplicationController - include SearchableModule - - before_action :set_academic_term, only: %i[edit update destroy] - - def index - @academic_terms = pagy_by_search(AcademicTerm.order(:year, :term)) - end - - def new - @academic_term = AcademicTerm.new - end - - def edit; end - - def create - @academic_term = AcademicTerm.new(academic_term_params) - @academic_term.save ? redirect_with('success') : render(:new) - end - - def update - @academic_term.update(academic_term_params) ? redirect_with('success') : render(:edit) - end - - def destroy - @academic_term.destroy ? redirect_with('success') : redirect_with('warning') - end - - private - - def redirect_with(message) - redirect_to(academic_terms_path, notice: t(".#{message}")) - end - - def set_academic_term - @academic_term = AcademicTerm.find(params[:id]) - end - - def academic_term_params - params.require(:academic_term).permit(:year, :term, :start_of_term, :end_of_term, :active) - end - end -end diff --git a/app/controllers/admin/administrative_functions_controller.rb b/app/controllers/yoksis/administrative_functions_controller.rb similarity index 83% rename from app/controllers/admin/administrative_functions_controller.rb rename to app/controllers/yoksis/administrative_functions_controller.rb index 80344afeb..f1bf6b338 100644 --- a/app/controllers/admin/administrative_functions_controller.rb +++ b/app/controllers/yoksis/administrative_functions_controller.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true -module Admin +module Yoksis class AdministrativeFunctionsController < ApplicationController - include ReferenceResource + include YoksisResource private diff --git a/app/controllers/yoksis/dashboard_controller.rb b/app/controllers/yoksis/dashboard_controller.rb new file mode 100644 index 000000000..a0999c397 --- /dev/null +++ b/app/controllers/yoksis/dashboard_controller.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +module Yoksis + class DashboardController < ApplicationController + def index; end + end +end diff --git a/app/controllers/admin/student_disability_types_controller.rb b/app/controllers/yoksis/student_disability_types_controller.rb similarity index 83% rename from app/controllers/admin/student_disability_types_controller.rb rename to app/controllers/yoksis/student_disability_types_controller.rb index 30c792981..62f845ff9 100644 --- a/app/controllers/admin/student_disability_types_controller.rb +++ b/app/controllers/yoksis/student_disability_types_controller.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true -module Admin +module Yoksis class StudentDisabilityTypesController < ApplicationController - include ReferenceResource + include YoksisResource private diff --git a/app/controllers/admin/student_drop_out_types_controller.rb b/app/controllers/yoksis/student_drop_out_types_controller.rb similarity index 83% rename from app/controllers/admin/student_drop_out_types_controller.rb rename to app/controllers/yoksis/student_drop_out_types_controller.rb index 21ab1be21..d0d224deb 100644 --- a/app/controllers/admin/student_drop_out_types_controller.rb +++ b/app/controllers/yoksis/student_drop_out_types_controller.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true -module Admin +module Yoksis class StudentDropOutTypesController < ApplicationController - include ReferenceResource + include YoksisResource private diff --git a/app/controllers/admin/student_education_levels_controller.rb b/app/controllers/yoksis/student_education_levels_controller.rb similarity index 83% rename from app/controllers/admin/student_education_levels_controller.rb rename to app/controllers/yoksis/student_education_levels_controller.rb index e18b5bc59..0ee64738b 100644 --- a/app/controllers/admin/student_education_levels_controller.rb +++ b/app/controllers/yoksis/student_education_levels_controller.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true -module Admin +module Yoksis class StudentEducationLevelsController < ApplicationController - include ReferenceResource + include YoksisResource private diff --git a/app/controllers/admin/student_entrance_point_types_controller.rb b/app/controllers/yoksis/student_entrance_point_types_controller.rb similarity index 83% rename from app/controllers/admin/student_entrance_point_types_controller.rb rename to app/controllers/yoksis/student_entrance_point_types_controller.rb index a211ecf9b..41db7493f 100644 --- a/app/controllers/admin/student_entrance_point_types_controller.rb +++ b/app/controllers/yoksis/student_entrance_point_types_controller.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true -module Admin +module Yoksis class StudentEntrancePointTypesController < ApplicationController - include ReferenceResource + include YoksisResource private diff --git a/app/controllers/admin/student_entrance_types_controller.rb b/app/controllers/yoksis/student_entrance_types_controller.rb similarity index 83% rename from app/controllers/admin/student_entrance_types_controller.rb rename to app/controllers/yoksis/student_entrance_types_controller.rb index a9995fce9..15f090b8c 100644 --- a/app/controllers/admin/student_entrance_types_controller.rb +++ b/app/controllers/yoksis/student_entrance_types_controller.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true -module Admin +module Yoksis class StudentEntranceTypesController < ApplicationController - include ReferenceResource + include YoksisResource private diff --git a/app/controllers/admin/student_grades_controller.rb b/app/controllers/yoksis/student_grades_controller.rb similarity index 82% rename from app/controllers/admin/student_grades_controller.rb rename to app/controllers/yoksis/student_grades_controller.rb index 39f6c0651..445c08365 100644 --- a/app/controllers/admin/student_grades_controller.rb +++ b/app/controllers/yoksis/student_grades_controller.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true -module Admin +module Yoksis class StudentGradesController < ApplicationController - include ReferenceResource + include YoksisResource private diff --git a/app/controllers/admin/student_grading_systems_controller.rb b/app/controllers/yoksis/student_grading_systems_controller.rb similarity index 83% rename from app/controllers/admin/student_grading_systems_controller.rb rename to app/controllers/yoksis/student_grading_systems_controller.rb index b49f21c2c..b634af54f 100644 --- a/app/controllers/admin/student_grading_systems_controller.rb +++ b/app/controllers/yoksis/student_grading_systems_controller.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true -module Admin +module Yoksis class StudentGradingSystemsController < ApplicationController - include ReferenceResource + include YoksisResource private diff --git a/app/controllers/admin/student_punishment_types_controller.rb b/app/controllers/yoksis/student_punishment_types_controller.rb similarity index 83% rename from app/controllers/admin/student_punishment_types_controller.rb rename to app/controllers/yoksis/student_punishment_types_controller.rb index 852e9812b..6e5b534b4 100644 --- a/app/controllers/admin/student_punishment_types_controller.rb +++ b/app/controllers/yoksis/student_punishment_types_controller.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true -module Admin +module Yoksis class StudentPunishmentTypesController < ApplicationController - include ReferenceResource + include YoksisResource private diff --git a/app/controllers/admin/student_studentship_statuses_controller.rb b/app/controllers/yoksis/student_studentship_statuses_controller.rb similarity index 83% rename from app/controllers/admin/student_studentship_statuses_controller.rb rename to app/controllers/yoksis/student_studentship_statuses_controller.rb index 114932b64..425540ac8 100644 --- a/app/controllers/admin/student_studentship_statuses_controller.rb +++ b/app/controllers/yoksis/student_studentship_statuses_controller.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true -module Admin +module Yoksis class StudentStudentshipStatusesController < ApplicationController - include ReferenceResource + include YoksisResource private diff --git a/app/controllers/admin/unit_instruction_languages_controller.rb b/app/controllers/yoksis/unit_instruction_languages_controller.rb similarity index 83% rename from app/controllers/admin/unit_instruction_languages_controller.rb rename to app/controllers/yoksis/unit_instruction_languages_controller.rb index 2bc2b9796..b1887380f 100644 --- a/app/controllers/admin/unit_instruction_languages_controller.rb +++ b/app/controllers/yoksis/unit_instruction_languages_controller.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true -module Admin +module Yoksis class UnitInstructionLanguagesController < ApplicationController - include ReferenceResource + include YoksisResource private diff --git a/app/controllers/admin/unit_instruction_types_controller.rb b/app/controllers/yoksis/unit_instruction_types_controller.rb similarity index 83% rename from app/controllers/admin/unit_instruction_types_controller.rb rename to app/controllers/yoksis/unit_instruction_types_controller.rb index e6036083e..476f315c5 100644 --- a/app/controllers/admin/unit_instruction_types_controller.rb +++ b/app/controllers/yoksis/unit_instruction_types_controller.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true -module Admin +module Yoksis class UnitInstructionTypesController < ApplicationController - include ReferenceResource + include YoksisResource private diff --git a/app/controllers/admin/unit_statuses_controller.rb b/app/controllers/yoksis/unit_statuses_controller.rb similarity index 82% rename from app/controllers/admin/unit_statuses_controller.rb rename to app/controllers/yoksis/unit_statuses_controller.rb index 4e13035a5..687eadf71 100644 --- a/app/controllers/admin/unit_statuses_controller.rb +++ b/app/controllers/yoksis/unit_statuses_controller.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true -module Admin +module Yoksis class UnitStatusesController < ApplicationController - include ReferenceResource + include YoksisResource private diff --git a/app/controllers/admin/unit_types_controller.rb b/app/controllers/yoksis/unit_types_controller.rb similarity index 82% rename from app/controllers/admin/unit_types_controller.rb rename to app/controllers/yoksis/unit_types_controller.rb index 51bee44e8..49c3edc24 100644 --- a/app/controllers/admin/unit_types_controller.rb +++ b/app/controllers/yoksis/unit_types_controller.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true -module Admin +module Yoksis class UnitTypesController < ApplicationController - include ReferenceResource + include YoksisResource private diff --git a/app/controllers/admin/university_types_controller.rb b/app/controllers/yoksis/university_types_controller.rb similarity index 82% rename from app/controllers/admin/university_types_controller.rb rename to app/controllers/yoksis/university_types_controller.rb index 98567534d..345a45c76 100644 --- a/app/controllers/admin/university_types_controller.rb +++ b/app/controllers/yoksis/university_types_controller.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true -module Admin +module Yoksis class UniversityTypesController < ApplicationController - include ReferenceResource + include YoksisResource private diff --git a/app/decorators/curriculum_decorator.rb b/app/decorators/curriculum_decorator.rb index 840da3112..ce11add13 100644 --- a/app/decorators/curriculum_decorator.rb +++ b/app/decorators/curriculum_decorator.rb @@ -7,7 +7,7 @@ def openable_courses_for_active_term(appends: nil) return [] unless term courses = semesters.where(term: term) - .includes(:courses) + .includes(:courses, :curriculum_courses) .where.not(courses: { id: available_courses.pluck(:course_id) }) .order('courses.name') .map(&:courses) diff --git a/app/helpers/continent_helper.rb b/app/helpers/continent_helper.rb new file mode 100644 index 000000000..0c229afc8 --- /dev/null +++ b/app/helpers/continent_helper.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +module ContinentHelper + def continents + %w[Afrika Antarktika Asya Avrupa Avusturalya Güney\ Amerika Kuzey\ Amerika] + end + + def regions + %w[Afrika Amerika Asya Avrupa Okyanusya] + end + + # rubocop:disable Metrics/MethodLength + def subregions + %w[ + Avusturalya\ ve\ Yeni\ Zellanda + Batı\ Afrika + Batı\ Asya + Batı\ Avrupa + Doğu\ Afrika + Doğu\ Asya + Doğu\ Avrupa + Güney\ Afrika + Güney\ Amerika + Güney\ Asya + Güney\ Avrupa + Güneydoğu\ Asya + Karayipler + Kuzey\ Afrika + Kuzey\ Amerika + Kuzey\ Avrupa + Melanezya + Mikronezya + Orta\ Afrika + Orta\ Amerika + Orta\ Asya + Polinezya + ] + end + # rubocop:enable Metrics/MethodLength +end diff --git a/app/jobs/application_job.rb b/app/jobs/application_job.rb index 1abe680f3..b09457cb9 100644 --- a/app/jobs/application_job.rb +++ b/app/jobs/application_job.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true class ApplicationJob < ActiveJob::Base - if Rails.env.production? || Rails.env.beta? + if Rails.env.production? # :exponentially_longer, applies the wait algorithm of (executions ** 4) + 2 # (first 3s, then 18s, then 83s, etc) retry_on Net::HTTPFatalError, wait: :exponentially_longer, attempts: 10, queue: :low diff --git a/app/lib/nokul/database_url.rb b/app/lib/nokul/database_url.rb new file mode 100644 index 000000000..77180742c --- /dev/null +++ b/app/lib/nokul/database_url.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +module Nokul + module DatabaseUrl + module_function + + def application + Nokul::Name.application + end + + def url + host = ENV.fetch('DB_HOST', 'localhost') + "postgresql://#{application}:#{application}@#{host}/#{application}" + end + + def development + url + '_development' + end + + def production + url + '_production' + end + + def test + url + '_test' + end + end +end diff --git a/app/lib/nokul/name.rb b/app/lib/nokul/name.rb new file mode 100644 index 000000000..7635ae2eb --- /dev/null +++ b/app/lib/nokul/name.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Nokul + module Name + module_function + + def application + @application ||= if File.exist?(manifest = Rails.root.join('app.json')) + JSON.parse(File.read(manifest)).fetch 'name' + else + self.class.module_parent.to_s.underscore + end + end + end +end diff --git a/app/lib/nokul/version.rb b/app/lib/nokul/version.rb index c4141e873..4a778736e 100644 --- a/app/lib/nokul/version.rb +++ b/app/lib/nokul/version.rb @@ -1,5 +1,16 @@ # frozen_string_literal: true module Nokul - VERSION = '0.5.5' + class Version < Gem::Version + def self.load_from_manifest + version = if File.exist?(manifest = Rails.root.join('app.json')) + JSON.parse(File.read(manifest)).fetch('version') + end + new(version || '0.0.0') + end + + def self.current + @current ||= load_from_manifest.to_s + end + end end diff --git a/app/models/available_course.rb b/app/models/available_course.rb index daca6b956..8d0ee70ca 100644 --- a/app/models/available_course.rb +++ b/app/models/available_course.rb @@ -25,10 +25,13 @@ class AvailableCourse < ApplicationRecord belongs_to :unit has_many :evaluation_types, class_name: 'CourseEvaluationType', dependent: :destroy has_many :groups, class_name: 'AvailableCourseGroup', dependent: :destroy + has_many :lecturers, through: :groups + accepts_nested_attributes_for :groups, reject_if: :all_blank, allow_destroy: true # validations validates :assessments_approved, inclusion: { in: [true, false] } validates :course, uniqueness: { scope: %i[academic_term curriculum] } + validates :groups, presence: true # delegates delegate :code, :name, :theoric, :practice, :laboratory, :credit, :program_type, to: :course diff --git a/app/models/city.rb b/app/models/city.rb index 43dec1cb3..b6d210e30 100644 --- a/app/models/city.rb +++ b/app/models/city.rb @@ -20,6 +20,8 @@ class City < ApplicationRecord # validations validates :alpha_2_code, presence: true, uniqueness: true, length: { maximum: 255 } + validates :latitude, numericality: true + validates :longitude, numericality: true validates :name, presence: true, uniqueness: { scope: %i[country_id] }, length: { maximum: 255 } # callbacks diff --git a/app/models/country.rb b/app/models/country.rb index 7281bf6b5..6829f7f99 100644 --- a/app/models/country.rb +++ b/app/models/country.rb @@ -22,11 +22,25 @@ class Country < ApplicationRecord validates :name, presence: true, uniqueness: true, length: { maximum: 255 } validates :alpha_2_code, presence: true, uniqueness: true, length: { is: 2 } validates :alpha_3_code, presence: true, uniqueness: true, length: { is: 3 } + validates :continent, presence: true, length: { maximum: 255 } + validates :currency_code, presence: true, length: { is: 3 } + validates :latitude, numericality: true + validates :longitude, numericality: true + validates :phone_code, length: { maximum: 3 } + validates :region, length: { maximum: 255 } + validates :start_of_week, length: { maximum: 255 } + validates :subregion, length: { maximum: 255 } validates :numeric_code, presence: true, uniqueness: true, length: { is: 3 }, numericality: { only_integer: true, greater_than: 0 } validates :mernis_code, allow_nil: true, uniqueness: true, length: { is: 4 }, numericality: { only_integer: true, greater_than: 0 } + validates :sms_delivery_report, inclusion: { in: [true, false] } + validates :sms_alpha_sender_id, inclusion: { in: [true, false] } + validates :sms_unicode, inclusion: { in: [true, false] } + validates :sms_concatenation, inclusion: { in: [true, false] } + validates :un_locode, allow_nil: true, length: { is: 2 } validates :yoksis_code, allow_nil: true, numericality: { only_integer: true, greater_than_or_equal_to: 1 } + validates :world_region, presence: true, length: { maximum: 255 } private diff --git a/app/services/xokul/connection.rb b/app/services/xokul/connection.rb index b6f680bab..4d53cbebe 100644 --- a/app/services/xokul/connection.rb +++ b/app/services/xokul/connection.rb @@ -3,7 +3,7 @@ module Xokul module Connection BASE_URL = Tenant.configuration.api_host - BEARER_TOKEN = Rails.application.credentials.xokul[:bearer_token] + BEARER_TOKEN = Tenant.credentials.dig(:xokul, :bearer_token) private_constant :BASE_URL, :BEARER_TOKEN diff --git a/app/views/admin/countries/_form.html.erb b/app/views/admin/countries/_form.html.erb deleted file mode 100644 index 770ae3168..000000000 --- a/app/views/admin/countries/_form.html.erb +++ /dev/null @@ -1,33 +0,0 @@ -<%= render 'layouts/builders/form', - namespace: 'admin', - klass: @country, - params: [ - { - field: 'name', - width: 12, - required: true - }, - { - field: 'alpha_2_code', - width: 3, - required: true - }, - { - field: 'alpha_3_code', - width: 3, - required: true - }, - { - field: 'numeric_code', - width: 3, - required: true - }, - { - field: 'mernis_code', - width: 3 - }, - { - field: 'yoksis_code', - width: 3 - } - ] %> diff --git a/app/views/admin/yoksis_dashboard/_card.html.erb b/app/views/admin/yoksis_dashboard/_card.html.erb deleted file mode 100644 index aaf27698e..000000000 --- a/app/views/admin/yoksis_dashboard/_card.html.erb +++ /dev/null @@ -1,14 +0,0 @@ -
<%= link_to("[#{full_name(calendar.academic_term)}] - #{calendar.name}", [:calendar_management, calendar]) %> | +<%= link_to("[#{full_name(calendar.academic_term)}] - #{calendar.name}", calendar) %> | <%= calendar.timezone %> | <%= full_name(calendar.academic_term) %> | - <%= link_to fa_icon('file-pdf-o'), - [:calendar_management, calendar, format: :pdf], - class: 'btn btn-outline-primary btn-sm' %> - <%= link_to_actions(calendar, scope: :calendar_management, except: :show) %> + <%= link_to fa_icon('file-pdf-o'), calendar, format: :pdf, class: 'btn btn-outline-primary btn-sm' %> + <%= link_to_actions(calendar, except: :show) %> <%= link_to fa_icon('university', text: t('.assign_to_units')), - [:calendar_management, calendar, :units], + [calendar, :units], class: 'btn btn-outline-primary btn-sm' %> <%= link_to fa_icon('copy', text: t('.duplicate')), - [:calendar_management, calendar, :duplicate], + [calendar, :duplicate], class: 'btn btn-outline-primary btn-sm' %> |