diff --git a/.circleci/config.yml b/.circleci/config.yml index 33d3299cd..eb54def91 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -30,9 +30,9 @@ repository: &repository key: nokul-repo-{{ .Environment.CIRCLE_SHA1 }} # build image -ruby_2_6_0: &ruby_2_6_0 +ruby_2_6: &ruby_2_6 docker: - - image: circleci/ruby:2.6.0-node-browsers + - image: circleci/ruby:2.6.1-node-browsers <<: *rails_environment - image: circleci/postgres:11.1-alpine <<: *postgres_environment @@ -41,7 +41,7 @@ ruby_2_6_0: &ruby_2_6_0 version: 2 jobs: prepare_project: - <<: *ruby_2_6_0 + <<: *ruby_2_6 steps: - checkout - save_cache: @@ -49,7 +49,7 @@ jobs: paths: - ~/project bundle_dependencies: - <<: *ruby_2_6_0 + <<: *ruby_2_6 steps: - restore_cache: <<: *repository @@ -68,7 +68,7 @@ jobs: paths: - vendor/bundle bundle_assets: - <<: *ruby_2_6_0 + <<: *ruby_2_6 steps: - restore_cache: <<: *repository @@ -88,7 +88,7 @@ jobs: paths: - node_modules/ quality: - <<: *ruby_2_6_0 + <<: *ruby_2_6 steps: - restore_cache: <<: *repository @@ -103,7 +103,7 @@ jobs: - run: bundle exec rake quality:all - run: bin/yarn run lint security: - <<: *ruby_2_6_0 + <<: *ruby_2_6 steps: - restore_cache: <<: *repository @@ -117,7 +117,7 @@ jobs: - run: bundle --path vendor/bundle --without development - run: bundle exec rake security:all database: - <<: *ruby_2_6_0 + <<: *ruby_2_6 steps: - restore_cache: <<: *repository @@ -131,7 +131,7 @@ jobs: - run: bundle --path vendor/bundle --without development - run: bundle exec rake database:all test_suite: - <<: *ruby_2_6_0 + <<: *ruby_2_6 steps: - restore_cache: <<: *repository @@ -192,21 +192,21 @@ workflows: - test_suite: requires: - bundle_assets - - deploy_develop: - requires: - - quality - - security - - database - - test_suite - filters: - branches: - only: develop - - deploy_master: - requires: - - quality - - security - - database - - test_suite - filters: - branches: - only: master + # - deploy_develop: + # requires: + # - quality + # - security + # - database + # - test_suite + # filters: + # branches: + # only: develop + # - deploy_master: + # requires: + # - quality + # - security + # - database + # - test_suite + # filters: + # branches: + # only: master diff --git a/.erb-lint.yml b/.erb-lint.yml new file mode 100644 index 000000000..359ee3a80 --- /dev/null +++ b/.erb-lint.yml @@ -0,0 +1,40 @@ +linters: + Rubocop: + enabled: true + rubocop_config: + inherit_from: + - .rubocop.yml + Style/FrozenStringLiteralComment: + Enabled: false + Layout/InitialIndentation: + Enabled: false + Layout/TrailingBlankLines: + Enabled: false + Naming/FileName: + Enabled: false + Style/FrozenStringLiteralComment: + Enabled: false + Metrics/LineLength: + Enabled: false + Lint/UselessAssignment: + Enabled: false + Rails/OutputSafety: + Enabled: false + SpaceAroundErbTag: + enabled: true + FinalNewline: + enabled: true + ErbSafety: + enabled: true + RightTrim: + enabled: false + SelfClosingTag: + enabled: true + AllowedScriptType: + enabled: true + allowed_types: + - 'application/json' + - 'text/javascript' + - 'text/html' + allow_blank: false + disallow_inline_scripts: false diff --git a/.eslintrc.json b/.eslintrc.json index d65823629..7d03cee42 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,3 +1,3 @@ { - "extends": "standard" + "extends": "standard" } \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug-report.md index f98d0a7a5..b4d1f3800 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.md +++ b/.github/ISSUE_TEMPLATE/bug-report.md @@ -49,7 +49,7 @@ labels: bug * [ ] İş kaydınızın başlığı kurallara (sadece ilk harf büyük, emir kipinde problem cümlesi vb.) uygun mu? * [ ] [Katkı sağlama dokümanını](https://github.com/omu/nokul/CONTRIBUTING.md) okudunuz mu? -* [ ] Öneriniz ile alakalı açık olarak bekleyen bir [issue](https://github.com/omu/nokul/issues) veya [pull request](https://github.com/omu/nokul/pulls) emin misiniz? +* [ ] Öneriniz ile alakalı açık olarak bekleyen bir [issue](https://github.com/omu/nokul/issues) veya [pull request](https://github.com/omu/nokul/pulls) olmadığına emin misiniz? **Ek içerik:** diff --git a/.gitignore b/.gitignore index 0dce6fe97..82faf21d9 100644 --- a/.gitignore +++ b/.gitignore @@ -43,3 +43,9 @@ yarn-debug.log* .env .envrc /.local/ + +# Ignore dokku deploy key +config/deploy_key + +# Ignore auto-generated PDFs of markdown files +.pdf diff --git a/.hound.yml b/.hound.yml new file mode 100644 index 000000000..f534df8c6 --- /dev/null +++ b/.hound.yml @@ -0,0 +1,2 @@ +rubocop: + config_file: .rubocop.yml diff --git a/.htmlhintrc b/.htmlhintrc new file mode 100644 index 000000000..832e6067f --- /dev/null +++ b/.htmlhintrc @@ -0,0 +1,25 @@ +{ + "spec-char-escape": false, + "attr-value-double-quotes": false, + "doctype-first": false, + "id-class-value": false, + "title-require": false, + "head-script-disabled": false, + "tagname-lowercase": true, + "attr-lowercase": true, + "attr-value-not-empty": false, + "attr-no-duplication": true, + "tag-pair": true, + "tag-self-close": false, + "id-unique": true, + "src-not-empty": true, + "alt-require": true, + "doctype-html5": true, + "style-disabled": false, + "inline-style-disabled": false, + "inline-script-disabled": false, + "space-tab-mixed-disabled": "space", + "id-class-ad-disabled": false, + "href-abs-or-rel": false, + "attr-unsafe-chars": true +} \ No newline at end of file diff --git a/.rubocop.yml b/.rubocop.yml index 9b4484f52..852277b5e 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -18,10 +18,20 @@ Metrics/BlockLength: Exclude: - config/routes/**/* - lib/tasks/**/*.rake # Won't fix - - test/models/concerns/reference_validations_test.rb + - test/models/concerns/validation_test_module.rb # Won't fix +Metrics/MethodLength: + Exclude: + - test/models/concerns/validation_test_module.rb # Won't fix +Metrics/AbcSize: + Exclude: + - test/models/concerns/validation_test_module.rb # Won't fix Metrics/ClassLength: Exclude: - test/**/*.rb +Naming/PredicateName: + Exclude: + - test/models/concerns/association_test_module.rb # Won't fix + - test/models/concerns/enumeration_test_module.rb # Won't fix # Do not exclude files from ALL COPS unless it's really necessary! AllCops: diff --git a/.ruby-version b/.ruby-version index e70b4523a..6a6a3d8e3 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.6.0 +2.6.1 diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..35c0835f2 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,60 @@ +language: minimal + +cache: + directories: + - "$HOME/bundle" + - "$HOME/.bundle_config" + - "$HOME/node_modules" + +install: + - docker-compose build test + - docker-compose run test bin/plugdo bundle install -j4 --path /app/vendor/bundle --without development + - docker-compose run test yarn install + - docker-compose run test bin/rails db:create db:structure:load + +before_script: + - openssl aes-256-cbc -K $encrypted_3f8c4ca1dcec_key -iv $encrypted_3f8c4ca1dcec_iv -in config/deploy_key.enc -out config/deploy_key -d + - chmod 600 config/deploy_key + - eval "$(ssh-agent -s)" && ssh-add config/deploy_key + - echo -e "Host app.omu.sh\n\tStrictHostKeyChecking no\n" >>~/.ssh/config + +jobs: + include: + - stage: test + # first job at this stage + name: "Quality Tests" + before_script: skip + script: docker-compose run test bundle exec rake quality:all + + # second job at this stage + - name: "Security and Database Tests" + before_script: skip + script: docker-compose run test bundle exec rake security:all database:all + + # third job at this stage + - name: "Integration Tests" + before_script: skip + script: docker-compose run test bundle exec rails test:system test + + - stage: deploy + # first job at this stage + name: "Deploy to dokku#beta" + if: branch = develop AND type = push AND fork = false + cache: skip + install: skip + script: git remote add beta dokku@app.omu.sh:nokul-develop && git push beta develop:master + + # second job at this stage + - name: "Deploy to dokku#production" + if: branch = master AND type = push AND fork = false + cache: skip + install: skip + script: git remote add production dokku@app.omu.sh:nokul && git push production master + +notifications: + email: false + slack: + on_success: change + on_failure: change + rooms: + - secure: ljbXmcdLA/wv+j3+RCE0qF/mZd/3PbHI0VOSBkeyJDXWcHHMduIyZlodzliuXL/8mfLbmcJ8MZT5tV9l0OGSgiFI/Ngz1fadsf+0Pim4MtREkp4yKRzfDbQqj8iQwzAAcIAxbIQhenVZtaadwBAM8Jawcjs0m2+iWXaiREU1IlRaK1NzGtkDx8gy5PnVgJhtWmhV7/l6a0Sg94shr53bchkuGwH/ugqgq9L+ec1gGKVpSOHhS0W5WjojMU+3K5/HCP/r9V2J2jYUjtzDSbEDFd18rH0qJjNq1hoaVeaW1uJzidSH7f7B6xXxJfUt4e2CiY+2CkR5LUbFx5V+6fNscEAA9u+zGh6Rn9rxciWkFfzKck6Eomoq5G+d+q/ItVagAMSIUELYCOup2+H/KtRNFTBWBqwECsvXZn7WwaZOdMXDfiTnI9eSWxJqaiwFMtC1A+bnKM7DX2qoZoGCNJAzzQ93EuXdxA1w1oYVs7lfh70qLx5OraXtcTUtfrv4tzms35S9JNNnEQyWN7neuPCS0Yh4QIFf4NX7aaYbwFD66uS25Iq2ochJ4oicFd8s+DxnaXc925GYXFVHk7wZWK/mFlGnZTuTbk4ElByqzRUN2sI5r7xYijv9cBcUM/1RqzXI3B/91Ft/kyCaYDrg3W1j79zLo+G5uIHU2/F1AQBIYlI= diff --git a/Dockerfile b/Dockerfile index 151afb2cc..40410fbb1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ondokuz/ruby-stretch:1.11.1 +FROM ondokuz/ruby-stretch:1.15.1 ENV PATH=/app/bin:$PATH @@ -14,29 +14,20 @@ ENV RAILS_MASTER_KEY=$RAILS_MASTER_KEY ENV RAILS_SERVE_STATIC_FILES=enabled ENV RAILS_LOG_TO_STDOUT=enabled -WORKDIR /app - -COPY .ruby-version ./ -COPY Gemfile Gemfile.lock ./ -COPY package.json yarn.lock ./ - -COPY plugins/support/lib/nokul/support/version.rb ./plugins/support/lib/nokul/support/version.rb -COPY plugins/support/nokul-support.gemspec ./plugins/support/nokul-support.gemspec +ENV NODE_ENV=production +ENV NODE_ENV=$NODE_ENV -COPY plugins/tenant/common/lib/nokul/tenant/version.rb ./plugins/tenant/common/lib/nokul/tenant/version.rb -COPY plugins/tenant/common/nokul-tenant.gemspec ./plugins/tenant/common/nokul-tenant.gemspec +RUN case $RAILS_ENV in \ + test) apt-get -y update && apt-get -y install --no-install-recommends chromedriver && \ + apt-get clean && rm -rf /var/lib/apt/lists/* ;; \ + esac -COPY plugins/tenant/$NOKUL_TENANT/lib/nokul/tenant/$NOKUL_TENANT/version.rb ./plugins/tenant/$NOKUL_TENANT/lib/nokul/tenant/$NOKUL_TENANT/version.rb -COPY plugins/tenant/$NOKUL_TENANT/nokul-tenant-$NOKUL_TENANT.gemspec ./plugins/tenant/$NOKUL_TENANT/nokul-tenant-$NOKUL_TENANT.gemspec +WORKDIR /app RUN bundle config --global silence_root_warning true -RUN bundle install --without development:test -j4 --deployment -RUN yarn install COPY . ./ -RUN bundle exec rake assets:precompile - EXPOSE 3000 CMD bundle exec puma -C config/puma.rb diff --git a/Gemfile b/Gemfile index ab64e68b9..506d1c0a4 100644 --- a/Gemfile +++ b/Gemfile @@ -6,7 +6,7 @@ ruby File.read('.ruby-version') git_source(:github) { |repo| "https://github.com/#{repo}.git" } # core -gem 'bootsnap', '>= 1.1.0', require: false +gem 'bootsnap', '>= 1.4.0', require: false gem 'puma', '~> 3.11' gem 'rails', github: 'rails/rails' gem 'redis', '~> 4.0' @@ -53,6 +53,7 @@ gem 'rack-attack' # validators gem 'email_address' +gem 'telephone_number' # error tracking gem 'rollbar', github: 'rollbar/rollbar-gem' @@ -62,9 +63,11 @@ gem 'friendly_id', '~> 5.2.0' group :development, :test do gem 'brakeman', require: false + gem 'bullet', github: 'flyerhzm/bullet' gem 'bundler-audit' gem 'byebug', platforms: %i[mri mingw x64_mingw] gem 'dotenv-rails' + gem 'erb_lint', require: false gem 'lol_dba' gem 'rubocop' gem 'simplecov', require: false @@ -79,14 +82,11 @@ group :test do end group :development do - # TODO: Will re-enable after upgrading bullet. - # gem 'bullet' gem 'fit-commit' gem 'letter_opener' gem 'listen', '>= 3.0.5', '< 3.2' gem 'pry-rails' - # TODO: Will re-enable after upgrading rack-mini-profiler - # gem 'rack-mini-profiler' + gem 'rack-mini-profiler' gem 'ruby-progressbar' gem 'spring' gem 'spring-watcher-listen', '~> 2.0.0' diff --git a/Gemfile.lock b/Gemfile.lock index b6aff4c02..e1f88da14 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,14 @@ +GIT + remote: https://github.com/flyerhzm/bullet.git + revision: 2ada165a7262daa4ab4eeb2f0a11c84afe285e72 + specs: + bullet (5.9.0) + activesupport (>= 3.0.0) + uniform_notifier (~> 1.11) + GIT remote: https://github.com/rails/rails.git - revision: 535a8b995700a5875a898691b19b88969c22d264 + revision: 16e235126ef0187a93b81ee959a8127097e2f394 specs: actioncable (6.0.0.beta1) actionpack (= 6.0.0.beta1) @@ -55,6 +63,7 @@ GIT i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) + zeitwerk (~> 1.0) rails (6.0.0.beta1) actioncable (= 6.0.0.beta1) actionmailbox (= 6.0.0.beta1) @@ -98,7 +107,7 @@ GIT GIT remote: https://github.com/rollbar/rollbar-gem.git - revision: 14110689214edf693758b66211cdedd73458b4e1 + revision: e3a35525d1b14fab587e317548ed4f5c1052240d specs: rollbar (2.18.2) multi_json @@ -133,8 +142,8 @@ GEM io-like (~> 0.3.0) ast (2.4.0) aws-eventstream (1.0.1) - aws-partitions (1.136.0) - aws-sdk-core (3.46.0) + aws-partitions (1.138.0) + aws-sdk-core (3.46.1) aws-eventstream (~> 1.0) aws-partitions (~> 1.0) aws-sigv4 (~> 1.0) @@ -148,8 +157,16 @@ GEM aws-sigv4 (~> 1.0) aws-sigv4 (1.0.3) bcrypt (3.1.12) + better_html (1.0.12) + actionview (>= 4.0) + activesupport (>= 4.0) + ast (~> 2.0) + erubi (~> 1.4) + html_tokenizer (~> 0.0.6) + parser (>= 2.4) + smart_properties bindex (0.5.0) - bootsnap (1.3.2) + bootsnap (1.4.0) msgpack (~> 1.0) brakeman (4.4.0) builder (3.2.3) @@ -187,7 +204,7 @@ GEM crack (0.4.3) safe_yaml (~> 1.0.0) crass (1.0.4) - devise (4.5.0) + devise (4.6.1) bcrypt (~> 3.0) orm_adapter (~> 0.1) railties (>= 4.1.0, < 6.0) @@ -201,6 +218,13 @@ GEM email_address (0.1.11) netaddr (~> 2.0) simpleidn + erb_lint (0.0.28) + activesupport + better_html (~> 1.0.7) + html_tokenizer + rainbow + rubocop (~> 0.51) + smart_properties erubi (1.8.0) execjs (2.7.0) ffi (1.9.25) @@ -215,6 +239,7 @@ GEM groupdate (4.1.1) activesupport (>= 4.2) hashdiff (0.3.8) + html_tokenizer (0.0.7) i18n (1.5.3) concurrent-ruby (~> 1.0) image_processing (1.7.1) @@ -259,7 +284,7 @@ GEM nokogiri (1.10.1) mini_portile2 (~> 2.4.0) orm_adapter (0.5.0) - pagy (1.3.2) + pagy (1.3.3) parallel (1.13.0) parser (2.6.0.0) ast (~> 2.4.0) @@ -280,6 +305,8 @@ GEM rack (2.0.6) rack-attack (5.4.2) rack (>= 1.0, < 3) + rack-mini-profiler (1.0.2) + rack (>= 1.2.0) rack-protection (2.0.5) rack rack-proxy (0.6.5) @@ -304,7 +331,7 @@ GEM responders (2.4.1) actionpack (>= 4.2.0, < 6.0) railties (>= 4.2.0, < 6.0) - rubocop (0.63.1) + rubocop (0.64.0) jaro_winkler (~> 1.5.1) parallel (~> 1.10) parser (>= 2.5, != 2.5.1.1) @@ -345,6 +372,7 @@ GEM simplecov-html (0.10.2) simpleidn (0.1.1) unf (~> 0.1.4) + smart_properties (1.13.1) spring (2.0.2) activesupport (>= 4.2) spring-watcher-listen (2.0.1) @@ -358,6 +386,7 @@ GEM activesupport (>= 4.0) sprockets (>= 3.0.0) swearjar (1.3.0) + telephone_number (1.3.4) thor (0.20.3) thread_safe (0.3.6) tilt (2.0.9) @@ -369,6 +398,7 @@ GEM unf_ext unf_ext (0.0.7.5) unicode-display_width (1.4.1) + uniform_notifier (1.12.1) warden (1.2.8) rack (>= 2.0.6) webmock (3.5.1) @@ -381,6 +411,7 @@ GEM wicked_pdf (1.1.0) xpath (3.2.0) nokogiri (~> 1.8) + zeitwerk (1.1.0) PLATFORMS ruby @@ -389,8 +420,9 @@ DEPENDENCIES ancestry aws-sdk-s3 bcrypt (~> 3.1.7) - bootsnap (>= 1.1.0) + bootsnap (>= 1.4.0) brakeman + bullet! bundler-audit byebug capybara (>= 2.15) @@ -402,6 +434,7 @@ DEPENDENCIES devise dotenv-rails email_address + erb_lint fit-commit font-awesome-rails friendly_id (~> 5.2.0) @@ -421,6 +454,7 @@ DEPENDENCIES pry-rails puma (~> 3.11) rack-attack + rack-mini-profiler rails! redis (~> 4.0) rein @@ -434,6 +468,7 @@ DEPENDENCIES simplecov spring spring-watcher-listen (~> 2.0.0) + telephone_number uglifier (>= 1.3.0) web-console! webmock @@ -441,7 +476,7 @@ DEPENDENCIES wicked_pdf RUBY VERSION - ruby 2.6.0p0 + ruby 2.6.1p33 BUNDLED WITH 2.0.1 diff --git a/README.md b/README.md index 6ac8f534b..b0c550c75 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,12 @@ [![Beta](https://omu.sh/assets/badge/beta.svg)](https://omu.sh "BAUM Beta") [![CircleCI](https://circleci.com/gh/omu/nokul/tree/master.svg?style=svg&circle-token=a25e63abc0e1e6c074750d9b2ce5396e3e279d82)](https://circleci.com/gh/omu/nokul/tree/master) +[![Maintainability](https://api.codeclimate.com/v1/badges/2d5a71c2587efbf29a7f/maintainability)](https://codeclimate.com/github/omu/nokul/maintainability) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/06aecaa466ee4731aba08dbee43d74eb)](https://www.codacy.com?utm_source=github.com&utm_medium=referral&utm_content=omu/nokul&utm_campaign=Badge_Grade) [![Codacy Badge](https://api.codacy.com/project/badge/Coverage/06aecaa466ee4731aba08dbee43d74eb)](https://www.codacy.com?utm_source=github.com&utm_medium=referral&utm_content=omu/nokul&utm_campaign=Badge_Coverage) [![security](https://hakiri.io/projects/cf546402fb7117/stacks/622121c74c17f4/622121c74c17f4.svg?repo_token=xo-yGdqDKXvCf-jypXd-)](https://hakiri.io/projects/cf546402fb7117/stacks/622121c74c17f4/shield) + [![Known Vulnerabilities](https://snyk.io/test/github/omu/nokul/badge.svg)](https://snyk.io/test/github/omu/nokul) + [Nokul](https://github.com/omu/nokul) aims to become a complete solution for universities that face many challanges while trying to manage all the complex procedures of a university online. diff --git a/Vagrantfile b/Vagrantfile index 948006fac..5947e1db6 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -1,15 +1,17 @@ # frozen_string_literal: true -Vagrant.configure('2') do |config| - env = {} +Vagrant.configure('2') do |config| # rubocop:disable Metrics/BlockLength + env = { + 'deploy_skip_seed' => ENV['DEPLOY_SKIP_SEED'] + } if ENV['LOCAL_CACHE_DIR'] FileUtils.mkdir_p ENV['LOCAL_CACHE_DIR'] unless Dir.exist?(ENV['LOCAL_CACHE_DIR']) - app_cache_dir = '/var/cache/app' + deploy_cache_dir = '/var/cache/app' - config.vm.synced_folder ENV['LOCAL_CACHE_DIR'], app_cache_dir + config.vm.synced_folder ENV['LOCAL_CACHE_DIR'], deploy_cache_dir - env.merge('LOCAL_CACHE_DIR': app_cache_dir) + env['deploy_cache_dir'] = deploy_cache_dir end config.vm.define 'dev', primary: true do |dev| @@ -23,6 +25,16 @@ Vagrant.configure('2') do |config| dev.vm.provision 'shell', name: 'environment', env: env, path: 'lib/scripts/environment.sh' dev.vm.provision 'shell', name: 'deploy', env: env, path: 'lib/scripts/deploy.sh' + + dev.trigger.after [:up, :reload] do |trigger| + trigger.info = 'Starting app...' + trigger.run_remote = { inline: 'app start' } + end + + dev.trigger.before :halt do |trigger| + trigger.info = 'Stopping app...' + trigger.run_remote = { inline: 'app stop' } + end end config.vm.define 'paas', autostart: false do |paas| @@ -35,4 +47,16 @@ Vagrant.configure('2') do |config| trigger.run = { inline: 'bash lib/scripts/paas.sh' } end end + + config.vm.define 'ldap', autostart: true do |ldap| + ldap.vm.box = 'omu/debian-stable-server' + + ldap.vm.network :forwarded_port, guest: 389, host: 1389 + + ldap.vm.provider :lxc do |lxc| + lxc.customize 'cgroup.memory.limit_in_bytes', '2048M' + end + + ldap.vm.provision 'shell', path: 'lib/scripts/ldap.sh' + end end diff --git a/app.json b/app.json index 9f6018e02..4cc7ac0db 100644 --- a/app.json +++ b/app.json @@ -7,6 +7,7 @@ ], "scripts": { "dokku": { + "predeploy": "bin/plugdo bundle install -j4 --path /app/vendor/bundle --without development:test && bundle exec rails assets:precompile", "postdeploy": "bundle exec rails db:migrate" } } diff --git a/app/assets/stylesheets/custom/guest_background.css.erb b/app/assets/stylesheets/custom/guest_background.css.erb index 67e5de100..521eea626 100644 --- a/app/assets/stylesheets/custom/guest_background.css.erb +++ b/app/assets/stylesheets/custom/guest_background.css.erb @@ -1,5 +1,5 @@ body { - background-image: url('<%= asset_url("guest/login-bg-4.jpg") %>'); + background-image: url('<%= asset_url(Tenant.configuration.branding.background.file) %>'); background-position: center; background-repeat: no-repeat; background-size: cover; diff --git a/app/controllers/calendar_management/calendars_controller.rb b/app/controllers/calendar_management/calendars_controller.rb index 26b84b11f..e4c745957 100644 --- a/app/controllers/calendar_management/calendars_controller.rb +++ b/app/controllers/calendar_management/calendars_controller.rb @@ -70,8 +70,8 @@ def set_calendar def calendar_params params.require(:calendar) .permit( - :name, :senate_decision_date, :senate_decision_no, :description, :timezone, :academic_term_id, - unit_ids: [], calendar_events_attributes: %i[ + :name, :description, :timezone, :academic_term_id, + unit_ids: [], committee_decision_ids: [], calendar_events_attributes: %i[ id calendar_event_type_id start_time end_time location timezone visible _destroy ] ) diff --git a/app/controllers/course_management/available_course_groups_controller.rb b/app/controllers/course_management/available_course_groups_controller.rb index 0abace1bb..7e0bcc2b3 100644 --- a/app/controllers/course_management/available_course_groups_controller.rb +++ b/app/controllers/course_management/available_course_groups_controller.rb @@ -8,6 +8,7 @@ class AvailableCourseGroupsController < ApplicationController def new @available_course_group = @available_course.groups.new + @available_course_group.lecturers.build end def create diff --git a/app/helpers/link_helper.rb b/app/helpers/link_helper.rb index 6d63f8ce9..446ef0348 100644 --- a/app/helpers/link_helper.rb +++ b/app/helpers/link_helper.rb @@ -25,6 +25,13 @@ module LinkHelper class: 'btn btn-outline-success btn-sm' } }, + file: { + icon: 'file-word-o', + text: I18n.t('action_group.file'), + options: { + class: 'btn btn-secondary btn-sm' + } + }, new: { icon: 'plus', text: I18n.t('action_group.add'), @@ -46,34 +53,68 @@ module LinkHelper options: { class: 'btn btn-outline-info btn-sm' } - }, - file: { - icon: 'file-word-o', - text: I18n.t('action_group.file'), - options: { - class: 'btn btn-secondary btn-sm' - } } }.freeze + # Usage: + # link_to_#{action}(path) + # link_to_#{action}(path, options = {}) + # link_to_#{action}(text, path, options = {}) LINKS.each do |action, configuration| define_method("link_to_#{action}") do |*args| link_builder(args, configuration) end end + BASE_ACTIONS = %i[show edit destroy].freeze + + # Basic Usage: + # link_to_actions(path) + # link_to_actions(course, except: :show) + # + # Advance Usage: + # link_to_actions(path, + # scope: :admin, + # except: :show, + # edit: { text: 'Edit Text', options: { class: 'btn btn-danger' } }, + # destroy: { options: { class: 'btn btn-danger' } }) + def link_to_actions(path, options = {}) + actions = BASE_ACTIONS - [*options[:except]].map(&:to_sym) + safe_join( + create_links_for(path, actions, options), + ' ' + ) + end + private + def create_links_for(path, actions, options = {}) + config = { + edit: { path_prefix: :edit } + } + + actions.map do |action| + send("link_to_#{action}", + options.dig(action, :text), + [*config.dig(action, :path_prefix), *options[:scope], *path], + options.dig(action, :options)) + end + end + def link_builder(args, configuration) - text, path = split_args_for_link_to(args) + text, path, custom_options = split_args_for_link_to(args) + options = configuration.fetch(:options, {}) + options = options.merge(custom_options) if custom_options.is_a?(Hash) + link_to( fa_icon(configuration[:icon], text: text || configuration[:text]), path, - configuration.fetch(:options, {}) + options ) end def split_args_for_link_to(args) - args.length == 1 ? [nil, *args] : args + number_of_args_check = args.last.is_a?(::Hash) ? 2 : 1 + args.length == number_of_args_check ? [nil, *args] : args end end diff --git a/app/lib/nokul/version.rb b/app/lib/nokul/version.rb index d27421e6b..e7839ee68 100644 --- a/app/lib/nokul/version.rb +++ b/app/lib/nokul/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Nokul - VERSION = '0.5.2' + VERSION = '0.5.3' end diff --git a/app/models/academic_term.rb b/app/models/academic_term.rb index dc071378a..f86197d04 100644 --- a/app/models/academic_term.rb +++ b/app/models/academic_term.rb @@ -11,10 +11,10 @@ class AcademicTerm < ApplicationRecord has_many :registration_documents, dependent: :nullify # validations - validates :year, presence: true, uniqueness: { scope: :term }, length: { maximum: 255 } - validates :start_of_term, presence: true - validates :end_of_term, presence: true validates :active, inclusion: { in: [true, false] } + validates :end_of_term, presence: true + validates :start_of_term, presence: true + validates :year, presence: true, uniqueness: { scope: :term }, length: { maximum: 255 } validates_with AcademicTermValidator # scopes diff --git a/app/models/address.rb b/app/models/address.rb index e199a499a..778ca8bb3 100644 --- a/app/models/address.rb +++ b/app/models/address.rb @@ -7,13 +7,13 @@ class Address < ApplicationRecord enum type: { formal: 1, informal: 2 } # relations - belongs_to :user belongs_to :district + belongs_to :user # validations - validates :type, uniqueness: { scope: :user }, inclusion: { in: types.keys } - validates :phone_number, length: { maximum: 255 } validates :full_address, presence: true, length: { maximum: 255 } + validates :phone_number, length: { maximum: 255 } + validates :type, uniqueness: { scope: :user }, inclusion: { in: types.keys } validates_with AddressAndIdentityValidator, on: :create # callbacks diff --git a/app/models/administrative_function.rb b/app/models/administrative_function.rb index 65fc1b0c4..aa964424a 100644 --- a/app/models/administrative_function.rb +++ b/app/models/administrative_function.rb @@ -6,8 +6,8 @@ class AdministrativeFunction < ApplicationRecord has_many :duties, through: :positions # validations - validates :name, presence: true, uniqueness: true validates :code, uniqueness: true, numericality: { only_integer: true, greater_than: 0 } + validates :name, presence: true, uniqueness: true, length: { maximum: 255 } # callbacks before_validation { self.name = name.capitalize_turkish if name } diff --git a/app/models/agenda.rb b/app/models/agenda.rb index ff68a9df7..4ebe2bee7 100644 --- a/app/models/agenda.rb +++ b/app/models/agenda.rb @@ -18,12 +18,13 @@ class Agenda < ApplicationRecord enum status: { recent: 0, decided: 1, delayed: 2 } # relations - has_one_attached :agenda_file - belongs_to :unit belongs_to :agenda_type + belongs_to :unit has_many :meeting_agendas, dependent: :destroy has_many :meetings, through: :meeting_agendas, source: :committee_meeting + has_one_attached :agenda_file + # validations validates :description, presence: true, length: { maximum: 65_535 } validates :status, inclusion: { in: statuses.keys } diff --git a/app/models/available_course.rb b/app/models/available_course.rb index 30ac2cd6c..609dabdb9 100644 --- a/app/models/available_course.rb +++ b/app/models/available_course.rb @@ -16,16 +16,16 @@ class AvailableCourse < ApplicationRecord # relations belongs_to :academic_term - belongs_to :curriculum + belongs_to :coordinator, class_name: 'Employee' belongs_to :course + belongs_to :curriculum belongs_to :unit - belongs_to :coordinator, class_name: 'Employee' - has_many :groups, class_name: 'AvailableCourseGroup', dependent: :destroy has_many :evaluation_types, class_name: 'CourseEvaluationType', dependent: :destroy + has_many :groups, class_name: 'AvailableCourseGroup', dependent: :destroy # validations - validates :course, uniqueness: { scope: %i[academic_term curriculum] } validates :assessments_approved, inclusion: { in: [true, false] } + validates :course, uniqueness: { scope: %i[academic_term curriculum] } # callbacks before_validation(on: :create) do diff --git a/app/models/available_course_group.rb b/app/models/available_course_group.rb index 3189c584c..55546c7d3 100644 --- a/app/models/available_course_group.rb +++ b/app/models/available_course_group.rb @@ -10,6 +10,8 @@ class AvailableCourseGroup < ApplicationRecord accepts_nested_attributes_for :lecturers, reject_if: :all_blank, allow_destroy: true # validations + validates :lecturers, presence: { message: :cannot_empty } validates :name, presence: true, uniqueness: { scope: :available_course }, length: { maximum: 255 } validates :quota, allow_nil: true, numericality: { only_integer: true, greater_than_or_equal_to: 1 } + validates_associated :lecturers end diff --git a/app/models/available_course_lecturer.rb b/app/models/available_course_lecturer.rb index f497eb940..3233ffc9e 100644 --- a/app/models/available_course_lecturer.rb +++ b/app/models/available_course_lecturer.rb @@ -13,5 +13,6 @@ class AvailableCourseLecturer < ApplicationRecord # scopes scope :coordinator, -> { where(coordinator: true) } + # delegations delegate :title, :identities, to: :lecturer end diff --git a/app/models/calendar.rb b/app/models/calendar.rb index c096b91b5..9c20a8770 100644 --- a/app/models/calendar.rb +++ b/app/models/calendar.rb @@ -11,8 +11,10 @@ class Calendar < ApplicationRecord # relations belongs_to :academic_term + has_many :calendar_committee_decisions, dependent: :destroy has_many :calendar_events, dependent: :destroy has_many :calendar_event_types, through: :calendar_events + has_many :committee_decisions, through: :calendar_committee_decisions has_many :unit_calendars, dependent: :destroy has_many :units, through: :unit_calendars, before_add: proc { |calendar, unit| create_sub_calendars(calendar, unit) }, @@ -23,11 +25,10 @@ class Calendar < ApplicationRecord # validations validates :name, presence: true, - uniqueness: { scope: %i[senate_decision_no academic_term_id] }, + uniqueness: { scope: :academic_term_id }, length: { maximum: 255 } + validates :committee_decisions, presence: true validates :timezone, presence: true, length: { maximum: 255 } - validates :senate_decision_date, presence: true, length: { maximum: 255 } - validates :senate_decision_no, presence: true, length: { maximum: 255 } validates :description, length: { maximum: 65_535 } # delegations diff --git a/app/models/calendar_committee_decision.rb b/app/models/calendar_committee_decision.rb new file mode 100644 index 000000000..f85873161 --- /dev/null +++ b/app/models/calendar_committee_decision.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +class CalendarCommitteeDecision < ApplicationRecord + # relations + belongs_to :calendar + belongs_to :committee_decision + + # validations + validates :calendar, uniqueness: { scope: :committee_decision } +end diff --git a/app/models/calendar_event.rb b/app/models/calendar_event.rb index 5c98f0c91..088fd79cb 100644 --- a/app/models/calendar_event.rb +++ b/app/models/calendar_event.rb @@ -6,9 +6,9 @@ class CalendarEvent < ApplicationRecord belongs_to :calendar_event_type # validations - validates :timezone, presence: true, length: { maximum: 255 } - validates :start_time, presence: true validates :calendar, uniqueness: { scope: %i[calendar_event_type] } + validates :start_time, presence: true + validates :timezone, presence: true, length: { maximum: 255 } validates :visible, inclusion: { in: [true, false] } validates_with CalendarEventValidator diff --git a/app/models/city.rb b/app/models/city.rb index 2491ae9e9..eaaef40d6 100644 --- a/app/models/city.rb +++ b/app/models/city.rb @@ -18,12 +18,12 @@ class City < ApplicationRecord has_many :units, through: :districts # validations - validates :name, presence: true, uniqueness: { scope: %i[country_id] }, length: { maximum: 255 } validates :alpha_2_code, presence: true, uniqueness: true, length: { maximum: 255 } + validates :name, presence: true, uniqueness: { scope: %i[country_id] }, length: { maximum: 255 } # callbacks before_validation do - self.name = name.capitalize_turkish if name self.alpha_2_code = alpha_2_code.upcase(:turkic) if alpha_2_code + self.name = name.capitalize_turkish if name end end diff --git a/app/models/committee_decision.rb b/app/models/committee_decision.rb index 970341f1e..70b93aa02 100644 --- a/app/models/committee_decision.rb +++ b/app/models/committee_decision.rb @@ -4,6 +4,7 @@ class CommitteeDecision < ApplicationRecord # relations belongs_to :meeting_agenda has_one :agenda, through: :meeting_agenda + has_many :calendar_committee_decisions, dependent: :destroy # validations validates :description, presence: true, length: { maximum: 65_535 } diff --git a/app/models/course.rb b/app/models/course.rb index 8130a5bbf..b4cf2c881 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -20,18 +20,18 @@ class Course < ApplicationRecord # relations belongs_to :course_type - belongs_to :unit belongs_to :language + belongs_to :unit # validations - validates :name, presence: true, uniqueness: { scope: :unit_id }, length: { maximum: 255 } validates :code, presence: true, uniqueness: true, length: { maximum: 255 } - validates :theoric, numericality: { greater_than_or_equal_to: 0 } - validates :practice, numericality: { greater_than_or_equal_to: 0 } - validates :laboratory, numericality: { greater_than_or_equal_to: 0 } validates :credit, numericality: { greater_than_or_equal_to: ->(course) { course.course_type.try(:min_credit).to_i } } + validates :laboratory, numericality: { greater_than_or_equal_to: 0 } + validates :name, presence: true, uniqueness: { scope: :unit_id }, length: { maximum: 255 } + validates :practice, numericality: { greater_than_or_equal_to: 0 } validates :program_type, inclusion: { in: program_types.keys } validates :status, inclusion: { in: statuses.keys } + validates :theoric, numericality: { greater_than_or_equal_to: 0 } # callbacks before_validation do diff --git a/app/models/course_assessment_method.rb b/app/models/course_assessment_method.rb index b06324acd..0cdba88fb 100644 --- a/app/models/course_assessment_method.rb +++ b/app/models/course_assessment_method.rb @@ -2,8 +2,8 @@ class CourseAssessmentMethod < ApplicationRecord # relations - belongs_to :course_evaluation_type belongs_to :assessment_method + belongs_to :course_evaluation_type # validations validates :percentage, numericality: { diff --git a/app/models/course_evaluation_type.rb b/app/models/course_evaluation_type.rb index 72912dceb..fc9c4f778 100644 --- a/app/models/course_evaluation_type.rb +++ b/app/models/course_evaluation_type.rb @@ -18,6 +18,6 @@ class CourseEvaluationType < ApplicationRecord validates :evaluation_type, uniqueness: { scope: :available_course } validates_with CourseEvaluationTypeValidator - # delegate + # delegations delegate :name, to: :evaluation_type end diff --git a/app/models/course_group.rb b/app/models/course_group.rb index 0782fd1d8..8a017ba24 100644 --- a/app/models/course_group.rb +++ b/app/models/course_group.rb @@ -15,20 +15,20 @@ class CourseGroup < ApplicationRecord search_keys :unit_id, :course_group_type_id # relations - belongs_to :unit belongs_to :course_group_type + belongs_to :unit has_many :group_courses, dependent: :destroy has_many :courses, through: :group_courses has_many :curriculum_course_groups, dependent: :destroy # validations + validates :course_ids, presence: true validates :name, presence: true, uniqueness: { scope: :unit_id }, length: { maximum: 255 } validates :total_ects_condition, numericality: { only_integer: true, greater_than_or_equal_to: 0, less_than_or_equal_to: 300 } - validates :course_ids, presence: true # callbacks before_validation { self.name = name.capitalize_turkish if name } diff --git a/app/models/curriculum.rb b/app/models/curriculum.rb index bce0682a9..ec4bdd17f 100644 --- a/app/models/curriculum.rb +++ b/app/models/curriculum.rb @@ -25,6 +25,7 @@ class Curriculum < ApplicationRecord # relations belongs_to :unit + has_many :available_courses, dependent: :destroy has_many :curriculum_programs, dependent: :destroy has_many :programs, through: :curriculum_programs, source: :unit @@ -34,7 +35,6 @@ class Curriculum < ApplicationRecord has_many :courses, through: :semesters has_many :curriculum_course_groups, through: :semesters has_many :course_groups, through: :curriculum_course_groups - has_many :available_courses, dependent: :destroy # nested models accepts_nested_attributes_for :semesters, reject_if: :all_blank, allow_destroy: true diff --git a/app/models/curriculum_course.rb b/app/models/curriculum_course.rb index e2f591b25..08d21dc0a 100644 --- a/app/models/curriculum_course.rb +++ b/app/models/curriculum_course.rb @@ -8,8 +8,8 @@ class CurriculumCourse < ApplicationRecord # relations belongs_to :course - belongs_to :curriculum_semester belongs_to :curriculum_course_group, optional: true + belongs_to :curriculum_semester # validations validates :ects, numericality: { greater_than: 0 } diff --git a/app/models/curriculum_course_group.rb b/app/models/curriculum_course_group.rb index a28663ff5..5f1867398 100644 --- a/app/models/curriculum_course_group.rb +++ b/app/models/curriculum_course_group.rb @@ -2,10 +2,10 @@ class CurriculumCourseGroup < ApplicationRecord # relations - has_many :curriculum_courses, dependent: :destroy - has_many :courses, through: :curriculum_courses belongs_to :course_group belongs_to :curriculum_semester + has_many :curriculum_courses, dependent: :destroy + has_many :courses, through: :curriculum_courses # nested models accepts_nested_attributes_for :curriculum_courses diff --git a/app/models/curriculum_semester.rb b/app/models/curriculum_semester.rb index c970e1edd..ac7e6ba57 100644 --- a/app/models/curriculum_semester.rb +++ b/app/models/curriculum_semester.rb @@ -4,10 +4,10 @@ class CurriculumSemester < ApplicationRecord include EnumForTerm # relations + belongs_to :curriculum, counter_cache: :semesters_count, inverse_of: :semesters has_many :curriculum_courses, dependent: :destroy has_many :curriculum_course_groups, dependent: :destroy has_many :courses, through: :curriculum_courses - belongs_to :curriculum, counter_cache: :semesters_count, inverse_of: :semesters # validations validates :sequence, numericality: { greater_than: 0 }, diff --git a/app/models/district.rb b/app/models/district.rb index c14db65ed..f213b19c2 100644 --- a/app/models/district.rb +++ b/app/models/district.rb @@ -13,8 +13,8 @@ class District < ApplicationRecord # relations belongs_to :city - has_many :units, dependent: :nullify has_many :addresses, dependent: :nullify + has_many :units, dependent: :nullify # validations validates :name, presence: true, uniqueness: { scope: %i[city_id] }, length: { maximum: 255 } diff --git a/app/models/employee.rb b/app/models/employee.rb index dc4ecb251..347528f8c 100644 --- a/app/models/employee.rb +++ b/app/models/employee.rb @@ -2,8 +2,8 @@ class Employee < ApplicationRecord # relations - belongs_to :user belongs_to :title + belongs_to :user has_many :duties, dependent: :destroy has_many :units, through: :duties has_many :positions, through: :duties diff --git a/app/models/identity.rb b/app/models/identity.rb index f0d17ff5f..713df6e71 100644 --- a/app/models/identity.rb +++ b/app/models/identity.rb @@ -9,34 +9,34 @@ class Identity < ApplicationRecord enum marital_status: { single: 1, married: 2, divorced: 3, unknown: 4 } # relations - belongs_to :user belongs_to :student, optional: true + belongs_to :user # validations - validates :type, inclusion: { in: types.keys } - validates :first_name, presence: true, length: { maximum: 255 } - validates :last_name, presence: true, length: { maximum: 255 } - validates :mothers_name, length: { maximum: 255 } + validates :date_of_birth, presence: true validates :fathers_name, length: { maximum: 255 } + validates :first_name, presence: true, length: { maximum: 255 } validates :gender, inclusion: { in: genders.keys } + validates :last_name, presence: true, length: { maximum: 255 } validates :marital_status, allow_nil: true, inclusion: { in: marital_statuses.keys } + validates :mothers_name, length: { maximum: 255 } validates :place_of_birth, presence: true, length: { maximum: 255 } - validates :date_of_birth, presence: true validates :registered_to, length: { maximum: 255 } validates :student_id, uniqueness: true, allow_nil: true + validates :type, inclusion: { in: types.keys } validates_with AddressAndIdentityValidator, on: :create # scopes - scope :user_identity, -> { formal.find_by(student_id: nil) } scope :student_identity, -> { formal.where.not(student_id: nil).first } + scope :user_identity, -> { formal.find_by(student_id: nil) } # callbacks before_save do - self.type = 'informal' if type.blank? + self.fathers_name = fathers_name.capitalize_turkish if fathers_name self.first_name = first_name.capitalize_turkish self.last_name = last_name.upcase(:turkic) self.mothers_name = mothers_name.capitalize_turkish if mothers_name - self.fathers_name = fathers_name.capitalize_turkish if fathers_name self.place_of_birth = place_of_birth.capitalize_turkish if place_of_birth + self.type = 'informal' if type.blank? end end diff --git a/app/models/position.rb b/app/models/position.rb index 30a7f0f73..6b777161a 100644 --- a/app/models/position.rb +++ b/app/models/position.rb @@ -2,8 +2,8 @@ class Position < ApplicationRecord # relations - belongs_to :duty belongs_to :administrative_function + belongs_to :duty # validations validates :start_date, presence: true diff --git a/app/models/prospective_student.rb b/app/models/prospective_student.rb index f3e61aaef..f7a0850e7 100644 --- a/app/models/prospective_student.rb +++ b/app/models/prospective_student.rb @@ -14,55 +14,55 @@ class ProspectiveStudent < ApplicationRecord search_keys :meb_status, :military_status, :obs_status, :unit_id, :student_entrance_type_id, :registered # enumerations + enum additional_score: { handicapped: 1 } enum gender: { male: 1, female: 2 } enum nationality: { turkish: 1, kktc: 2, foreign: 3 } enum placement_type: { general_score: 1, additional_score: 2 } - enum additional_score: { handicapped: 1 } # relations - belongs_to :unit - belongs_to :language, optional: true - belongs_to :student_disability_type, optional: true belongs_to :high_school_type, optional: true + belongs_to :language, optional: true belongs_to :student_entrance_type + belongs_to :student_disability_type, optional: true + belongs_to :unit # validations - validates :id_number, presence: true, uniqueness: { scope: %i[unit_id exam_score] }, length: { is: 11 } - validates :first_name, presence: true, length: { maximum: 255 } - validates :last_name, presence: true, length: { maximum: 255 } + validates :additional_score, allow_nil: true, numericality: { only_integer: true, greater_than_or_equal_to: 0 } + validates :address, length: { maximum: 255 } + validates :email, length: { maximum: 255 } + validates :exam_score, allow_nil: true, numericality: { greater_than_or_equal_to: 0 } validates :fathers_name, length: { maximum: 255 } - validates :mothers_name, length: { maximum: 255 } + validates :first_name, presence: true, length: { maximum: 255 } validates :gender, inclusion: { in: genders.keys } - validates :nationality, allow_nil: true, inclusion: { in: nationalities.keys } - validates :place_of_birth, length: { maximum: 255 } - validates :registration_city, length: { maximum: 255 } - validates :registration_district, length: { maximum: 255 } validates :high_school_code, length: { maximum: 255 } validates :high_school_branch, length: { maximum: 255 } - validates :state_of_education, allow_nil: true, numericality: { only_integer: true, greater_than_or_equal_to: 0 } validates :high_school_graduation_year, allow_nil: true, numericality: { only_integer: true, greater_than_or_equal_to: 1910, less_than_or_equal_to: 2050 } - validates :placement_type, allow_nil: true, numericality: { only_integer: true, greater_than_or_equal_to: 0 } - validates :exam_score, allow_nil: true, numericality: { greater_than_or_equal_to: 0 } - validates :address, length: { maximum: 255 } validates :home_phone, length: { maximum: 255 } - validates :mobile_phone, length: { maximum: 255 } - validates :email, length: { maximum: 255 } - validates :top_student, inclusion: { in: [true, false] } - validates :placement_score, allow_nil: true, numericality: { greater_than_or_equal_to: 0 } - validates :placement_rank, allow_nil: true, numericality: { only_integer: true, greater_than_or_equal_to: 0 } - validates :preference_order, allow_nil: true, numericality: { only_integer: true, greater_than_or_equal_to: 0 } - validates :placement_score_type, length: { maximum: 255 } - validates :additional_score, allow_nil: true, numericality: { only_integer: true, greater_than_or_equal_to: 0 } + validates :id_number, presence: true, uniqueness: { scope: %i[unit_id exam_score] }, length: { is: 11 } + validates :last_name, presence: true, length: { maximum: 255 } validates :meb_status, inclusion: { in: [true, false] } validates :military_status, inclusion: { in: [true, false] } + validates :mobile_phone, length: { maximum: 255 } + validates :mothers_name, length: { maximum: 255 } + validates :nationality, allow_nil: true, inclusion: { in: nationalities.keys } + validates :obs_registered_program, length: { maximum: 255 } validates :obs_status, inclusion: { in: [true, false] } + validates :place_of_birth, length: { maximum: 255 } + validates :placement_rank, allow_nil: true, numericality: { only_integer: true, greater_than_or_equal_to: 0 } + validates :placement_score, allow_nil: true, numericality: { greater_than_or_equal_to: 0 } + validates :placement_score_type, length: { maximum: 255 } + validates :placement_type, allow_nil: true, numericality: { only_integer: true, greater_than_or_equal_to: 0 } + validates :preference_order, allow_nil: true, numericality: { only_integer: true, greater_than_or_equal_to: 0 } + validates :registration_city, length: { maximum: 255 } validates :registered, inclusion: { in: [true, false] } - validates :obs_registered_program, length: { maximum: 255 } + validates :registration_district, length: { maximum: 255 } + validates :state_of_education, allow_nil: true, numericality: { only_integer: true, greater_than_or_equal_to: 0 } + validates :top_student, inclusion: { in: [true, false] } # callbacks before_create do diff --git a/app/models/registration_document.rb b/app/models/registration_document.rb index 0a8bfe11b..41cf845ca 100644 --- a/app/models/registration_document.rb +++ b/app/models/registration_document.rb @@ -13,13 +13,13 @@ class RegistrationDocument < ApplicationRecord ) # relations - belongs_to :unit belongs_to :academic_term belongs_to :document_type + belongs_to :unit # validations - validates :unit_id, uniqueness: { scope: %i[academic_term document_type] } validates :description, length: { maximum: 65_535 } + validates :unit_id, uniqueness: { scope: %i[academic_term document_type] } # delegates delegate :name, :active, to: :document_type diff --git a/app/models/student_entrance_type.rb b/app/models/student_entrance_type.rb index 24fb12e3e..89ba06f11 100644 --- a/app/models/student_entrance_type.rb +++ b/app/models/student_entrance_type.rb @@ -5,5 +5,6 @@ class StudentEntranceType < ApplicationRecord include ReferenceCallbacks include ReferenceSearch - has_many :prospective_students, dependent: :destroy + # relations + has_many :prospective_students, dependent: :nullify end diff --git a/app/models/title.rb b/app/models/title.rb index ef6063933..745ef3f84 100644 --- a/app/models/title.rb +++ b/app/models/title.rb @@ -8,7 +8,7 @@ class Title < ApplicationRecord has_many :employees, dependent: :nullify # validations - validates :name, presence: true, uniqueness: { scope: %i[code branch] }, length: { maximum: 255 } - validates :code, presence: true, length: { maximum: 255 } validates :branch, presence: true, length: { maximum: 255 } + validates :code, presence: true, length: { maximum: 255 } + validates :name, presence: true, uniqueness: { scope: %i[code branch] }, length: { maximum: 255 } end diff --git a/app/models/unit.rb b/app/models/unit.rb index 84a1b14a0..5499a2f0d 100644 --- a/app/models/unit.rb +++ b/app/models/unit.rb @@ -60,18 +60,19 @@ class Unit < ApplicationRecord # scopes scope :active, -> { where(unit_status: UnitStatus.active) } - scope :partially_passive, -> { where(unit_status: UnitStatus.partially_passive) } - scope :others, -> { where(unit_type: UnitType.other) } - scope :faculties, -> { where(unit_type: UnitType.faculty) } + scope :administratives, -> { where(unit_type: UnitType.administrative) } + scope :committees, -> { where(unit_type: UnitType.committee) } scope :departments, -> { where(unit_type: UnitType.department) } - scope :majors, -> { where(unit_type: UnitType.major) } - scope :undergraduate_programs, -> { where(unit_type: UnitType.undergraduate_program) } + scope :faculties, -> { where(unit_type: UnitType.faculty) } scope :graduate_programs, -> { where(unit_type: UnitType.graduate_program) } scope :institutes, -> { where(unit_type: UnitType.institute) } - scope :research_centers, -> { where(unit_type: UnitType.research_center) } - scope :committees, -> { where(unit_type: UnitType.committee) } - scope :administratives, -> { where(unit_type: UnitType.administrative) } + scope :majors, -> { where(unit_type: UnitType.major) } + scope :others, -> { where(unit_type: UnitType.other) } + scope :partially_passive, -> { where(unit_status: UnitStatus.partially_passive) } scope :programs, -> { where(unit_type: UnitType.program) } + scope :research_centers, -> { where(unit_type: UnitType.research_center) } + scope :senates, -> { where(unit_type: UnitType.senate) } + scope :undergraduate_programs, -> { where(unit_type: UnitType.undergraduate_program) } scope :without_programs, -> { where.not(unit_type: UnitType.program) } scope :academic, -> { diff --git a/app/models/unit_type.rb b/app/models/unit_type.rb index 69e7295a1..6a965e4e8 100644 --- a/app/models/unit_type.rb +++ b/app/models/unit_type.rb @@ -21,6 +21,7 @@ class UnitType < ApplicationRecord # scopes scope :program, -> { where(group: %w[undergraduate_program graduate_program]) } + scope :senate, -> { where(name: 'Senato') } # relations has_many :units, dependent: :nullify diff --git a/app/models/user.rb b/app/models/user.rb index 4335b20ae..a9136cdb6 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -16,20 +16,18 @@ class User < ApplicationRecord # relations has_one_attached :avatar + has_many :addresses, dependent: :destroy + has_many :articles, dependent: :destroy + has_many :certifications, dependent: :destroy + has_many :identities, dependent: :destroy has_many :employees, dependent: :destroy + has_many :projects, dependent: :destroy has_many :students, dependent: :destroy - has_many :identities, dependent: :destroy - has_many :addresses, dependent: :destroy has_many :duties, through: :employees has_many :units, through: :employees has_many :positions, through: :duties has_many :administrative_functions, through: :duties - # academic studies - has_many :certifications, dependent: :destroy - has_many :articles, dependent: :destroy - has_many :projects, dependent: :destroy - # validations validates :email, presence: true, uniqueness: true, length: { maximum: 255 } validates :id_number, uniqueness: true, numericality: { only_integer: true }, length: { is: 11 } diff --git a/app/services/xokul/kps.rb b/app/services/xokul/kps.rb deleted file mode 100644 index 5b9154deb..000000000 --- a/app/services/xokul/kps.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -module Xokul - module Kps - module_function - - def verify_identity(id_number:, first_name:, last_name:, year_of_birth:) - Connection.request( - '/kps/verifications/identities', - params: { - id_number: id_number, - first_name: first_name, - last_name: last_name, - year_of_birth: year_of_birth - } - ) - end - end -end diff --git a/app/services/xokul/kps/verification.rb b/app/services/xokul/kps/verification.rb new file mode 100644 index 000000000..7ca156b90 --- /dev/null +++ b/app/services/xokul/kps/verification.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +module Xokul + module Kps + module Verification + module_function + + # rubocop:disable Metrics/MethodLength + def id_card(**option) + Connection.request( + '/kps/verifications/id_cards', params: { + id_number: option.fetch(:id_number), + first_name: option.fetch(:first_name), + last_name: option.fetch(:last_name), + day_of_birth: option.fetch(:day_of_birth), + month_of_birth: option.fetch(:month_of_birth), + year_of_birth: option.fetch(:year_of_birth), + serial: option[:serial], + number: option[:number], + document_number: option[:document_number] + } + )[:status] + end + # rubocop:enable Metrics/MethodLength + end + end +end diff --git a/app/validators/available_course_lecturer_validator.rb b/app/validators/available_course_lecturer_validator.rb index b8d5798fe..cb89316ee 100644 --- a/app/validators/available_course_lecturer_validator.rb +++ b/app/validators/available_course_lecturer_validator.rb @@ -2,9 +2,25 @@ class AvailableCourseLecturerValidator < ActiveModel::Validator def validate(record) - lecturers = record.group.lecturers.reject { |lecturer| lecturer.equal?(record) } - return unless record.coordinator && lecturers.map(&:coordinator).any? + lecturers(record.group.lecturers.reject { |lecturer| lecturer.equal?(record) }) + + return if none_coordinator?(record, @lecturers) || any_coordinator?(record, @lecturers) record.errors[:coordinator] << I18n.t('coordinator', scope: %i[validators available_course_lecturer]) end + + def lecturers(course_lecturers) + @lecturers = + course_lecturers.map { |lecturer| lecturer unless lecturer.marked_for_destruction? }.compact + end + + private + + def any_coordinator?(record, lecturers) + !record.coordinator && lecturers.map(&:coordinator).any? + end + + def none_coordinator?(record, lecturers) + record.coordinator && lecturers.map(&:coordinator).none? + end end diff --git a/app/validators/course_evaluation_type_validator.rb b/app/validators/course_evaluation_type_validator.rb index bd5861f43..503fd4483 100644 --- a/app/validators/course_evaluation_type_validator.rb +++ b/app/validators/course_evaluation_type_validator.rb @@ -3,7 +3,8 @@ class CourseEvaluationTypeValidator < ActiveModel::Validator def validate(record) @evaluation_type = record - check_percentage(@evaluation_type.course_assessment_methods.map(&:percentage)) + assessment_methods(record.course_assessment_methods) + check_percentage(@assessments.map(&:percentage)) end def check_percentage(percentages) @@ -12,6 +13,11 @@ def check_percentage(percentages) @evaluation_type.errors[:base] << message('invalid_percentages') end + def assessment_methods(assessment_methods) + @assessments = + assessment_methods.map { |method| method unless method.marked_for_destruction? }.compact + end + private def message(key) diff --git a/app/views/account/addresses/index.html.erb b/app/views/account/addresses/index.html.erb index c36a21af6..eb5cfcf2a 100644 --- a/app/views/account/addresses/index.html.erb +++ b/app/views/account/addresses/index.html.erb @@ -1,7 +1,7 @@
<%= link_to_back user_path(@user) %> <%= link_to_new(t('.new_address'), new_user_address_path(@user)) unless @user.addresses.informal.present? %> - <%= link_to (@addresses.formal.present? ? t('.update_from_mernis') : t('.create_from_mernis') ), save_from_mernis_user_addresses_path, class: "btn btn-outline-primary btn-sm" %> + <%= link_to (@addresses.formal.present? ? t('.update_from_mernis') : t('.create_from_mernis')), save_from_mernis_user_addresses_path, class: 'btn btn-outline-primary btn-sm' %>
@@ -14,8 +14,7 @@ <% else %> <%= t('.informal_address') %>
- <%= link_to_edit(edit_user_address_path(@user, address)) %> - <%= link_to_destroy(user_address_path(@user, address)) %> + <%= link_to_actions([@user, address], except: :show) %>
<% end %>
diff --git a/app/views/account/duties/_form.html.erb b/app/views/account/duties/_form.html.erb index 23fe3d6af..483f4a297 100644 --- a/app/views/account/duties/_form.html.erb +++ b/app/views/account/duties/_form.html.erb @@ -17,9 +17,9 @@
<%= f.input :unit_id, - collection: Unit.active.without_programs.order(:name), - required: true, - label_method: :names_depth_cache %> + collection: Unit.active.without_programs.order(:name), + required: true, + label_method: :names_depth_cache %>
<%= f.input :start_date, required: true %> @@ -41,4 +41,4 @@
-<%= render 'select2' %> \ No newline at end of file +<%= render 'select2' %> diff --git a/app/views/account/employees/_form.html.erb b/app/views/account/employees/_form.html.erb index 144871bfe..e028ad49a 100644 --- a/app/views/account/employees/_form.html.erb +++ b/app/views/account/employees/_form.html.erb @@ -14,10 +14,10 @@
<%= f.input :title_id, collection: Title.order(:name), required: true, - label_method: lambda { |title| title.name + ' - ' + title.branch } %> + label_method: lambda { |title| title.name + ' - ' + title.branch } %>
- <%= f.input :active, label: t('active') %> + <%= f.input :active, label: t('active') %>
<%= f.button :submit, class: 'btn btn-outline-success btn-sm' %> @@ -30,4 +30,4 @@
-<%= render 'select2' %> \ No newline at end of file +<%= render 'select2' %> diff --git a/app/views/account/identities/index.html.erb b/app/views/account/identities/index.html.erb index 5b3edefbc..00f292678 100644 --- a/app/views/account/identities/index.html.erb +++ b/app/views/account/identities/index.html.erb @@ -1,7 +1,7 @@
<%= link_to_back user_path(@user) %> <%= link_to_new(t('.new_identity'), new_user_identity_path(@user)) unless @user.identities.informal.present? %> - <%= link_to (@identities.formal.present? ? t('.update_from_mernis') : t('.create_from_mernis') ), save_from_mernis_user_identities_path, class: "btn btn-outline-primary btn-sm" %> + <%= link_to (@identities.formal.present? ? t('.update_from_mernis') : t('.create_from_mernis')), save_from_mernis_user_identities_path, class: 'btn btn-outline-primary btn-sm' %>
@@ -15,8 +15,7 @@ <% else %> <%= t('.informal_identity') %>
- <%= link_to_edit(edit_user_identity_path(@user, identity)) %> - <%= link_to_destroy(user_identity_path(@user, identity)) %> + <%= link_to_actions([@user, identity], except: :show) %>
<% end %>
diff --git a/app/views/account/positions/_form.html.erb b/app/views/account/positions/_form.html.erb index 274d18290..944e6e723 100644 --- a/app/views/account/positions/_form.html.erb +++ b/app/views/account/positions/_form.html.erb @@ -35,4 +35,4 @@ -<%= render 'select2' %> \ No newline at end of file +<%= render 'select2' %> diff --git a/app/views/account/profile/edit.html.erb b/app/views/account/profile/edit.html.erb index 2a742fca4..a466c44a5 100644 --- a/app/views/account/profile/edit.html.erb +++ b/app/views/account/profile/edit.html.erb @@ -19,7 +19,7 @@ <%= image_tag 'profile/avatar_placeholder.svg', width: '150px' %> <% end %>

<%= f.input :avatar, label: false, as: :file %>

-
+
@@ -94,7 +94,7 @@ <% unless current_user.employees.active.any? %>
-
+
<%= f.button :submit, t('save'), class: 'btn btn-outline-success btn-sm' %> <%= link_to_back(:back) %>
@@ -115,7 +115,7 @@
<%= f.input :public_studies, label: t('.public_studies'), as: :boolean, class: 'form-check-input' %>
-
+
<%= f.button :submit, t('save'), class: 'btn btn-outline-success btn-sm' %> <%= link_to_back(:back) %> diff --git a/app/views/active_storage/blobs/_blob.html.erb b/app/views/active_storage/blobs/_blob.html.erb index 049f57e80..b7af71c76 100644 --- a/app/views/active_storage/blobs/_blob.html.erb +++ b/app/views/active_storage/blobs/_blob.html.erb @@ -1,6 +1,6 @@ -
attachment--<%= blob.filename.extension %>"> +
<% if blob.representable? %> - <%= image_tag blob.representation(resize_to_fit: local_assigns[:in_gallery] ? [ 800, 600 ] : [ 1024, 768 ]) %> + <%= image_tag blob.representation(resize_to_fit: local_assigns[:in_gallery] ? [800, 600] : [1024, 768]) %> <% end %>
diff --git a/app/views/admin/assessment_methods/_form.html.erb b/app/views/admin/assessment_methods/_form.html.erb index d30f2dd00..9a475b774 100644 --- a/app/views/admin/assessment_methods/_form.html.erb +++ b/app/views/admin/assessment_methods/_form.html.erb @@ -1,10 +1,10 @@ <%= render 'layouts/builders/form', - namespace: 'admin', + namespace: 'admin', klass: @assessment_method, params: [ - { - field: 'name', - width: 12, - required: true - } + { + field: 'name', + width: 12, + required: true + } ] %> diff --git a/app/views/admin/assessment_methods/index.html.erb b/app/views/admin/assessment_methods/index.html.erb index 3794e1018..248b09bca 100644 --- a/app/views/admin/assessment_methods/index.html.erb +++ b/app/views/admin/assessment_methods/index.html.erb @@ -5,4 +5,4 @@ pagy: @pagy, card_header: t('.card_header'), params: ['name'], - actions: ['edit', 'destroy'] %> + actions: %w[edit destroy] %> diff --git a/app/views/admin/cities/_form.html.erb b/app/views/admin/cities/_form.html.erb index ff9f45d76..b75f42282 100644 --- a/app/views/admin/cities/_form.html.erb +++ b/app/views/admin/cities/_form.html.erb @@ -2,14 +2,14 @@ namespace: 'admin', klass: [@country, @city], params: [ - { - field: 'name', - width: 12, - required: true - }, - { - field: 'alpha_2_code', - width: 12, - required: true - } + { + field: 'name', + width: 12, + required: true + }, + { + field: 'alpha_2_code', + width: 12, + required: true + } ] %> diff --git a/app/views/admin/cities/show.html.erb b/app/views/admin/cities/show.html.erb index 13f83c1d7..75c3c443d 100644 --- a/app/views/admin/cities/show.html.erb +++ b/app/views/admin/cities/show.html.erb @@ -4,8 +4,7 @@
<%= fa_icon 'street-view' %><%= @city.name %>
- <%= link_to_edit([:admin, @country, @city]) %> - <%= link_to_destroy([:admin, @country, @city]) %> + <%= link_to_actions([@country, @city], scope: :admin, except: :show) %>
@@ -51,10 +50,7 @@ <%= district.name %> <%= district.mernis_code %> <%= district.active ? t('yes') : t('no') %> - - <%= link_to_edit([:edit, :admin, @country, @city, district]) %> - <%= link_to_destroy([:admin, @country, @city, district]) %> - + <%= link_to_actions([@country, @city, district], scope: :admin, except: :show) %> <% end %> diff --git a/app/views/admin/countries/_form.html.erb b/app/views/admin/countries/_form.html.erb index 7187e24e9..770ae3168 100644 --- a/app/views/admin/countries/_form.html.erb +++ b/app/views/admin/countries/_form.html.erb @@ -2,32 +2,32 @@ 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 - } + { + 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/countries/index.html.erb b/app/views/admin/countries/index.html.erb index da5f9b17c..381630f9c 100644 --- a/app/views/admin/countries/index.html.erb +++ b/app/views/admin/countries/index.html.erb @@ -4,5 +4,5 @@ collection: @countries, pagy: @pagy, card_header: t('.card_header'), - params: ['name', 'alpha_2_code', 'alpha_3_code', 'numeric_code', 'mernis_code', 'yoksis_code'], - actions: ['show', 'edit', 'destroy'] %> + params: %w[name alpha_2_code alpha_3_code numeric_code mernis_code yoksis_code], + actions: %w[show edit destroy] %> diff --git a/app/views/admin/countries/show.html.erb b/app/views/admin/countries/show.html.erb index 3c3d7b5ab..edee59cfd 100644 --- a/app/views/admin/countries/show.html.erb +++ b/app/views/admin/countries/show.html.erb @@ -4,8 +4,7 @@
<%= fa_icon 'globe' %><%= @country.name %>
- <%= link_to_edit([:edit, :admin, @country]) %> - <%= link_to_destroy([:admin, @country]) %> + <%= link_to_actions(@country, scope: :admin, except: :show) %>
@@ -66,11 +65,7 @@ <%= city.name %> <%= city.alpha_2_code %> - - <%= link_to_show([:admin, @country, city]) %> - <%= link_to_edit([:edit, :admin, @country, city]) %> - <%= link_to_destroy([:admin, @country, city]) %> - + <%= link_to_actions([@country, city], scope: :admin) %> <% end %> diff --git a/app/views/admin/districts/_form.html.erb b/app/views/admin/districts/_form.html.erb index e0d573280..b42bc8c70 100644 --- a/app/views/admin/districts/_form.html.erb +++ b/app/views/admin/districts/_form.html.erb @@ -2,13 +2,13 @@ namespace: 'admin', klass: [@city.country, @city, @district], params: [ - { - field: 'name', - width: 12, - required: true - }, - { - field: 'mernis_code', - width: 12 - } + { + field: 'name', + width: 12, + required: true + }, + { + field: 'mernis_code', + width: 12 + } ] %> diff --git a/app/views/admin/document_types/_form.html.erb b/app/views/admin/document_types/_form.html.erb index 977bc70c2..236264897 100644 --- a/app/views/admin/document_types/_form.html.erb +++ b/app/views/admin/document_types/_form.html.erb @@ -2,14 +2,14 @@ namespace: 'admin', klass: @document_type, params: [ - { - field: 'name', - width: 12, - required: true - }, - { - field: 'active', - width: 12, - required: true - } + { + field: 'name', + width: 12, + required: true + }, + { + field: 'active', + width: 12, + required: true + } ] %> diff --git a/app/views/admin/document_types/index.html.erb b/app/views/admin/document_types/index.html.erb index 11d233e68..4084e4888 100644 --- a/app/views/admin/document_types/index.html.erb +++ b/app/views/admin/document_types/index.html.erb @@ -4,5 +4,5 @@ collection: @document_types, pagy: @pagy, card_header: t('.card_header'), - params: ['name', 'active'], - actions: ['edit', 'destroy'] %> + params: %w[name active], + actions: %w[edit destroy] %> diff --git a/app/views/admin/evaluation_types/_form.html.erb b/app/views/admin/evaluation_types/_form.html.erb index 1a64b1df9..c95379c85 100644 --- a/app/views/admin/evaluation_types/_form.html.erb +++ b/app/views/admin/evaluation_types/_form.html.erb @@ -1,10 +1,10 @@ <%= render 'layouts/builders/form', - namespace: 'admin', + namespace: 'admin', klass: @evaluation_type, params: [ - { - field: 'name', - width: 12, - required: true - } + { + field: 'name', + width: 12, + required: true + } ] %> diff --git a/app/views/admin/evaluation_types/index.html.erb b/app/views/admin/evaluation_types/index.html.erb index 8cc9cf1b6..4106fc586 100644 --- a/app/views/admin/evaluation_types/index.html.erb +++ b/app/views/admin/evaluation_types/index.html.erb @@ -5,4 +5,4 @@ pagy: @pagy, card_header: t('.card_header'), params: ['name'], - actions: ['edit', 'destroy'] %> + actions: %w[edit destroy] %> diff --git a/app/views/admin/high_school_types/_form.html.erb b/app/views/admin/high_school_types/_form.html.erb index 48cb0bb0e..cf29ac653 100644 --- a/app/views/admin/high_school_types/_form.html.erb +++ b/app/views/admin/high_school_types/_form.html.erb @@ -2,14 +2,14 @@ namespace: 'admin', klass: @high_school_type, params: [ - { - field: 'name', - width: 12, - required: true - }, - { - field: 'code', - width: 12, - required: true - } + { + field: 'name', + width: 12, + required: true + }, + { + field: 'code', + width: 12, + required: true + } ] %> diff --git a/app/views/admin/high_school_types/index.html.erb b/app/views/admin/high_school_types/index.html.erb index ca753fb0b..2fb13f97c 100644 --- a/app/views/admin/high_school_types/index.html.erb +++ b/app/views/admin/high_school_types/index.html.erb @@ -4,5 +4,5 @@ collection: @high_school_types, pagy: @pagy, card_header: t('.card_header'), - params: ['name', 'code'], - actions: ['edit', 'destroy'] %> + params: %w[name code], + actions: %w[edit destroy] %> diff --git a/app/views/admin/languages/_form.html.erb b/app/views/admin/languages/_form.html.erb index 140521bf1..5c3d563ad 100644 --- a/app/views/admin/languages/_form.html.erb +++ b/app/views/admin/languages/_form.html.erb @@ -2,14 +2,14 @@ namespace: 'admin', klass: @language, params: [ - { - field: 'name', - width: 12, - required: true - }, - { - field: 'iso', - width: 12, - required: true - } + { + field: 'name', + width: 12, + required: true + }, + { + field: 'iso', + width: 12, + required: true + } ] %> diff --git a/app/views/admin/languages/index.html.erb b/app/views/admin/languages/index.html.erb index 63155c0f1..b3cb0823b 100644 --- a/app/views/admin/languages/index.html.erb +++ b/app/views/admin/languages/index.html.erb @@ -4,5 +4,5 @@ collection: @languages, pagy: @pagy, card_header: t('.card_header'), - params: ['name', 'iso'], - actions: ['edit', 'destroy'] %> + params: %w[name iso], + actions: %w[edit destroy] %> diff --git a/app/views/admin/student_disability_types/_form.html.erb b/app/views/admin/student_disability_types/_form.html.erb index 67478c2a9..48e593b78 100644 --- a/app/views/admin/student_disability_types/_form.html.erb +++ b/app/views/admin/student_disability_types/_form.html.erb @@ -2,14 +2,14 @@ namespace: 'admin', klass: @student_disability_type, params: [ - { - field: 'name', - width: 12, - required: true - }, - { - field: 'code', - width: 12, - required: true - } + { + field: 'name', + width: 12, + required: true + }, + { + field: 'code', + width: 12, + required: true + } ] %> diff --git a/app/views/admin/student_disability_types/index.html.erb b/app/views/admin/student_disability_types/index.html.erb index 7801affe0..e264e9e65 100644 --- a/app/views/admin/student_disability_types/index.html.erb +++ b/app/views/admin/student_disability_types/index.html.erb @@ -4,5 +4,5 @@ collection: @student_disability_types, pagy: @pagy, card_header: t('.card_header'), - params: ['name', 'code'], - actions: ['edit', 'destroy'] %> + params: %w[name code], + actions: %w[edit destroy] %> diff --git a/app/views/admin/student_drop_out_types/_form.html.erb b/app/views/admin/student_drop_out_types/_form.html.erb index 5a48ccd35..db67de5e2 100644 --- a/app/views/admin/student_drop_out_types/_form.html.erb +++ b/app/views/admin/student_drop_out_types/_form.html.erb @@ -2,14 +2,14 @@ namespace: 'admin', klass: @student_drop_out_type, params: [ - { - field: 'name', - width: 12, - required: true - }, - { - field: 'code', - width: 12, - required: true - } + { + field: 'name', + width: 12, + required: true + }, + { + field: 'code', + width: 12, + required: true + } ] %> diff --git a/app/views/admin/student_drop_out_types/index.html.erb b/app/views/admin/student_drop_out_types/index.html.erb index 1781e55c9..7bdba6f82 100644 --- a/app/views/admin/student_drop_out_types/index.html.erb +++ b/app/views/admin/student_drop_out_types/index.html.erb @@ -4,5 +4,5 @@ collection: @student_drop_out_types, pagy: @pagy, card_header: t('.card_header'), - params: ['name', 'code'], - actions: ['edit', 'destroy'] %> + params: %w[name code], + actions: %w[edit destroy] %> diff --git a/app/views/admin/student_education_levels/_form.html.erb b/app/views/admin/student_education_levels/_form.html.erb index 3c85a5b10..c96ebd8ed 100644 --- a/app/views/admin/student_education_levels/_form.html.erb +++ b/app/views/admin/student_education_levels/_form.html.erb @@ -2,14 +2,14 @@ namespace: 'admin', klass: @student_education_level, params: [ - { - field: 'name', - width: 12, - required: true - }, - { - field: 'code', - width: 12, - required: true - } + { + field: 'name', + width: 12, + required: true + }, + { + field: 'code', + width: 12, + required: true + } ] %> diff --git a/app/views/admin/student_education_levels/index.html.erb b/app/views/admin/student_education_levels/index.html.erb index 8213d4981..ea843e1f2 100644 --- a/app/views/admin/student_education_levels/index.html.erb +++ b/app/views/admin/student_education_levels/index.html.erb @@ -4,5 +4,5 @@ collection: @student_education_levels, pagy: @pagy, card_header: t('.card_header'), - params: ['name', 'code'], - actions: ['edit', 'destroy'] %> + params: %w[name code], + actions: %w[edit destroy] %> diff --git a/app/views/admin/student_entrance_point_types/_form.html.erb b/app/views/admin/student_entrance_point_types/_form.html.erb index 80ecdfd17..b00c9cc5d 100644 --- a/app/views/admin/student_entrance_point_types/_form.html.erb +++ b/app/views/admin/student_entrance_point_types/_form.html.erb @@ -2,14 +2,14 @@ namespace: 'admin', klass: @student_entrance_point_type, params: [ - { - field: 'name', - width: 12, - required: true - }, - { - field: 'code', - width: 12, - required: true - } + { + field: 'name', + width: 12, + required: true + }, + { + field: 'code', + width: 12, + required: true + } ] %> diff --git a/app/views/admin/student_entrance_point_types/index.html.erb b/app/views/admin/student_entrance_point_types/index.html.erb index 0cac7f850..7a7354f8b 100644 --- a/app/views/admin/student_entrance_point_types/index.html.erb +++ b/app/views/admin/student_entrance_point_types/index.html.erb @@ -4,5 +4,5 @@ collection: @student_entrance_point_types, pagy: @pagy, card_header: t('.card_header'), - params: ['name', 'code'], - actions: ['edit', 'destroy'] %> + params: %w[name code], + actions: %w[edit destroy] %> diff --git a/app/views/admin/student_entrance_types/_form.html.erb b/app/views/admin/student_entrance_types/_form.html.erb index b03f88231..08d7cb89e 100644 --- a/app/views/admin/student_entrance_types/_form.html.erb +++ b/app/views/admin/student_entrance_types/_form.html.erb @@ -2,14 +2,14 @@ namespace: 'admin', klass: @student_entrance_type, params: [ - { - field: 'name', - width: 12, - required: true - }, - { - field: 'code', - width: 12, - required: true - } + { + field: 'name', + width: 12, + required: true + }, + { + field: 'code', + width: 12, + required: true + } ] %> diff --git a/app/views/admin/student_entrance_types/index.html.erb b/app/views/admin/student_entrance_types/index.html.erb index c1e95a1d1..571a7b00a 100644 --- a/app/views/admin/student_entrance_types/index.html.erb +++ b/app/views/admin/student_entrance_types/index.html.erb @@ -4,5 +4,5 @@ collection: @student_entrance_types, pagy: @pagy, card_header: t('.card_header'), - params: ['name', 'code'], - actions: ['edit', 'destroy'] %> + params: %w[name code], + actions: %w[edit destroy] %> diff --git a/app/views/admin/student_grades/_form.html.erb b/app/views/admin/student_grades/_form.html.erb index c07a62fa8..9a285bca4 100644 --- a/app/views/admin/student_grades/_form.html.erb +++ b/app/views/admin/student_grades/_form.html.erb @@ -2,14 +2,14 @@ namespace: 'admin', klass: @student_grade, params: [ - { - field: 'name', - width: 12, - required: true - }, - { - field: 'code', - width: 12, - required: true - } + { + field: 'name', + width: 12, + required: true + }, + { + field: 'code', + width: 12, + required: true + } ] %> diff --git a/app/views/admin/student_grades/index.html.erb b/app/views/admin/student_grades/index.html.erb index 1ad38256e..66126c429 100644 --- a/app/views/admin/student_grades/index.html.erb +++ b/app/views/admin/student_grades/index.html.erb @@ -4,5 +4,5 @@ collection: @student_grades, pagy: @pagy, card_header: t('.card_header'), - params: ['name', 'code'], - actions: ['edit', 'destroy'] %> + params: %w[name code], + actions: %w[edit destroy] %> diff --git a/app/views/admin/student_grading_systems/_form.html.erb b/app/views/admin/student_grading_systems/_form.html.erb index 05984e715..53ea7d913 100644 --- a/app/views/admin/student_grading_systems/_form.html.erb +++ b/app/views/admin/student_grading_systems/_form.html.erb @@ -2,14 +2,14 @@ namespace: 'admin', klass: @student_grading_system, params: [ - { - field: 'name', - width: 12, - required: true - }, - { - field: 'code', - width: 12, - required: true - } + { + field: 'name', + width: 12, + required: true + }, + { + field: 'code', + width: 12, + required: true + } ] %> diff --git a/app/views/admin/student_grading_systems/index.html.erb b/app/views/admin/student_grading_systems/index.html.erb index 157ac0a14..1bf0ea1f4 100644 --- a/app/views/admin/student_grading_systems/index.html.erb +++ b/app/views/admin/student_grading_systems/index.html.erb @@ -4,5 +4,5 @@ collection: @student_grading_systems, pagy: @pagy, card_header: t('.card_header'), - params: ['name', 'code'], - actions: ['edit', 'destroy'] %> + params: %w[name code], + actions: %w[edit destroy] %> diff --git a/app/views/admin/student_punishment_types/_form.html.erb b/app/views/admin/student_punishment_types/_form.html.erb index 3cb20a80d..f008286ec 100644 --- a/app/views/admin/student_punishment_types/_form.html.erb +++ b/app/views/admin/student_punishment_types/_form.html.erb @@ -2,14 +2,14 @@ namespace: 'admin', klass: @student_punishment_type, params: [ - { - field: 'name', - width: 12, - required: true - }, - { - field: 'code', - width: 12, - required: true - } + { + field: 'name', + width: 12, + required: true + }, + { + field: 'code', + width: 12, + required: true + } ] %> diff --git a/app/views/admin/student_punishment_types/index.html.erb b/app/views/admin/student_punishment_types/index.html.erb index 377c7c1f3..dbb8d8dde 100644 --- a/app/views/admin/student_punishment_types/index.html.erb +++ b/app/views/admin/student_punishment_types/index.html.erb @@ -4,5 +4,5 @@ collection: @student_punishment_types, pagy: @pagy, card_header: t('.card_header'), - params: ['name', 'code'], - actions: ['edit', 'destroy'] %> + params: %w[name code], + actions: %w[edit destroy] %> diff --git a/app/views/admin/student_studentship_statuses/_form.html.erb b/app/views/admin/student_studentship_statuses/_form.html.erb index 29ac1447d..eff098228 100644 --- a/app/views/admin/student_studentship_statuses/_form.html.erb +++ b/app/views/admin/student_studentship_statuses/_form.html.erb @@ -2,14 +2,14 @@ namespace: 'admin', klass: @student_studentship_status, params: [ - { - field: 'name', - width: 12, - required: true, - }, - { - field: 'code', - width: 12, - required: true - } + { + field: 'name', + width: 12, + required: true + }, + { + field: 'code', + width: 12, + required: true + } ] %> diff --git a/app/views/admin/student_studentship_statuses/index.html.erb b/app/views/admin/student_studentship_statuses/index.html.erb index 7fba7e9b3..1a0e9e8e6 100644 --- a/app/views/admin/student_studentship_statuses/index.html.erb +++ b/app/views/admin/student_studentship_statuses/index.html.erb @@ -4,5 +4,5 @@ collection: @student_studentship_statuses, pagy: @pagy, card_header: t('.card_header'), - params: ['name', 'code'], - actions: ['edit', 'destroy'] %> + params: %w[name code], + actions: %w[edit destroy] %> diff --git a/app/views/admin/titles/_form.html.erb b/app/views/admin/titles/_form.html.erb index 4c3908f4b..febcc1d5a 100644 --- a/app/views/admin/titles/_form.html.erb +++ b/app/views/admin/titles/_form.html.erb @@ -2,19 +2,19 @@ namespace: 'admin', klass: @title, params: [ - { - field: 'name', - width: 12, - required: true - }, - { - field: 'code', - width: 6, - required: true - }, - { - field: 'branch', - width: 6, - required: true - } + { + field: 'name', + width: 12, + required: true + }, + { + field: 'code', + width: 6, + required: true + }, + { + field: 'branch', + width: 6, + required: true + } ] %> diff --git a/app/views/admin/titles/index.html.erb b/app/views/admin/titles/index.html.erb index 1aabc8a3e..adc19d5fe 100644 --- a/app/views/admin/titles/index.html.erb +++ b/app/views/admin/titles/index.html.erb @@ -4,5 +4,5 @@ collection: @titles, pagy: @pagy, card_header: t('.card_header'), - params: ['name', 'code', 'branch'], - actions: ['edit', 'destroy'] %> + params: %w[name code branch], + actions: %w[edit destroy] %> diff --git a/app/views/admin/unit_instruction_languages/_form.html.erb b/app/views/admin/unit_instruction_languages/_form.html.erb index 51a9a5363..3e42edf39 100644 --- a/app/views/admin/unit_instruction_languages/_form.html.erb +++ b/app/views/admin/unit_instruction_languages/_form.html.erb @@ -2,14 +2,14 @@ namespace: 'admin', klass: @unit_instruction_language, params: [ - { - field: 'name', - width: 12, - required: true - }, - { - field: 'code', - width: 12, - required: true - } + { + field: 'name', + width: 12, + required: true + }, + { + field: 'code', + width: 12, + required: true + } ] %> diff --git a/app/views/admin/unit_instruction_languages/index.html.erb b/app/views/admin/unit_instruction_languages/index.html.erb index f27c859e4..959bb8c3a 100644 --- a/app/views/admin/unit_instruction_languages/index.html.erb +++ b/app/views/admin/unit_instruction_languages/index.html.erb @@ -4,5 +4,5 @@ collection: @unit_instruction_languages, pagy: @pagy, card_header: t('.card_header'), - params: ['name', 'code'], - actions: ['edit', 'destroy'] %> + params: %w[name code], + actions: %w[edit destroy] %> diff --git a/app/views/admin/unit_instruction_types/_form.html.erb b/app/views/admin/unit_instruction_types/_form.html.erb index f3b80597f..0a2882443 100644 --- a/app/views/admin/unit_instruction_types/_form.html.erb +++ b/app/views/admin/unit_instruction_types/_form.html.erb @@ -2,14 +2,14 @@ namespace: 'admin', klass: @unit_instruction_type, params: [ - { - field: 'name', - width: 12, - required: true - }, - { - field: 'code', - width: 12, - required: true - } + { + field: 'name', + width: 12, + required: true + }, + { + field: 'code', + width: 12, + required: true + } ] %> diff --git a/app/views/admin/unit_instruction_types/index.html.erb b/app/views/admin/unit_instruction_types/index.html.erb index 8160d8075..91296e39c 100644 --- a/app/views/admin/unit_instruction_types/index.html.erb +++ b/app/views/admin/unit_instruction_types/index.html.erb @@ -4,5 +4,5 @@ collection: @unit_instruction_types, pagy: @pagy, card_header: t('.card_header'), - params: ['name', 'code'], - actions: ['edit', 'destroy'] %> + params: %w[name code], + actions: %w[edit destroy] %> diff --git a/app/views/admin/unit_statuses/_form.html.erb b/app/views/admin/unit_statuses/_form.html.erb index bf4861789..679e71872 100644 --- a/app/views/admin/unit_statuses/_form.html.erb +++ b/app/views/admin/unit_statuses/_form.html.erb @@ -2,14 +2,14 @@ namespace: 'admin', klass: @unit_status, params: [ - { - field: 'name', - width: 12, - required: true - }, - { - field: 'code', - width: 12, - required: true - } + { + field: 'name', + width: 12, + required: true + }, + { + field: 'code', + width: 12, + required: true + } ] %> diff --git a/app/views/admin/unit_statuses/index.html.erb b/app/views/admin/unit_statuses/index.html.erb index 546cb9f06..513f4bba5 100644 --- a/app/views/admin/unit_statuses/index.html.erb +++ b/app/views/admin/unit_statuses/index.html.erb @@ -4,5 +4,5 @@ collection: @unit_statuses, pagy: @pagy, card_header: t('.card_header'), - params: ['name', 'code'], - actions: ['edit', 'destroy'] %> + params: %w[name code], + actions: %w[edit destroy] %> diff --git a/app/views/admin/unit_types/_form.html.erb b/app/views/admin/unit_types/_form.html.erb index 263b8c9cc..212881418 100644 --- a/app/views/admin/unit_types/_form.html.erb +++ b/app/views/admin/unit_types/_form.html.erb @@ -2,20 +2,20 @@ namespace: 'admin', klass: @unit_type, params: [ - { - field: 'name', - width: 12, - required: true - }, - { - field: 'code', - width: 12, - required: true - }, - { - field: 'group', - width: 12, - required: true, - collection: UnitType.groups.keys.sort - } + { + field: 'name', + width: 12, + required: true + }, + { + field: 'code', + width: 12, + required: true + }, + { + field: 'group', + width: 12, + required: true, + collection: UnitType.groups.keys.sort + } ] %> diff --git a/app/views/admin/unit_types/index.html.erb b/app/views/admin/unit_types/index.html.erb index 1e3e1731a..3abaef950 100644 --- a/app/views/admin/unit_types/index.html.erb +++ b/app/views/admin/unit_types/index.html.erb @@ -4,5 +4,5 @@ collection: @unit_types, pagy: @pagy, card_header: t('.card_header'), - params: ['name', 'code', 'group'], - actions: ['edit', 'destroy'] %> + params: %w[name code group], + actions: %w[edit destroy] %> diff --git a/app/views/admin/university_types/_form.html.erb b/app/views/admin/university_types/_form.html.erb index 935355664..331b5ab41 100644 --- a/app/views/admin/university_types/_form.html.erb +++ b/app/views/admin/university_types/_form.html.erb @@ -2,14 +2,14 @@ namespace: 'admin', klass: @university_type, params: [ - { - field: 'name', - width: 12, - required: true - }, - { - field: 'code', - width: 12, - required: true - } + { + field: 'name', + width: 12, + required: true + }, + { + field: 'code', + width: 12, + required: true + } ] %> diff --git a/app/views/admin/university_types/index.html.erb b/app/views/admin/university_types/index.html.erb index 3b33fe3c8..7bf2d78b7 100644 --- a/app/views/admin/university_types/index.html.erb +++ b/app/views/admin/university_types/index.html.erb @@ -4,5 +4,5 @@ collection: @university_types, pagy: @pagy, card_header: t('.card_header'), - params: ['name', 'code'], - actions: ['edit', 'destroy'] %> + params: %w[name code], + actions: %w[edit destroy] %> diff --git a/app/views/admin/yoksis_dashboard/_card.html.erb b/app/views/admin/yoksis_dashboard/_card.html.erb index 0fdf6c721..aaf27698e 100644 --- a/app/views/admin/yoksis_dashboard/_card.html.erb +++ b/app/views/admin/yoksis_dashboard/_card.html.erb @@ -11,4 +11,4 @@ <% end %>
- \ No newline at end of file + diff --git a/app/views/admin/yoksis_dashboard/index.html.erb b/app/views/admin/yoksis_dashboard/index.html.erb index 19e6db76a..3883ea293 100644 --- a/app/views/admin/yoksis_dashboard/index.html.erb +++ b/app/views/admin/yoksis_dashboard/index.html.erb @@ -1,21 +1,21 @@
<% yoksis_klasses = %w[ - HighSchoolType - StudentDisabilityType - StudentDropOutType - StudentEducationLevel - StudentEntrancePointType - StudentEntranceType - StudentGrade - StudentGradingSystem - StudentPunishmentType - StudentStudentshipStatus - UnitInstructionLanguage - UnitInstructionType - UnitStatus - UnitType - UniversityType - ] %> + HighSchoolType + StudentDisabilityType + StudentDropOutType + StudentEducationLevel + StudentEntrancePointType + StudentEntranceType + StudentGrade + StudentGradingSystem + StudentPunishmentType + StudentStudentshipStatus + UnitInstructionLanguage + UnitInstructionType + UnitStatus + UnitType + UniversityType + ] %> <% yoksis_klasses.each do |klass| %> <%= render 'card', diff --git a/app/views/calendar_management/calendar_event_types/_form.html.erb b/app/views/calendar_management/calendar_event_types/_form.html.erb index 9aa357340..a212ad2a2 100644 --- a/app/views/calendar_management/calendar_event_types/_form.html.erb +++ b/app/views/calendar_management/calendar_event_types/_form.html.erb @@ -2,20 +2,20 @@ namespace: 'calendar_management', klass: @calendar_event_type, params: [ - { - field: 'name', - width: 12, - required: true - }, - { - field: 'category', - width: 12, - required: true, - collection: CalendarEventType.categories.keys.sort - }, - { - field: 'identifier', - width: 12, - required: true - } + { + field: 'name', + width: 12, + required: true + }, + { + field: 'category', + width: 12, + required: true, + collection: CalendarEventType.categories.keys.sort + }, + { + field: 'identifier', + width: 12, + required: true + } ] %> diff --git a/app/views/calendar_management/calendar_event_types/index.html.erb b/app/views/calendar_management/calendar_event_types/index.html.erb index 68b686ba6..74bd6c733 100644 --- a/app/views/calendar_management/calendar_event_types/index.html.erb +++ b/app/views/calendar_management/calendar_event_types/index.html.erb @@ -4,5 +4,5 @@ collection: @calendar_event_types, pagy: @pagy, card_header: t('.card_header'), - params: ['name', 'category', 'identifier'], - actions: ['edit', 'destroy'] %> + params: %w[name category identifier], + actions: %w[edit destroy] %> diff --git a/app/views/calendar_management/calendars/_calendar_event_fields.html.erb b/app/views/calendar_management/calendars/_calendar_event_fields.html.erb index b05761795..02583cb25 100644 --- a/app/views/calendar_management/calendars/_calendar_event_fields.html.erb +++ b/app/views/calendar_management/calendars/_calendar_event_fields.html.erb @@ -4,18 +4,18 @@
<%= f.input :calendar_event_type_id, required: true, - collection: CalendarEventType.order(:name), - input_html: { class: 'select_search_class' } %> + collection: CalendarEventType.order(:name), + input_html: { class: 'select_search_class' } %>
<%= f.input :start_time, required: true, - as: :date_time_picker, - input_html: { data: { class: 'event-date'} } %> + as: :date_time_picker, + input_html: { data: { class: 'event-date' } } %>
<%= f.input :end_time, required: true, - as: :date_time_picker, - input_html: { data: { class: 'event-date'} } %> + as: :date_time_picker, + input_html: { data: { class: 'event-date' } } %>
<%= f.input :location %> diff --git a/app/views/calendar_management/calendars/_flatpickr.html.erb b/app/views/calendar_management/calendars/_flatpickr.html.erb index a046fd80f..5eeca4d63 100644 --- a/app/views/calendar_management/calendars/_flatpickr.html.erb +++ b/app/views/calendar_management/calendars/_flatpickr.html.erb @@ -1,5 +1,4 @@ diff --git a/app/views/calendar_management/calendars/index.html.erb b/app/views/calendar_management/calendars/index.html.erb index 14252cfd7..c129eaa73 100644 --- a/app/views/calendar_management/calendars/index.html.erb +++ b/app/views/calendar_management/calendars/index.html.erb @@ -4,19 +4,17 @@
<%= fa_icon 'street-view', text: t('.card_header') %>
- <%= link_to_new t('.new_calendar_link'), [:new, :calendar_management, :calendar] %> + <%= link_to_new t('.new_calendar_link'), %i[new calendar_management calendar] %>
<%= render 'layouts/shared/smart_search_form', - path: [:calendar_management, :calendars], + path: %i[calendar_management calendars], placeholder: t('.name') %> - - @@ -26,19 +24,19 @@ <% @calendars.each do |calendar| %> - - <% end %> diff --git a/app/views/calendar_management/calendars/show.html.erb b/app/views/calendar_management/calendars/show.html.erb index c899a2098..8c10885ac 100644 --- a/app/views/calendar_management/calendars/show.html.erb +++ b/app/views/calendar_management/calendars/show.html.erb @@ -8,23 +8,20 @@ <%= link_to fa_icon('file-pdf-o'), [:calendar_management, @calendar, format: :pdf], class: 'btn btn-outline-primary btn-sm' %> <%= link_to fa_icon('university', text: t('.assign_to_units')), [:calendar_management, @calendar, :units], - class: 'btn btn-outline-primary btn-sm' %> - <%= link_to_edit([:edit, :calendar_management, @calendar]) %> - <%= link_to_destroy([:calendar_management, @calendar]) %> + class: 'btn btn-outline-primary btn-sm' %> + <%= link_to_actions(@calendar, scope: :calendar_management, except: :show) %>
<%= t('.name') %><%= t('.senate_decision_date') %><%= t('.senate_decision_no') %> <%= t('.timezone') %> <%= t('.academic_term') %> <%= t('actions') %>
<%= link_to("[#{full_name(calendar.academic_term)}] - #{calendar.name}", [:calendar_management, calendar]) %><%= calendar.senate_decision_date %><%= calendar.senate_decision_no %> <%= 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_edit([:edit, :calendar_management, calendar]) %> - <%= link_to_destroy([:calendar_management, calendar]) %> - <%= link_to fa_icon('university', text: t('.assign_to_units')), [:calendar_management, calendar, :units], - class: 'btn btn-outline-primary btn-sm' %> - <%= link_to fa_icon('copy', text: t('.duplicate')), [:calendar_management, calendar, :duplicate], - class: 'btn btn-outline-primary btn-sm' %> + <%= 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('university', text: t('.assign_to_units')), + [:calendar_management, calendar, :units], + class: 'btn btn-outline-primary btn-sm' %> + <%= link_to fa_icon('copy', text: t('.duplicate')), + [:calendar_management, calendar, :duplicate], + class: 'btn btn-outline-primary btn-sm' %>
- - - - - - - - + <% @calendar.committee_decisions.each do |decision| %> + + + + + <% end %> diff --git a/app/views/calendar_management/calendars/show.pdf.erb b/app/views/calendar_management/calendars/show.pdf.erb index 701c7de3c..e2f5523e9 100644 --- a/app/views/calendar_management/calendars/show.pdf.erb +++ b/app/views/calendar_management/calendars/show.pdf.erb @@ -29,7 +29,9 @@
<%= t('.senate_decision_date') %><%= @calendar.senate_decision_date %>
<%= t('.senate_decision_no') %><%= @calendar.senate_decision_no %>
<%= t('.senate_decision_no') %><%= decision.decision_no %>
<%= t('.timezone') %> <%= @calendar.timezone %>
- <%= t('.senate_decision', date: @calendar.senate_decision_date, decision_no: @calendar.senate_decision_no) %> + <% @calendar.committee_decisions.each do |decision| %> + <%= t('.senate_decision', date: decision.meeting_agenda.committee_meeting.meeting_date, decision_no: decision.decision_no) %> + <% end %>

<%= @calendar.description %>

diff --git a/app/views/calendar_management/calendars/units.html.erb b/app/views/calendar_management/calendars/units.html.erb index 361196540..5d4566604 100644 --- a/app/views/calendar_management/calendars/units.html.erb +++ b/app/views/calendar_management/calendars/units.html.erb @@ -12,7 +12,7 @@
-<% end %> \ No newline at end of file +<% end %> diff --git a/app/views/committee/agenda_types/index.html.erb b/app/views/committee/agenda_types/index.html.erb index 45b0f16c5..bb685a2ab 100644 --- a/app/views/committee/agenda_types/index.html.erb +++ b/app/views/committee/agenda_types/index.html.erb @@ -24,8 +24,7 @@ <%= agenda_type.name %> - <%= link_to_edit(edit_agenda_type_path(agenda_type)) %> - <%= link_to_destroy(agenda_type) %> + <%= link_to_actions(agenda_type, except: :show) %> <% end %> diff --git a/app/views/committee/agendas/_search.html.erb b/app/views/committee/agendas/_search.html.erb index ba8183c7d..33e0a2a05 100644 --- a/app/views/committee/agendas/_search.html.erb +++ b/app/views/committee/agendas/_search.html.erb @@ -45,9 +45,9 @@
<%= label_tag(:agenda_type_id, t('.agenda_type_id')) %> <%= select_tag(:agenda_type_id, - options_from_collection_for_select(AgendaType.all, :id, :name, params[:agenda_type_id]), - include_blank: true, - class: 'form-control') %> + options_from_collection_for_select(AgendaType.all, :id, :name, params[:agenda_type_id]), + include_blank: true, + class: 'form-control') %>
diff --git a/app/views/committee/decisions/_form.html.erb b/app/views/committee/decisions/_form.html.erb index 3d751c933..5d76e96ad 100644 --- a/app/views/committee/decisions/_form.html.erb +++ b/app/views/committee/decisions/_form.html.erb @@ -6,7 +6,7 @@ <%= form_title %>
- <%= simple_form_for(decision, url: url, method: method ) do |f| %> + <%= simple_form_for(decision, url: url, method: method) do |f| %>
<%= f.error_notification %> diff --git a/app/views/committee/decisions/show.html.erb b/app/views/committee/decisions/show.html.erb index bd50ce0e2..f21918657 100644 --- a/app/views/committee/decisions/show.html.erb +++ b/app/views/committee/decisions/show.html.erb @@ -28,7 +28,7 @@ <%= @agenda.agenda_type.name %> - <%= t('.decision_no')%> + <%= t('.decision_no') %> <%= @agenda.decision.try(:decision_no) %> diff --git a/app/views/committee/meetings/_form.html.erb b/app/views/committee/meetings/_form.html.erb index e9fd4f69f..9531979db 100644 --- a/app/views/committee/meetings/_form.html.erb +++ b/app/views/committee/meetings/_form.html.erb @@ -44,6 +44,6 @@ <%= javascript_include_tag 'shared/cocoon' %> - \ No newline at end of file + diff --git a/app/views/committee/meetings/show.html.erb b/app/views/committee/meetings/show.html.erb index 7ccb215d1..006a28f64 100644 --- a/app/views/committee/meetings/show.html.erb +++ b/app/views/committee/meetings/show.html.erb @@ -43,7 +43,7 @@ <%= t('.description') %> <%= t('.status') %> <%= t('.agenda_type') %> - <%= t('.decision_no')%> + <%= t('.decision_no') %> <%= t('actions') %> diff --git a/app/views/course_management/available_course_groups/_form.html.erb b/app/views/course_management/available_course_groups/_form.html.erb index cfb700a13..8b5c0e0bd 100644 --- a/app/views/course_management/available_course_groups/_form.html.erb +++ b/app/views/course_management/available_course_groups/_form.html.erb @@ -10,6 +10,7 @@
<%= f.error_notification %> + <%= f.error_notification message: f.object.errors[:lecturers].to_sentence if f.object.errors[:lecturers].present? %>
<%= f.input :name, required: true %> @@ -19,12 +20,14 @@
-

<%= t('.lecturers') %>

- <%= f.simple_fields_for :lecturers do |lecturer| %> - <%= render 'lecturer_fields', f: lecturer %> - <% end %> - \ No newline at end of file +
diff --git a/app/views/course_management/curriculum_course_groups/_form.html.erb b/app/views/course_management/curriculum_course_groups/_form.html.erb index d13207f07..da6c07956 100644 --- a/app/views/course_management/curriculum_course_groups/_form.html.erb +++ b/app/views/course_management/curriculum_course_groups/_form.html.erb @@ -22,14 +22,14 @@
-

<%= t('.courses')%>

-
+

<%= t('.courses') %>

+
<%= f.simple_fields_for :curriculum_courses do |p| %> <%= p.input :curriculum_semester_id, as: :hidden %>
<%= p.association :course, - collection: [ p.object.course ], + collection: [p.object.course], include_blank: false, readonly: true %>
diff --git a/app/views/course_management/curriculum_course_groups/new.html.erb b/app/views/course_management/curriculum_course_groups/new.html.erb index 4dcf56d6d..536349be7 100644 --- a/app/views/course_management/curriculum_course_groups/new.html.erb +++ b/app/views/course_management/curriculum_course_groups/new.html.erb @@ -21,7 +21,7 @@
diff --git a/app/views/course_management/curriculums/_form.html.erb b/app/views/course_management/curriculums/_form.html.erb index a8cf1522d..a1ea8f670 100644 --- a/app/views/course_management/curriculums/_form.html.erb +++ b/app/views/course_management/curriculums/_form.html.erb @@ -61,6 +61,7 @@
<%= f.button :submit, class: 'btn btn-outline-success' %>
+
<% end %>
diff --git a/app/views/course_management/curriculums/_semesters.html.erb b/app/views/course_management/curriculums/_semesters.html.erb index 3abcd5a28..ef1bc6e6e 100644 --- a/app/views/course_management/curriculums/_semesters.html.erb +++ b/app/views/course_management/curriculums/_semesters.html.erb @@ -1,6 +1,6 @@
<% semesters.each do |semester| %> -
+
<%= fa_icon 'book' %><%= "#{semester.sequence}. #{t('semester')} (#{enum_t(semester, :term)})" %> @@ -21,26 +21,20 @@ additional_info: "
#{t('.total_ects')}
#{semester.curriculum_courses.compulsory.sum(:ects)} -
".html_safe - %> +
".html_safe %> <% semester.curriculum_course_groups.each do |curriculum_course_group| %> <%= render 'curriculum_courses', - klass: 'border-warning', - actions: safe_join([ - link_to_edit(edit_curriculum_semester_curriculum_course_group_path(semester, curriculum_course_group)), - link_to_destroy([semester, curriculum_course_group]) - ], - ' ' - ), - title: "#{t('.elective_courses')} - #{curriculum_course_group.name}", - semester: semester, - courses: curriculum_course_group.curriculum_courses.order('courses.name'), - action_visible: false, - additional_info: "
- #{t('.selectable_total_ects')}
- #{curriculum_course_group.ects} -
".html_safe %> + klass: 'border-warning', + actions: link_to_actions([semester, curriculum_course_group], except: :show), + title: "#{t('.elective_courses')} - #{curriculum_course_group.name}", + semester: semester, + courses: curriculum_course_group.curriculum_courses.order('courses.name'), + action_visible: false, + additional_info: "
+ #{t('.selectable_total_ects')}
+ #{curriculum_course_group.ects} +
".html_safe %> <% end %>
- <%= f.input :password_confirmation, required: true, label: false, wrapper: false %> + <%= f.input :password_confirmation, required: true, label: false, wrapper: false %>
<%= f.button :submit, t('.reset_my_password'), class: 'btn btn-block btn-primary' %> diff --git a/app/views/devise/passwords/new.html.erb b/app/views/devise/passwords/new.html.erb index 3b980880c..9330960f6 100644 --- a/app/views/devise/passwords/new.html.erb +++ b/app/views/devise/passwords/new.html.erb @@ -2,7 +2,7 @@

<%= t('devise.common.reset_password') %>

-

<%= t('.hint') %>

+

<%= t('.hint') %>

<%= simple_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %> <%= f.error_notification %>
diff --git a/app/views/devise/registrations/new.html.erb b/app/views/devise/registrations/new.html.erb index 4065a34e3..f1d76be46 100644 --- a/app/views/devise/registrations/new.html.erb +++ b/app/views/devise/registrations/new.html.erb @@ -29,7 +29,7 @@ <%= fa_icon('lock') %>
- <%= f.input :password, required: true, label: false, wrapper: false %> + <%= f.input :password, required: true, label: false, wrapper: false %>
@@ -38,7 +38,7 @@ <%= fa_icon('lock') %>
- <%= f.input :password_confirmation, required: true, label: false, wrapper: false %> + <%= f.input :password_confirmation, required: true, label: false, wrapper: false %>
<%= f.button :submit, t('devise.common.register'), class: 'btn btn-block btn-success' %> diff --git a/app/views/first_registration/prospective_students/_search.html.erb b/app/views/first_registration/prospective_students/_search.html.erb index 9d483bbf3..6357bc0cd 100644 --- a/app/views/first_registration/prospective_students/_search.html.erb +++ b/app/views/first_registration/prospective_students/_search.html.erb @@ -130,4 +130,3 @@ dynamic_select.init() }); - diff --git a/app/views/first_registration/prospective_students/show.html.erb b/app/views/first_registration/prospective_students/show.html.erb index 9d4e22a5a..0213ab9c9 100644 --- a/app/views/first_registration/prospective_students/show.html.erb +++ b/app/views/first_registration/prospective_students/show.html.erb @@ -19,7 +19,7 @@ <%= t('.meb_status') %>

<%= @prospective_student.meb_status ? t('.graduated') : t('.not_graduated_or_unknown') %>

-

<%= t('.last_update') %>: <%= as_date_and_time(@prospective_student.meb_status_date) %>

+

<%= t('.last_update') %>: <%= as_date_and_time(@prospective_student.meb_status_date) %>

@@ -48,7 +48,7 @@ <%= registration_document.name %> @@ -77,7 +77,7 @@ <% if @prospective_student.temporary_registrable? %> <%= link_to(t('.temporarily_register'), %i[register first_registration prospective_student], - class: "btn btn-block btn-success registration-button", + class: 'btn btn-block btn-success registration-button', disabled: @prospective_student.unit.registration_documents.present?) %> <% else %>