diff --git a/.ruby-version b/.ruby-version index 45674f16a8..aedc15bb0c 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.3.3 \ No newline at end of file +2.5.3 diff --git a/Gemfile b/Gemfile index b13ae7db4a..f3e07f4fc9 100644 --- a/Gemfile +++ b/Gemfile @@ -1,90 +1,100 @@ source 'https://rubygems.org' +git_source(:github) { |repo| "https://github.com/#{repo}.git" } -gem 'rails', '4.2.2' +ruby '2.5.3' +# gem 'rails', '4.2.2' +gem 'rails', '~> 5.2', '<= 5.2.4.4' gem 'pg', '~> 0.18.4' +gem 'puma', '~> 3.11' gem 'jquery-rails' gem 'jquery-ui-rails' -gem 'sass-rails', '~> 5.0' -gem 'uglifier', '>= 1.3.0' -gem 'coffee-rails', '~> 4.1.0' -gem 'jbuilder', '~> 2.0' -gem 'simple_form', '~> 3.2' -gem 'bootstrap-sass', '~> 3.3.5' -gem 'devise', '~> 3.5', '>= 3.5.2' -gem 'haml-rails', '~> 0.9' -gem 'dotenv-rails', '~> 2.0.2' -gem 'roo', '~> 2.2' -gem 'fog' +gem 'sass-rails', '~> 6.0' +gem 'uglifier', '~> 4.2' +gem 'coffee-rails', '~> 5.0' +gem 'bootsnap', '>= 1.1.0', require: false +gem 'mini_racer', platforms: :ruby +gem 'jbuilder', '~> 2.10', '>= 2.10.1' +gem 'simple_form', '~> 5.0', '>= 5.0.3' +gem 'bootstrap-sass', '~> 3.4', '>= 3.4.1' +gem 'devise', '~> 4.7', '>= 4.7.3' +gem 'haml-rails', '~> 2.0', '>= 2.0.1' +gem 'dotenv-rails', '~> 2.7', '>= 2.7.6' +gem 'roo', '~> 2.8', '>= 2.8.3' +gem 'fog-aws', '~> 3.3' gem 's3' -gem 'ffaker', '~> 2.1.0' -gem 'draper', '~> 2.1' -gem 'datagrid', '~> 1.4.2' +gem 'ffaker', '~> 2.17' +gem 'draper', '~> 4.0', '>= 4.0.1' +gem 'datagrid', '~> 1.6', '>= 1.6.1' gem 'active_model_serializers' gem 'sinatra', require: false gem 'rack-cors', require: 'rack/cors' gem 'rails-erd' -gem 'phony_rails', '~> 0.12.11' +gem 'phony_rails', '~> 0.14.13' gem 'typhoeus' -gem 'foreman', '~> 0.78.0' -gem 'cancancan', '~> 1.13', '>= 1.13.1' -gem 'pundit', '~> 1.1' -gem 'tinymce-rails', '~> 4.5.6' -gem 'bootstrap-datepicker-rails', '~> 1.5' +gem 'foreman', '~> 0.87.2' +gem 'cancancan', '~> 3.1' +gem 'pundit', '~> 2.1' +gem 'tinymce-rails', '~> 5.6', '>= 5.6.2.1' +gem 'bootstrap-datepicker-rails', '~> 1.9', '>= 1.9.0.1' gem 'x-editable-rails', '~> 1.5', '>= 1.5.5.1' -gem 'select2-rails', '~> 3.5.9.3' -gem 'doorkeeper', '~> 4.4', '>= 4.4.3' -gem 'devise_token_auth', '~> 0.1.37' -gem 'omniauth', '~> 1.3', '>= 1.3.1' +gem 'select2-rails', '~> 4.0', '>= 4.0.13' +gem 'doorkeeper', '~> 5.4' +gem 'devise_token_auth' +gem 'omniauth', '~> 1.9', '>= 1.9.1' gem 'jquery-validation-rails' -gem 'google-api-client', '~> 0.10', require: 'google/apis/calendar_v3' -gem 'fullcalendar-rails', '~> 3.2.0.0' -gem 'momentjs-rails', '~> 2.17.1' +gem 'google-api-client', '~> 0.23.9', require: 'google/apis/calendar_v3' +gem 'fullcalendar-rails', '~> 3.9' +gem 'momentjs-rails', '~> 2.20', '>= 2.20.1' gem 'kaminari' gem 'jquery-datatables-rails', '~> 3.4' -gem 'friendly_id', '~> 5.1.0' -gem 'wicked_pdf', '~> 1.0', '>= 1.0.6' -gem 'wkhtmltopdf-binary-edge', '~> 0.12.3.0' -gem 'browser', '~> 2.1' -gem 'whenever', '~> 0.9.4' -gem 'thredded', '~> 0.6.1' -gem 'cocoon', '~> 1.2', '>= 1.2.9' -gem 'paper_trail', '~> 5.2' -gem 'carrierwave', '~> 1.1.0' -gem 'mini_magick', '~> 4.5' -gem 'chartkick', '~> 3.4' -gem 'font-awesome-rails', '~> 4.7' -gem 'spreadsheet', '~> 1.1.3' -gem 'apartment', '~> 1.2' -gem 'dropzonejs-rails', '~> 0.7.3' -gem 'bourbon', '~> 4.2' -gem 'neat', '~> 1.8' -gem 'sidekiq', '~> 4.1.0' -gem 'mongoid', '~> 5.2', '>= 5.2.1' -gem 'where-or', '~> 0.1.6' -gem 'dotiw', '~> 4.0.1' +gem 'friendly_id', '~> 5.4', '>= 5.4.1' +gem 'wicked_pdf', '~> 2.1' +gem 'wkhtmltopdf-binary-edge', '~> 0.12.6.0' +gem 'browser', '~> 5.1' +gem 'whenever', '~> 1.0' +gem 'thredded', '~> 0.16.4' +gem 'cocoon', '~> 1.2', '>= 1.2.15' +gem 'paper_trail', '~> 10.0', '>= 10.0.1' +gem 'paper_trail-association_tracking', '~> 2.1', '>= 2.1.1' +gem 'carrierwave', '~> 2.1' +gem 'mini_magick', '~> 4.11' +gem 'chartkick', '~> 3.4', '>= 3.4.2' +gem 'font-awesome-rails', '~> 4.7', '>= 4.7.0.5' +gem 'spreadsheet', '~> 1.2', '>= 1.2.6' +gem 'apartment', '~> 2.2', '>= 2.2.1' +gem 'dropzonejs-rails', '~> 0.8.5' +gem 'bourbon', '~> 7.0' +gem 'neat', '~> 1.7', '>= 1.7.4' +gem 'sidekiq', '~> 5.2', '>= 5.2.9' +gem 'mongoid', '~> 6.1', '>= 6.1.1' +gem 'dotiw', '~> 5.2' gem 'text', '~> 1.3', '>= 1.3.1' -gem 'acts_as_paranoid', '~> 0.6.1' -gem 'ancestry', '~> 3.0', '>= 3.0.5' +gem 'acts_as_paranoid', '~> 0.7.0' +gem 'ancestry', '~> 3.2', '>= 3.2.1' gem 'sysrandom', '~> 1.0', '>= 1.0.5' -gem 'write_xlsx', '~> 0.85.7' -gem 'caxlsx', '~> 2.0', '>= 2.0.2' -gem 'react-rails', '~> 2.6.0' -gem 'webpacker', '~> 4.0.7' +gem 'write_xlsx', '~> 0.86.0' +gem 'caxlsx', '~> 3.0', '>= 3.0.3' +gem 'react-rails', '~> 2.6', '>= 2.6.1' +gem 'webpacker', '~> 5.2', '>= 5.2.1' gem 'jquery_query_builder-rails', '~> 0.5.0' -gem 'globalize', '~> 5.1.0' -gem 'enumerize', '~> 2.3.1' +gem 'globalize', '~> 5.3' +gem 'enumerize', '~> 2.3', '>= 2.3.1' gem 'ulid', '~> 1.2' +gem 'dalli', '~> 2.7', '>= 2.7.11' +gem 'actionpack-page_caching', '~> 1.2', '>= 1.2.3' +gem 'actionpack-action_caching', '~> 1.2', '>= 1.2.1' group :development, :test do + gem 'byebug', platforms: %i[mri mingw x64_mingw] gem 'pry' - gem 'rspec-rails', '~> 4.0.0' - gem 'factory_girl_rails', '~> 4.5' + gem 'rspec-rails' + gem 'factory_girl_rails', '~> 4.9' gem 'launchy', '~> 2.4', '>= 2.4.3' gem 'capybara', '~> 2.15.4' gem 'poltergeist', '~> 1.9.0' gem 'phantomjs' gem 'shoulda-whenever', '~> 0.0.2' - gem 'bullet', '5.4.3' + gem 'bullet', '~> 6.1' gem 'mongoid-rspec', '~> 4.0', '>= 4.0.1' gem 'thin', '~> 1.7' gem 'danger', '~> 5.16', '>= 5.16.1' @@ -102,7 +112,7 @@ end group :development do gem 'letter_opener', '~> 1.4.1' - gem 'letter_opener_web', '~> 1.3', '>= 1.3.4' + gem 'letter_opener_web' gem 'rubocop', '~> 0.47.1', require: false gem 'capistrano', '3.9.0' gem 'capistrano-rails', '~> 1.1.1' @@ -123,3 +133,5 @@ group :test do gem 'rspec-activemodel-mocks', '~> 1.1' gem 'timecop', '~> 0.8.1' end + +gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby] diff --git a/Gemfile.lock b/Gemfile.lock index 5627561f94..773ed644b0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,98 +1,120 @@ GEM remote: https://rubygems.org/ specs: - CFPropertyList (2.3.6) - actionmailer (4.2.2) - actionpack (= 4.2.2) - actionview (= 4.2.2) - activejob (= 4.2.2) + actioncable (5.2.4.4) + actionpack (= 5.2.4.4) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + actionmailer (5.2.4.4) + actionpack (= 5.2.4.4) + actionview (= 5.2.4.4) + activejob (= 5.2.4.4) mail (~> 2.5, >= 2.5.4) - rails-dom-testing (~> 1.0, >= 1.0.5) - actionpack (4.2.2) - actionview (= 4.2.2) - activesupport (= 4.2.2) - rack (~> 1.6) - rack-test (~> 0.6.2) - rails-dom-testing (~> 1.0, >= 1.0.5) - rails-html-sanitizer (~> 1.0, >= 1.0.1) - actionview (4.2.2) - activesupport (= 4.2.2) + rails-dom-testing (~> 2.0) + actionpack (5.2.4.4) + actionview (= 5.2.4.4) + activesupport (= 5.2.4.4) + rack (~> 2.0, >= 2.0.8) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + actionpack-action_caching (1.2.1) + actionpack (>= 4.0.0) + actionpack-page_caching (1.2.3) + actionpack (>= 5.0.0) + actionview (5.2.4.4) + activesupport (= 5.2.4.4) builder (~> 3.1) - erubis (~> 2.7.0) - rails-dom-testing (~> 1.0, >= 1.0.5) - rails-html-sanitizer (~> 1.0, >= 1.0.1) - active_model_serializers (0.9.4) - activemodel (>= 3.2) - active_record_union (1.2.0) + erubi (~> 1.4) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.3) + active_model_serializers (0.10.11) + actionpack (>= 4.1, < 6.1) + activemodel (>= 4.1, < 6.1) + case_transform (>= 0.2) + jsonapi-renderer (>= 0.1.1.beta1, < 0.3) + active_record_union (1.3.0) activerecord (>= 4.0) - activejob (4.2.2) - activesupport (= 4.2.2) - globalid (>= 0.3.0) - activemodel (4.2.2) - activesupport (= 4.2.2) + activejob (5.2.4.4) + activesupport (= 5.2.4.4) + globalid (>= 0.3.6) + activemodel (5.2.4.4) + activesupport (= 5.2.4.4) + activemodel-serializers-xml (1.0.2) + activemodel (> 5.x) + activesupport (> 5.x) builder (~> 3.1) - activerecord (4.2.2) - activemodel (= 4.2.2) - activesupport (= 4.2.2) - arel (~> 6.0) - activesupport (4.2.2) - i18n (~> 0.7) - json (~> 1.7, >= 1.7.7) + activerecord (5.2.4.4) + activemodel (= 5.2.4.4) + activesupport (= 5.2.4.4) + arel (>= 9.0) + activestorage (5.2.4.4) + actionpack (= 5.2.4.4) + activerecord (= 5.2.4.4) + marcel (~> 0.3.1) + activesupport (5.2.4.4) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 0.7, < 2) minitest (~> 5.1) - thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) - acts_as_paranoid (0.6.1) - activerecord (>= 4.2, < 7.0) - activesupport (>= 4.2, < 7.0) - addressable (2.4.0) - airbrussh (1.3.2) + acts_as_paranoid (0.7.0) + activerecord (>= 5.2, < 7.0) + activesupport (>= 5.2, < 7.0) + addressable (2.7.0) + public_suffix (>= 2.0.2, < 5.0) + airbrussh (1.4.0) sshkit (>= 1.6.1, != 1.7.0) - ancestry (3.0.5) - activerecord (>= 3.2.0) - apartment (1.2.0) + ancestry (3.2.1) + activerecord (>= 4.2.0) + apartment (2.2.1) activerecord (>= 3.1.2, < 6.0) + parallel (>= 0.7.1) + public_suffix (>= 2) rack (>= 1.3.6) appsignal (1.1.9) rack thread_safe - arel (6.0.3) - asset_sync (2.8.1) + arel (9.0.0) + asset_sync (2.12.1) activemodel (>= 4.1.0) fog-core mime-types (>= 2.99) unf - ast (2.3.0) - autoprefixer-rails (6.3.3.1) + ast (2.4.1) + autoprefixer-rails (10.1.0.0) execjs - autosize-rails (1.18.17) - rails (>= 3.1) babel-source (5.8.35) babel-transpiler (0.7.0) babel-source (>= 4.0, < 6) execjs (~> 2.0) - bbcoder (1.1.1) - bcrypt (3.1.13) - bootstrap-datepicker-rails (1.5.0) + bcrypt (3.1.16) + bcrypt (3.1.16-java) + bootsnap (1.5.1) + msgpack (~> 1.0) + bootsnap (1.5.1-java) + msgpack (~> 1.0) + bootstrap-datepicker-rails (1.9.0.1) railties (>= 3.0) - bootstrap-sass (3.3.6) + bootstrap-sass (3.4.1) autoprefixer-rails (>= 5.2.1) - sass (>= 3.3.4) - bourbon (4.2.7) - sass (~> 3.4) - thor (~> 0.19) - browser (2.1.0) - bson (4.2.1) + sassc (>= 2.0.0) + bourbon (7.0.0) + thor (~> 1.0) + browser (5.1.0) + bson (4.11.1) + bson (4.11.1-java) builder (3.2.4) - bullet (5.4.3) + bullet (6.1.0) activesupport (>= 3.0.0) - uniform_notifier (~> 1.10.0) - cancancan (1.13.1) + uniform_notifier (~> 1.11) + byebug (11.1.3) + cancancan (3.1.0) capistrano (3.9.0) airbrussh (>= 1.0.0) i18n rake (>= 10.0.0) sshkit (>= 1.9.0) - capistrano-bundler (1.5.0) + capistrano-bundler (1.6.0) capistrano (~> 3.1) capistrano-foreman (1.4.0) capistrano (~> 3.1) @@ -115,15 +137,21 @@ GEM rack (>= 1.0.0) rack-test (>= 0.5.4) xpath (~> 2.0) - carrierwave (1.1.0) - activemodel (>= 4.0.0) - activesupport (>= 4.0.0) - mime-types (>= 1.16) - caxlsx (2.0.2) - htmlentities (~> 4.3.1) - nokogiri (>= 1.4.1) - rubyzip (~> 1.2) - chartkick (3.4.0) + carrierwave (2.1.0) + activemodel (>= 5.0.0) + activesupport (>= 5.0.0) + addressable (~> 2.6) + image_processing (~> 1.1) + mimemagic (>= 0.3.0) + mini_mime (>= 0.1.3) + case_transform (0.2) + activesupport + caxlsx (3.0.3) + htmlentities (~> 4.3, >= 4.3.4) + mimemagic (~> 0.3) + nokogiri (~> 1.10, >= 1.10.4) + rubyzip (>= 1.3.0, < 3) + chartkick (3.4.2) choice (0.2.0) chronic (0.10.2) claide (1.0.3) @@ -132,22 +160,23 @@ GEM nap open4 (~> 1.3) cliver (0.3.2) - cocoon (1.2.9) - coderay (1.1.1) - coffee-rails (4.1.1) + cocoon (1.2.15) + coderay (1.1.3) + coffee-rails (5.0.0) coffee-script (>= 2.2.0) - railties (>= 4.0.0, < 5.1.x) + railties (>= 5.2.0) coffee-script (2.4.1) coffee-script-source execjs - coffee-script-source (1.10.0) + coffee-script-source (1.12.2) colored2 (3.1.2) concurrent-ruby (1.1.7) - connection_pool (2.2.0) + connection_pool (2.2.3) cork (0.3.0) colored2 (~> 3.1) crass (1.0.6) daemons (1.3.1) + dalli (2.7.11) danger (5.16.1) claide (~> 1.0) claide-plugins (>= 0.9.2) @@ -160,60 +189,64 @@ GEM no_proxy_fix octokit (~> 4.7) terminal-table (~> 1) - database_cleaner (1.5.1) - datagrid (1.4.2) - rails (>= 3.2.22.2) - db_text_search (0.2.0) - activerecord (>= 4.1.15, < 6.0) - declarative (0.0.9) + database_cleaner (1.8.5) + datagrid (1.6.1) + rails (>= 4.0) + db_text_search (0.3.1) + activerecord (>= 4.1.15, < 7.0) + declarative (0.0.20) declarative-option (0.1.0) - devise (3.5.6) + devise (4.7.3) bcrypt (~> 3.0) orm_adapter (~> 0.1) - railties (>= 3.2.6, < 5) + railties (>= 4.1.0) responders - thread_safe (~> 0.1) warden (~> 1.2.3) - devise_token_auth (0.1.43) - devise (> 3.5.2, < 4.5) - rails (< 6) + devise_token_auth (1.1.3) + bcrypt (~> 3.0) + devise (> 3.5.2, < 5) + rails (>= 4.2.0, < 6.1) diff-lcs (1.4.4) domain_name (0.5.20190701) unf (>= 0.0.5, < 1.0.0) - doorkeeper (4.4.3) - railties (>= 4.2) - dotenv (2.0.2) - dotenv-rails (2.0.2) - dotenv (= 2.0.2) - railties (~> 4.0) - dotiw (4.0.1) - actionpack (>= 4) + doorkeeper (5.4.0) + railties (>= 5) + dotenv (2.7.6) + dotenv-rails (2.7.6) + dotenv (= 2.7.6) + railties (>= 3.2) + dotiw (5.2.0) + activesupport i18n - draper (2.1.0) - actionpack (>= 3.0) - activemodel (>= 3.0) - activesupport (>= 3.0) - request_store (~> 1.0) - dropzonejs-rails (0.7.4) + draper (4.0.1) + actionpack (>= 5.0) + activemodel (>= 5.0) + activemodel-serializers-xml (>= 1.0) + activesupport (>= 5.0) + request_store (>= 1.0) + dropzonejs-rails (0.8.5) rails (> 3.1) - dry-inflector (0.1.2) enumerize (2.3.1) activesupport (>= 3.2) + erubi (1.10.0) erubis (2.7.0) - ethon (0.8.1) + ethon (0.12.0) ffi (>= 1.3.0) eventmachine (1.2.7) - excon (0.73.0) - execjs (2.6.0) - factory_girl (4.5.0) + eventmachine (1.2.7-java) + eventmachine (1.2.7-x64-mingw32) + eventmachine (1.2.7-x86-mingw32) + excon (0.78.1) + execjs (2.7.0) + factory_girl (4.9.0) activesupport (>= 3.0.0) - factory_girl_rails (4.6.0) - factory_girl (~> 4.5.0) + factory_girl_rails (4.9.0) + factory_girl (~> 4.9.0) railties (>= 3.0.0) - faraday (0.12.1) + faraday (0.17.3) multipart-post (>= 1.2, < 3) - faraday-cookie_jar (0.0.6) - faraday (>= 0.7.4) + faraday-cookie_jar (0.0.7) + faraday (>= 0.8.0) http-cookie (~> 1.0.0) faraday-encoding (0.0.5) faraday @@ -221,217 +254,79 @@ GEM faraday (~> 0.8) faraday_middleware (0.14.0) faraday (>= 0.7.4, < 1.0) - fastimage (2.1.7) - ffaker (2.1.0) - ffi (1.9.10) - fission (0.5.0) - CFPropertyList (~> 2.2) + fastimage (2.2.0) + ffaker (2.17.0) + ffi (1.13.1) + ffi (1.13.1-java) + ffi (1.13.1-x64-mingw32) + ffi (1.13.1-x86-mingw32) flay (2.12.1) erubis (~> 2.7.0) path_expander (~> 1.0) ruby_parser (~> 3.0) sexp_processor (~> 4.0) - fog (1.41.0) - fog-aliyun (>= 0.1.0) - fog-atmos - fog-aws (>= 0.6.0) - fog-brightbox (~> 0.4) - fog-cloudatcost (~> 0.1.0) - fog-core (~> 1.45) - fog-digitalocean (>= 0.3.0) - fog-dnsimple (~> 1.0) - fog-dynect (~> 0.0.2) - fog-ecloud (~> 0.1) - fog-google (<= 0.1.0) - fog-internet-archive - fog-joyent - fog-json - fog-local - fog-openstack - fog-powerdns (>= 0.1.1) - fog-profitbricks - fog-rackspace - fog-radosgw (>= 0.0.2) - fog-riakcs - fog-sakuracloud (>= 0.0.4) - fog-serverlove - fog-softlayer - fog-storm_on_demand - fog-terremark - fog-vmfusion - fog-voxel - fog-vsphere (>= 0.4.0) - fog-xenserver - fog-xml (~> 0.1.1) - ipaddress (~> 0.5) - json (>= 1.8, < 2.0) - fog-aliyun (0.3.5) - fog-core - fog-json - ipaddress (~> 0.8) - xml-simple (~> 1.1) - fog-atmos (0.1.0) - fog-core - fog-xml - fog-aws (2.0.1) - fog-core (~> 1.38) - fog-json (~> 1.0) - fog-xml (~> 0.1) - ipaddress (~> 0.8) - fog-brightbox (0.16.1) - dry-inflector - fog-core - fog-json - mime-types - fog-cloudatcost (0.1.2) - fog-core (~> 1.36) - fog-json (~> 1.0) + fog-aws (3.7.0) + fog-core (~> 2.1) + fog-json (~> 1.1) fog-xml (~> 0.1) ipaddress (~> 0.8) - fog-core (1.45.0) + fog-core (2.2.3) builder - excon (~> 0.58) + excon (~> 0.71) formatador (~> 0.2) - fog-digitalocean (0.4.0) - fog-core - fog-json - fog-xml - ipaddress (>= 0.5) - fog-dnsimple (1.0.0) - fog-core (~> 1.38) - fog-json (~> 1.0) - fog-dynect (0.0.3) - fog-core - fog-json - fog-xml - fog-ecloud (0.3.0) - fog-core - fog-xml - fog-google (0.1.0) - fog-core - fog-json - fog-xml - fog-internet-archive (0.0.1) - fog-core - fog-json - fog-xml - fog-joyent (0.0.1) - fog-core (~> 1.42) - fog-json (>= 1.0) + mime-types fog-json (1.2.0) fog-core multi_json (~> 1.10) - fog-local (0.6.0) - fog-core (>= 1.27, < 3.0) - fog-openstack (0.3.10) - fog-core (>= 1.45, <= 2.1.0) - fog-json (>= 1.0) - ipaddress (>= 0.8) - fog-powerdns (0.2.0) - fog-core - fog-json - fog-xml - fog-profitbricks (4.1.1) - fog-core (~> 1.42) - fog-json (~> 1.0) - fog-rackspace (0.1.6) - fog-core (>= 1.35) - fog-json (>= 1.0) - fog-xml (>= 0.1) - ipaddress (>= 0.8) - fog-radosgw (0.0.5) - fog-core (>= 1.21.0) - fog-json - fog-xml (>= 0.0.1) - fog-riakcs (0.1.0) - fog-core - fog-json - fog-xml - fog-sakuracloud (1.7.5) - fog-core - fog-json - fog-serverlove (0.1.2) - fog-core - fog-json - fog-softlayer (1.1.4) - fog-core - fog-json - fog-storm_on_demand (0.1.1) - fog-core - fog-json - fog-terremark (0.1.0) - fog-core - fog-xml - fog-vmfusion (0.1.0) - fission - fog-core - fog-voxel (0.1.0) - fog-core - fog-xml - fog-vsphere (3.3.0) - fog-core - rbvmomi (>= 1.9, < 3) - fog-xenserver (1.0.0) - fog-core - fog-xml - xmlrpc fog-xml (0.1.3) fog-core nokogiri (>= 1.5.11, < 2.0.0) - font-awesome-rails (4.7.0.0) - railties (>= 3.2, < 5.1) - foreman (0.78.0) - thor (~> 0.19.1) + font-awesome-rails (4.7.0.5) + railties (>= 3.2, < 6.1) + foreman (0.87.2) formatador (0.2.5) - friendly_id (5.1.0) + friendly_id (5.4.1) activerecord (>= 4.0.0) - fullcalendar-rails (3.2.0.0) + fullcalendar-rails (3.9.0.0) jquery-rails (>= 4.0.5, < 5.0.0) jquery-ui-rails (>= 5.0.2) momentjs-rails (>= 2.9.0) - gemoji (2.1.0) git (1.7.0) rchardet (~> 1.8) - github-markdown (0.6.9) - globalid (0.3.6) - activesupport (>= 4.1.0) - globalize (5.1.0) - activemodel (>= 4.2, < 5.2) - activerecord (>= 4.2, < 5.2) + globalid (0.4.2) + activesupport (>= 4.2.0) + globalize (5.3.0) + activemodel (>= 4.2, < 6.1) + activerecord (>= 4.2, < 6.1) request_store (~> 1.0) - google-api-client (0.10.3) - addressable (~> 2.3) - googleauth (~> 0.5) - httpclient (~> 2.7) - hurley (~> 0.1) - memoist (~> 0.11) - mime-types (>= 1.6) + google-api-client (0.23.9) + addressable (~> 2.5, >= 2.5.1) + googleauth (>= 0.5, < 0.7.0) + httpclient (>= 2.8.1, < 3.0) + mime-types (~> 3.0) representable (~> 3.0) retriable (>= 2.0, < 4.0) - googleauth (0.5.1) - faraday (~> 0.9) - jwt (~> 1.4) - logging (~> 2.0) - memoist (~> 0.12) + signet (~> 0.9) + googleauth (0.6.7) + faraday (~> 0.12) + jwt (>= 1.4, < 3.0) + memoist (~> 0.16) multi_json (~> 1.11) - os (~> 0.9) + os (>= 0.9, < 2.0) signet (~> 0.7) - haml (4.0.7) + haml (5.2.1) + temple (>= 0.8.0) tilt - haml-rails (0.9.0) - actionpack (>= 4.0.1) - activesupport (>= 4.0.1) - haml (>= 4.0.6, < 5.0) + haml-rails (2.0.1) + actionpack (>= 5.1) + activesupport (>= 5.1) + haml (>= 4.0.6, < 6.0) html2haml (>= 1.0.1) - railties (>= 4.0.1) - hashie (3.4.3) - html-pipeline (2.4.2) + railties (>= 5.1) + hashie (4.1.0) + html-pipeline (2.14.0) activesupport (>= 2) nokogiri (>= 1.4) - html-pipeline-vimeo (0.1.1) - html-pipeline (~> 2.0) - html-pipeline-youtube (0.1.3) - html-pipeline (~> 2.0) html2haml (2.2.0) erubis (~> 2.7.0) haml (>= 4.0, < 6) @@ -441,39 +336,40 @@ GEM http-cookie (1.0.3) domain_name (~> 0.5) httpclient (2.8.3) - hurley (0.2) - i18n (0.9.5) + i18n (1.8.5) concurrent-ruby (~> 1.0) - inline_svg (1.7.1) + image_processing (1.12.1) + mini_magick (>= 4.9.5, < 5) + ruby-vips (>= 2.0.17, < 3) + inline_svg (1.7.2) activesupport (>= 3.0) nokogiri (>= 1.6) ipaddress (0.8.3) - jbuilder (2.4.1) - activesupport (>= 3.0.0, < 5.1) - multi_json (~> 1.2) + jbuilder (2.10.1) + activesupport (>= 5.0.0) jquery-datatables-rails (3.4.0) actionpack (>= 3.1) jquery-rails railties (>= 3.1) sass-rails - jquery-rails (4.1.0) - rails-dom-testing (~> 1.0) + jquery-rails (4.4.0) + rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) jquery-ui-rails (6.0.1) railties (>= 3.2.16) - jquery-validation-rails (1.13.1) - railties (>= 3.2, < 5.0) - thor (~> 0.14) + jquery-validation-rails (1.19.0) jquery_query_builder-rails (0.5.0) activesupport json (>= 1.8.3) railties (>= 3.1) - json (1.8.6) + json (2.3.1) + json (2.3.1-java) json_spec (1.1.5) multi_json (~> 1.0) rspec (>= 2.0, < 4.0) - jwt (1.5.6) + jsonapi-renderer (0.2.2) + jwt (2.2.2) kaminari (1.2.1) activesupport (>= 4.1.0) kaminari-actionview (= 1.2.1) @@ -489,24 +385,26 @@ GEM kramdown (1.17.0) launchy (2.4.3) addressable (~> 2.3) + launchy (2.4.3-java) + addressable (~> 2.3) + spoon (~> 0.0.1) letter_opener (1.4.1) launchy (~> 2.2) letter_opener_web (1.3.4) actionmailer (>= 3.2) letter_opener (~> 1.0) railties (>= 3.2) - little-plugger (1.1.4) - logging (2.2.2) - little-plugger (~> 1.1) - multi_json (~> 1.10) - loofah (2.7.0) + libv8 (8.4.255.0) + loofah (2.8.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) - mail (2.6.3) - mime-types (>= 1.16, < 3) + mail (2.7.1) + mini_mime (>= 0.1.1) mail_interceptor (0.0.7) activesupport - memoist (0.15.0) + marcel (0.3.3) + mimemagic (~> 0.3.2) + memoist (0.16.2) metainspector (5.4.0) addressable (~> 2.4) faraday (~> 0.9) @@ -517,21 +415,24 @@ GEM fastimage (~> 2.0) nesty (~> 1.0) nokogiri (~> 1.6) - method_source (0.8.2) - mime-types (2.99.1) - mini_magick (4.5.1) - mini_mime (0.1.4) + method_source (1.0.0) + mime-types (3.3.1) + mime-types-data (~> 3.2015) + mime-types-data (3.2020.1104) + mimemagic (0.3.5) + mini_magick (4.11.0) + mini_mime (1.0.2) mini_portile2 (2.4.0) + mini_racer (0.3.1) + libv8 (~> 8.4.255) minitest (5.14.2) - momentjs-rails (2.17.1) + momentjs-rails (2.20.1) railties (>= 3.1) - mongo (2.4.1) - bson (>= 4.2.1, < 5.0.0) - mongoid (5.2.1) - activemodel (~> 4.0) + mongo (2.14.0) + bson (>= 4.8.2, < 5.0.0) + mongoid (6.1.1) + activemodel (~> 5.0) mongo (>= 2.4.1, < 3.0.0) - origin (~> 2.3) - tzinfo (>= 0.3.37) mongoid-compatibility (0.5.1) activesupport mongoid (>= 2.0) @@ -542,143 +443,172 @@ GEM rspec-core (~> 3.3) rspec-expectations (~> 3.3) rspec-mocks (~> 3.3) - multi_json (1.14.1) - multipart-post (2.0.0) + msgpack (1.3.3) + msgpack (1.3.3-java) + msgpack (1.3.3-x64-mingw32) + msgpack (1.3.3-x86-mingw32) + multi_json (1.15.0) + multipart-post (2.1.1) + mustache (1.1.1) + mustermann (1.1.1) + ruby2_keywords (~> 0.0.1) nap (1.1.0) - neat (1.8.0) + neat (1.7.4) + bourbon (>= 4.0) sass (>= 3.3) - thor (~> 0.19) nesty (1.0.2) - net-scp (2.0.0) - net-ssh (>= 2.6.5, < 6.0.0) - net-ssh (5.2.0) + net-scp (3.0.0) + net-ssh (>= 2.6.5, < 7.0.0) + net-ssh (6.1.0) + nio4r (2.5.4) + nio4r (2.5.4-java) no_proxy_fix (0.1.2) nokogiri (1.10.10) mini_portile2 (~> 2.4.0) - nokogumbo (2.0.2) + nokogiri (1.10.10-java) + nokogiri (1.10.10-x64-mingw32) + mini_portile2 (~> 2.4.0) + nokogiri (1.10.10-x86-mingw32) + mini_portile2 (~> 2.4.0) + nokogumbo (2.0.4) nokogiri (~> 1.8, >= 1.8.4) octokit (4.19.0) faraday (>= 0.9) sawyer (~> 0.8.0, >= 0.5.3) - omniauth (1.3.1) - hashie (>= 1.2, < 4) - rack (>= 1.0, < 3) + omniauth (1.9.1) + hashie (>= 3.4.6) + rack (>= 1.6.2, < 3) + onebox (1.9.30) + addressable (~> 2.7.0) + htmlentities (~> 4.3) + multi_json (~> 1.11) + mustache + nokogiri (~> 1.7) + sanitize open4 (1.3.4) - optimist (3.0.0) - origin (2.3.0) orm_adapter (0.5.0) - os (0.9.6) - paper_trail (5.2.2) - activerecord (>= 3.0, < 6.0) + os (1.1.1) + paper_trail (10.3.1) + activerecord (>= 4.2) request_store (~> 1.1) - parser (2.3.3.1) - ast (~> 2.2) + paper_trail-association_tracking (2.1.1) + parallel (1.20.1) + parser (2.7.2.0) + ast (~> 2.4.1) path_expander (1.1.0) pg (0.18.4) + pg (0.18.4-x64-mingw32) + pg (0.18.4-x86-mingw32) phantomjs (2.1.1.0) - phony (2.15.15) - phony_rails (0.12.13) + phony (2.18.18) + phony_rails (0.14.13) activesupport (>= 3.0) - phony (~> 2.12) + phony (> 2.15) poltergeist (1.9.0) capybara (~> 2.1) cliver (~> 0.3.1) multi_json (~> 1.0) websocket-driver (>= 0.2.0) - powerpack (0.1.1) - proxies (0.2.1) - pry (0.10.3) - coderay (~> 1.1.0) - method_source (~> 0.8.1) - slop (~> 3.4) - pundit (1.1.0) + powerpack (0.1.3) + proxies (0.2.3) + pry (0.13.1) + coderay (~> 1.1) + method_source (~> 1.0) + pry (0.13.1-java) + coderay (~> 1.1) + method_source (~> 1.0) + spoon (~> 0.0) + public_suffix (4.0.6) + puma (3.12.6) + puma (3.12.6-java) + pundit (2.1.0) activesupport (>= 3.0.0) - rack (1.6.13) - rack-cors (1.0.6) - rack (>= 1.6.0) - rack-mini-profiler (1.0.0) + rack (2.2.3) + rack-cors (1.1.1) + rack (>= 2.0.0) + rack-mini-profiler (1.1.6) rack (>= 1.2.0) - rack-protection (1.5.3) + rack-protection (2.1.0) rack rack-proxy (0.6.5) rack - rack-test (0.6.3) - rack (>= 1.0) - rails (4.2.2) - actionmailer (= 4.2.2) - actionpack (= 4.2.2) - actionview (= 4.2.2) - activejob (= 4.2.2) - activemodel (= 4.2.2) - activerecord (= 4.2.2) - activesupport (= 4.2.2) - bundler (>= 1.3.0, < 2.0) - railties (= 4.2.2) - sprockets-rails - rails-deprecated_sanitizer (1.0.3) - activesupport (>= 4.2.0.alpha) - rails-dom-testing (1.0.9) - activesupport (>= 4.2.0, < 5.0) - nokogiri (~> 1.6) - rails-deprecated_sanitizer (>= 1.0.1) - rails-erd (1.4.6) - activerecord (>= 3.2) - activesupport (>= 3.2) + rack-test (1.1.0) + rack (>= 1.0, < 3) + rails (5.2.4.4) + actioncable (= 5.2.4.4) + actionmailer (= 5.2.4.4) + actionpack (= 5.2.4.4) + actionview (= 5.2.4.4) + activejob (= 5.2.4.4) + activemodel (= 5.2.4.4) + activerecord (= 5.2.4.4) + activestorage (= 5.2.4.4) + activesupport (= 5.2.4.4) + bundler (>= 1.3.0) + railties (= 5.2.4.4) + sprockets-rails (>= 2.0.0) + rails-dom-testing (2.0.3) + activesupport (>= 4.2.0) + nokogiri (>= 1.6) + rails-erd (1.6.0) + activerecord (>= 4.2) + activesupport (>= 4.2) choice (~> 0.2.0) ruby-graphviz (~> 1.2) rails-html-sanitizer (1.3.0) loofah (~> 2.3) - rails-timeago (2.14.0) - actionpack (>= 3.1) - activesupport (>= 3.1) - railties (4.2.2) - actionpack (= 4.2.2) - activesupport (= 4.2.2) + railties (5.2.4.4) + actionpack (= 5.2.4.4) + activesupport (= 5.2.4.4) + method_source rake (>= 0.8.7) - thor (>= 0.18.1, < 2.0) - rainbow (2.2.1) + thor (>= 0.19.0, < 2.0) + rainbow (2.2.2) + rake rake (13.0.1) - rb-gravatar (1.0.5) - rbvmomi (2.4.1) - builder (~> 3.0) - json (>= 1.8) - nokogiri (~> 1.5) - optimist (~> 3.0) + rb-fsevent (0.10.4) + rb-gravatar (1.0.6) + rb-inotify (0.10.1) + ffi (~> 1.0) rchardet (1.8.0) - react-rails (2.6.0) + react-rails (2.6.1) babel-transpiler (>= 0.7.0) connection_pool execjs railties (>= 3.2) tilt - redis (3.2.2) + redis (4.1.4) representable (3.0.4) declarative (< 0.1.0) declarative-option (< 0.2.0) uber (< 0.2.0) - request_store (1.3.0) - responders (2.1.1) - railties (>= 4.2.0, < 5.1) - retriable (3.0.2) - roo (2.3.2) + request_store (1.5.0) + rack (>= 1.4) + responders (3.0.1) + actionpack (>= 5.0) + railties (>= 5.0) + retriable (3.1.2) + rexml (3.2.4) + rinku (2.0.6) + roo (2.8.3) nokogiri (~> 1) - rubyzip (~> 1.1, < 2.0.0) - rspec (3.9.0) - rspec-core (~> 3.9.0) - rspec-expectations (~> 3.9.0) - rspec-mocks (~> 3.9.0) + rubyzip (>= 1.3.0, < 3.0.0) + rspec (3.10.0) + rspec-core (~> 3.10.0) + rspec-expectations (~> 3.10.0) + rspec-mocks (~> 3.10.0) rspec-activemodel-mocks (1.1.0) activemodel (>= 3.0) activesupport (>= 3.0) rspec-mocks (>= 2.99, < 4.0) - rspec-core (3.9.3) - rspec-support (~> 3.9.3) - rspec-expectations (3.9.3) + rspec-core (3.10.0) + rspec-support (~> 3.10.0) + rspec-expectations (3.10.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.9.0) - rspec-mocks (3.9.1) + rspec-support (~> 3.10.0) + rspec-mocks (3.10.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.9.0) + rspec-support (~> 3.10.0) rspec-rails (4.0.1) actionpack (>= 4.2) activesupport (>= 4.2) @@ -690,170 +620,200 @@ GEM rspec-sidekiq (3.1.0) rspec-core (~> 3.0, >= 3.0.0) sidekiq (>= 2.4.0) - rspec-support (3.9.4) + rspec-support (3.10.0) rubocop (0.47.1) parser (>= 2.3.3.1, < 3.0) powerpack (~> 0.1) rainbow (>= 1.99.1, < 3.0) ruby-progressbar (~> 1.7) unicode-display_width (~> 1.0, >= 1.0.1) - ruby-graphviz (1.2.2) - ruby-ole (1.2.12) - ruby-progressbar (1.8.1) - ruby_parser (3.14.2) + ruby-graphviz (1.2.5) + rexml + ruby-ole (1.2.12.2) + ruby-progressbar (1.10.1) + ruby-vips (2.0.17) + ffi (~> 1.9) + ruby2_keywords (0.0.2) + ruby_parser (3.15.0) sexp_processor (~> 4.9) - rubyzip (1.2.0) - s3 (0.3.24) - proxies (~> 0.2.0) + rubyzip (2.3.0) + s3 (0.3.29) + addressable + proxies sanitize (5.2.1) crass (~> 1.0.2) nokogiri (>= 1.8.0) nokogumbo (~> 2.0) - sass (3.4.21) - sass-rails (5.0.4) - railties (>= 4.0.0, < 5.0) - sass (~> 3.1) - sprockets (>= 2.8, < 4.0) - sprockets-rails (>= 2.0, < 4.0) - tilt (>= 1.1, < 3) + sass (3.7.4) + sass-listen (~> 4.0.0) + sass-listen (4.0.0) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) + sass-rails (6.0.0) + sassc-rails (~> 2.1, >= 2.1.1) + sassc (2.4.0) + ffi (~> 1.9) + sassc (2.4.0-x64-mingw32) + ffi (~> 1.9) + sassc-rails (2.1.2) + railties (>= 4.0.0) + sassc (>= 2.0) + sprockets (> 3.0) + sprockets-rails + tilt sawyer (0.8.2) addressable (>= 2.3.5) faraday (> 0.8, < 2.0) - select2-rails (3.5.9.3) - thor (~> 0.14) - sexp_processor (4.14.1) - shoulda-matchers (3.1.1) - activesupport (>= 4.0.0) + select2-rails (4.0.13) + semantic_range (2.3.1) + sexp_processor (4.15.1) + shoulda-matchers (4.0.1) + activesupport (>= 4.2.0) shoulda-whenever (0.0.2) - sidekiq (4.1.0) - concurrent-ruby (~> 1.0) - connection_pool (~> 2.2, >= 2.2.0) - redis (~> 3.2, >= 3.2.1) - signet (0.7.3) + sidekiq (5.2.9) + connection_pool (~> 2.2, >= 2.2.2) + rack (~> 2.0) + rack-protection (>= 1.5.0) + redis (>= 3.3.5, < 4.2) + signet (0.14.0) addressable (~> 2.3) - faraday (~> 0.9) - jwt (~> 1.5) + faraday (>= 0.17.3, < 2.0) + jwt (>= 1.5, < 3.0) multi_json (~> 1.10) - simple_form (3.2.1) - actionpack (> 4, < 5.1) - activemodel (> 4, < 5.1) - sinatra (1.4.7) - rack (~> 1.5) - rack-protection (~> 1.4) - tilt (>= 1.3, < 3) - slop (3.6.0) + simple_form (5.0.3) + actionpack (>= 5.0) + activemodel (>= 5.0) + sinatra (2.1.0) + mustermann (~> 1.0) + rack (~> 2.2) + rack-protection (= 2.1.0) + tilt (~> 2.0) sorbet-rails (0.4.0) - spreadsheet (1.1.3) + spoon (0.0.6) + ffi + spreadsheet (1.2.6) ruby-ole (>= 1.0) - sprockets (3.5.2) + sprockets (4.0.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) - sprockets-es6 (0.9.1) + sprockets-es6 (0.9.2) babel-source (>= 5.8.11) babel-transpiler sprockets (>= 3.0.0) - sprockets-rails (3.0.4) + sprockets-rails (3.2.2) actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) - sshkit (1.18.2) + sshkit (1.21.1) net-scp (>= 1.1.2) net-ssh (>= 2.8.0) sysrandom (1.0.5) + sysrandom (1.0.5-java) + temple (0.8.2) terminal-table (1.8.0) unicode-display_width (~> 1.1, >= 1.1.1) text (1.3.1) - thin (1.7.2) + thin (1.8.0) daemons (~> 1.0, >= 1.0.9) eventmachine (~> 1.0, >= 1.0.4) rack (>= 1, < 3) - thor (0.19.1) + thor (1.0.1) thread_safe (0.3.6) - thredded (0.6.2) - active_record_union (>= 1.2.0) + thread_safe (0.3.6-java) + thredded (0.16.4) + active_record_union (>= 1.3.0) autoprefixer-rails - autosize-rails - bbcoder (~> 1.0) - db_text_search (~> 0.2.0) + db_text_search (~> 0.3.0) friendly_id - gemoji - github-markdown html-pipeline - html-pipeline-vimeo - html-pipeline-youtube htmlentities inline_svg - jquery-rails kaminari + kramdown (>= 1.17.0) nokogiri + onebox (~> 1.8, >= 1.8.48) pundit (>= 1.1.0) - rails (>= 4.2.0) - rails-timeago + rails (>= 4.2.10) rb-gravatar + rinku sanitize - sass (>= 3.4.21) - select2-rails (~> 3.5) + sassc-rails (>= 2.0.0) sprockets-es6 + timeago_js tilt (2.0.10) + timeago_js (3.0.2.2) timecop (0.8.1) - tinymce-rails (4.5.6) + tinymce-rails (5.6.2.1) railties (>= 3.1.1) - typhoeus (1.0.1) - ethon (>= 0.8.0) - tzinfo (1.2.7) + typhoeus (1.4.0) + ethon (>= 0.9.0) + tzinfo (1.2.8) thread_safe (~> 0.1) + tzinfo-data (1.2020.4) + tzinfo (>= 1.0.0) uber (0.1.0) - uglifier (2.7.2) - execjs (>= 0.3.0) - json (>= 1.8.0) + uglifier (4.2.0) + execjs (>= 0.3.0, < 3) ulid (1.2.0) unf (0.1.4) unf_ext - unf_ext (0.0.7.6) - unicode-display_width (1.1.3) - uniform_notifier (1.10.0) - warden (1.2.6) - rack (>= 1.0) - webpacker (4.0.7) - activesupport (>= 4.2) + unf (0.1.4-java) + unf_ext (0.0.7.7) + unf_ext (0.0.7.7-x64-mingw32) + unf_ext (0.0.7.7-x86-mingw32) + unicode-display_width (1.7.0) + uniform_notifier (1.13.0) + warden (1.2.9) + rack (>= 2.0.9) + webpacker (5.2.1) + activesupport (>= 5.2) rack-proxy (>= 0.6.1) - railties (>= 4.2) - websocket-driver (0.7.0) + railties (>= 5.2) + semantic_range (>= 2.3.0) + websocket-driver (0.7.3) + websocket-extensions (>= 0.1.0) + websocket-driver (0.7.3-java) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) - whenever (0.9.7) + whenever (1.0.0) chronic (>= 0.6.3) - where-or (0.1.6) - wicked_pdf (1.0.6) - wkhtmltopdf-binary-edge (0.12.3.0) - write_xlsx (0.85.7) + wicked_pdf (2.1.0) + activesupport + wkhtmltopdf-binary-edge (0.12.6.0) + write_xlsx (0.86.0) rubyzip (>= 1.0.0) zip-zip x-editable-rails (1.5.5.1) railties - xml-simple (1.1.5) - xmlrpc (0.3.0) xpath (2.1.0) nokogiri (~> 1.3) zip-zip (0.3) rubyzip (>= 1.0.0) PLATFORMS + java ruby + x64-mingw32 + x86-mingw32 + x86-mswin32 DEPENDENCIES + actionpack-action_caching (~> 1.2, >= 1.2.1) + actionpack-page_caching (~> 1.2, >= 1.2.3) active_model_serializers - acts_as_paranoid (~> 0.6.1) - ancestry (~> 3.0, >= 3.0.5) - apartment (~> 1.2) + acts_as_paranoid (~> 0.7.0) + ancestry (~> 3.2, >= 3.2.1) + apartment (~> 2.2, >= 2.2.1) appsignal (~> 1.1.9) asset_sync - bootstrap-datepicker-rails (~> 1.5) - bootstrap-sass (~> 3.3.5) - bourbon (~> 4.2) - browser (~> 2.1) - bullet (= 5.4.3) - cancancan (~> 1.13, >= 1.13.1) + bootsnap (>= 1.1.0) + bootstrap-datepicker-rails (~> 1.9, >= 1.9.0.1) + bootstrap-sass (~> 3.4, >= 3.4.1) + bourbon (~> 7.0) + browser (~> 5.1) + bullet (~> 6.1) + byebug + cancancan (~> 3.1) capistrano (= 3.9.0) capistrano-foreman capistrano-passenger (~> 0.1.1) @@ -861,34 +821,35 @@ DEPENDENCIES capistrano-rvm (~> 0.1.2) capistrano-sidekiq (~> 1.0, >= 1.0.3) capybara (~> 2.15.4) - carrierwave (~> 1.1.0) - caxlsx (~> 2.0, >= 2.0.2) - chartkick (~> 3.4) - cocoon (~> 1.2, >= 1.2.9) - coffee-rails (~> 4.1.0) + carrierwave (~> 2.1) + caxlsx (~> 3.0, >= 3.0.3) + chartkick (~> 3.4, >= 3.4.2) + cocoon (~> 1.2, >= 1.2.15) + coffee-rails (~> 5.0) + dalli (~> 2.7, >= 2.7.11) danger (~> 5.16, >= 5.16.1) database_cleaner (~> 1.5, >= 1.5.1) - datagrid (~> 1.4.2) - devise (~> 3.5, >= 3.5.2) - devise_token_auth (~> 0.1.37) - doorkeeper (~> 4.4, >= 4.4.3) - dotenv-rails (~> 2.0.2) - dotiw (~> 4.0.1) - draper (~> 2.1) - dropzonejs-rails (~> 0.7.3) - enumerize (~> 2.3.1) - factory_girl_rails (~> 4.5) - ffaker (~> 2.1.0) + datagrid (~> 1.6, >= 1.6.1) + devise (~> 4.7, >= 4.7.3) + devise_token_auth + doorkeeper (~> 5.4) + dotenv-rails (~> 2.7, >= 2.7.6) + dotiw (~> 5.2) + draper (~> 4.0, >= 4.0.1) + dropzonejs-rails (~> 0.8.5) + enumerize (~> 2.3, >= 2.3.1) + factory_girl_rails (~> 4.9) + ffaker (~> 2.17) flay (~> 2.12, >= 2.12.1) - fog - font-awesome-rails (~> 4.7) - foreman (~> 0.78.0) - friendly_id (~> 5.1.0) - fullcalendar-rails (~> 3.2.0.0) - globalize (~> 5.1.0) - google-api-client (~> 0.10) - haml-rails (~> 0.9) - jbuilder (~> 2.0) + fog-aws (~> 3.3) + font-awesome-rails (~> 4.7, >= 4.7.0.5) + foreman (~> 0.87.2) + friendly_id (~> 5.4, >= 5.4.1) + fullcalendar-rails (~> 3.9) + globalize (~> 5.3) + google-api-client (~> 0.23.9) + haml-rails (~> 2.0, >= 2.0.1) + jbuilder (~> 2.10, >= 2.10.1) jquery-datatables-rails (~> 3.4) jquery-rails jquery-ui-rails @@ -898,58 +859,64 @@ DEPENDENCIES kaminari launchy (~> 2.4, >= 2.4.3) letter_opener (~> 1.4.1) - letter_opener_web (~> 1.3, >= 1.3.4) + letter_opener_web mail_interceptor (~> 0.0.7) metainspector - mini_magick (~> 4.5) - momentjs-rails (~> 2.17.1) - mongoid (~> 5.2, >= 5.2.1) + mini_magick (~> 4.11) + mini_racer + momentjs-rails (~> 2.20, >= 2.20.1) + mongoid (~> 6.1, >= 6.1.1) mongoid-rspec (~> 4.0, >= 4.0.1) - neat (~> 1.8) - omniauth (~> 1.3, >= 1.3.1) - paper_trail (~> 5.2) + neat (~> 1.7, >= 1.7.4) + omniauth (~> 1.9, >= 1.9.1) + paper_trail (~> 10.0, >= 10.0.1) + paper_trail-association_tracking (~> 2.1, >= 2.1.1) pg (~> 0.18.4) phantomjs - phony_rails (~> 0.12.11) + phony_rails (~> 0.14.13) poltergeist (~> 1.9.0) pry - pundit (~> 1.1) + puma (~> 3.11) + pundit (~> 2.1) rack-cors rack-mini-profiler (~> 1.0) - rails (= 4.2.2) + rails (~> 5.2, <= 5.2.4.4) rails-erd - react-rails (~> 2.6.0) - roo (~> 2.2) + react-rails (~> 2.6, >= 2.6.1) + roo (~> 2.8, >= 2.8.3) rspec-activemodel-mocks (~> 1.1) - rspec-rails (~> 4.0.0) + rspec-rails rspec-sidekiq (~> 3.0, >= 3.0.3) rubocop (~> 0.47.1) s3 - sass-rails (~> 5.0) - select2-rails (~> 3.5.9.3) + sass-rails (~> 6.0) + select2-rails (~> 4.0, >= 4.0.13) shoulda-matchers shoulda-whenever (~> 0.0.2) - sidekiq (~> 4.1.0) - simple_form (~> 3.2) + sidekiq (~> 5.2, >= 5.2.9) + simple_form (~> 5.0, >= 5.0.3) sinatra sorbet-rails - spreadsheet (~> 1.1.3) + spreadsheet (~> 1.2, >= 1.2.6) sysrandom (~> 1.0, >= 1.0.5) text (~> 1.3, >= 1.3.1) thin (~> 1.7) - thredded (~> 0.6.1) + thredded (~> 0.16.4) timecop (~> 0.8.1) - tinymce-rails (~> 4.5.6) + tinymce-rails (~> 5.6, >= 5.6.2.1) typhoeus - uglifier (>= 1.3.0) + tzinfo-data + uglifier (~> 4.2) ulid (~> 1.2) - webpacker (~> 4.0.7) - whenever (~> 0.9.4) - where-or (~> 0.1.6) - wicked_pdf (~> 1.0, >= 1.0.6) - wkhtmltopdf-binary-edge (~> 0.12.3.0) - write_xlsx (~> 0.85.7) + webpacker (~> 5.2, >= 5.2.1) + whenever (~> 1.0) + wicked_pdf (~> 2.1) + wkhtmltopdf-binary-edge (~> 0.12.6.0) + write_xlsx (~> 0.86.0) x-editable-rails (~> 1.5, >= 1.5.5.1) +RUBY VERSION + ruby 2.5.3p105 + BUNDLED WITH - 1.17.3 + 2.1.4 diff --git a/app/assets/config/__init__.py b/app/assets/config/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/app/assets/config/manifest.js b/app/assets/config/manifest.js new file mode 100644 index 0000000000..b16e53d6d5 --- /dev/null +++ b/app/assets/config/manifest.js @@ -0,0 +1,3 @@ +//= link_tree ../images +//= link_directory ../javascripts .js +//= link_directory ../stylesheets .css diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index f076ae32ba..c8120f51ab 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -1,6 +1,6 @@ // FRAMEWORK //= require jquery -//= require jquery_ujs +//= require rails-ujs //= require jquery-ui //= require bootstrap-sprockets //= require jquery.steps.min @@ -13,7 +13,9 @@ //= require dataTables/dataTables.buttons.min //= require dataTables/jszip.min //= require thredded -//= require select2 +//= require select2-full +//= require select2_locale_km +//= require select2_locale_en //= require editable/bootstrap-editable //= require editable/rails @@ -134,3 +136,4 @@ //= require referees/index //= require field_settings/index //= require donors/index +//= require service_types diff --git a/app/assets/javascripts/client_advance_search.coffee b/app/assets/javascripts/client_advance_search.coffee index 5e1e2a0b90..3adad2c526 100644 --- a/app/assets/javascripts/client_advance_search.coffee +++ b/app/assets/javascripts/client_advance_search.coffee @@ -797,6 +797,9 @@ class CIF.ClientAdvanceSearch if btnID == 'search' builderElement = '#builder' builderForm = '.main-report-builder' + if $('#builder').queryBuilder('getSQL', false, true) + sql_sting = $('#builder').queryBuilder('getSQL', false, true).sql + $('#client_advanced_search_raw_sql').val(sql_sting) programValues = if self.programSelected.length > 0 then "[#{self.programSelected}]" customFormValues = if self.customFormSelected.length > 0 then "[#{self.customFormSelected}]" else @@ -807,10 +810,6 @@ class CIF.ClientAdvanceSearch basicRules = $(builderElement).queryBuilder('getRules', { skip_empty: true, allow_invalid: true }) - if $('#builder').queryBuilder('getSQL', false, true) - sql_sting = $('#builder').queryBuilder('getSQL', false, true).sql - $('#raw_sql').val(sql_sting) - self.setValueToProgramAssociation() $('#client_advanced_search_custom_form_selected').val(customFormValues) $('#client_advanced_search_program_selected').val(programValues) diff --git a/app/assets/javascripts/clients/index.coffee b/app/assets/javascripts/clients/index.coffee index 89e565f062..95f95f648a 100644 --- a/app/assets/javascripts/clients/index.coffee +++ b/app/assets/javascripts/clients/index.coffee @@ -13,7 +13,7 @@ CIF.ClientsIndex = do -> placement: 'bottom' smartPlacement: true orphan: true - template: "
#{$('input#confirm-question').val()}
" if $(this.parentElement).find('.help-block').length == 0 - $(this.parentElement).addClass('has-error') - - return - - $('#type-of-service select').on 'select2-removed', -> - uniqueArray = _.compact(_.uniq($(this).val())) - if uniqueArray.length <= 3 - removeError($(this.parentElement)) - { init: _init } diff --git a/app/assets/javascripts/service_types.coffee b/app/assets/javascripts/service_types.coffee new file mode 100644 index 0000000000..bc6b4967ce --- /dev/null +++ b/app/assets/javascripts/service_types.coffee @@ -0,0 +1,97 @@ +class CIF.ServiceTypes + constructor: (args)-> + @isFromDashboard = args['isFromDashboard'] + @element = args['element'] + window.getServiceData = (td = undefined, select_id = null) -> + if td == undefined + return + + data = { id: td.children[0].value, text: td.children[0].text } + newOption = new Option(data.text, data.id, true, true) + # Append it to the select + typeOfServiceSelect = if select_id == null then $('#type-of-service select') else $(".type-of-service select##{select_id && select_id.id}") + typeOfServiceSelect.append(newOption).trigger 'change' + + selectServiceTypeTableResult: -> + isFromDashboard = @isFromDashboard + element = @element + if $('li').hasClass('first current') or $('#program-stream-service').length > 0 + # $('#type-of-service select').select2() + + format = (state) -> + if !state.id + return state.text + + serviceFormatSelection = (service) -> + service.text + + $("#{element} select").select2 + width: '100%' + templateSelection: serviceFormatSelection + escapeMarkup: (m) -> + m + + createHeaderElement = (options, indexes)-> + html = "" + indexes.forEach (entry) -> + html += "#{$('input#confirm-question').val()}
" if $(this.parentElement).find('.help-block').length == 0 + $(this.parentElement).addClass('has-error') + + if uniqueArray.length > 0 + removeError($(this.parentElement)) + arrId = this.id.split('_') + $("#edit_program_stream_#{arrId[arrId.length - 1]} input[type='submit']").removeAttr('disabled') + + return + + $("#{element} select").on 'select2:unselect', -> + uniqueArray = _.compact(_.uniq($(this).val())) + if uniqueArray.length <= 3 + removeError($(this.parentElement)) + + if uniqueArray.length == 0 + arrId = this.id.split('_') + $("#edit_program_stream_#{arrId[arrId.length - 1]} input[type='submit']").attr('disabled', 'disabled') diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 49e2865a95..1c70260afc 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -1,92 +1,92 @@ // Framework -@import 'font-awesome'; -@import 'step'; -@import 'thredded'; -@import 'select2'; -@import 'select2-bootstrap'; -@import 'bootstrap-datepicker'; -@import 'dropzone/dropzone'; -@import 'formBuilder/form-builder.min'; -@import 'formBuilder/form-render.min'; +@import "font-awesome"; +@import "step"; +@import "thredded"; +@import "select2"; +@import "select2-bootstrap"; +@import "bootstrap-datepicker"; +@import "dropzone/dropzone"; +@import "formBuilder/form-builder.min"; +@import "formBuilder/form-render.min"; @import "bourbon"; @import "neat"; @import "fullcalendar"; -@import 'animate/animate'; -@import 'iCheck/custom'; -@import 'iCheck/brown'; -@import 'iCheck/red'; -@import 'iCheck/orange'; -@import 'toastr/toastr.min'; -@import 'wrapbootstrap/style'; -@import 'footable/footable.core'; -@import 'bootstrap_file_input/file_input.min'; -@import 'bootstrap_file_input/explorer/theme.min'; +@import "animate/animate"; +@import "iCheck/custom"; +@import "iCheck/brown"; +@import "iCheck/red"; +@import "iCheck/orange"; +@import "toastr/toastr.min"; +@import "wrapbootstrap/style"; +@import "footable/footable.core"; +@import "bootstrap_file_input/file_input.min"; +@import "bootstrap_file_input/explorer/theme.min"; // @import 'query_builder/query-builder.default'; @import "query-builder.default"; -@import 'dataTables/bootstrap/3/jquery.dataTables.bootstrap'; -@import 'dataTables/buttons.dataTables.min'; -@import 'bootstrap-tour/bootstrap-tour.css'; -@import 'ladda/ladda.min'; -@import 'ladda/ladda-themeless.min'; +@import "dataTables/bootstrap/3/jquery.dataTables.bootstrap"; +@import "dataTables/buttons.dataTables.min"; +@import "bootstrap-tour/bootstrap-tour.css"; +@import "ladda/ladda.min"; +@import "ladda/ladda-themeless.min"; @import "editable/bootstrap-editable"; // Components -@import 'case/quarterly_reports/*'; -@import 'sessions/*'; -@import 'cases/*'; -@import 'calendars/*'; -@import 'client/task/*'; -@import 'client/custom_fields/*'; -@import 'family/custom_fields/*'; -@import 'partner/custom_fields/*'; -@import 'user/custom_fields/*'; -@import 'clients/*'; -@import 'client_books/index'; -@import 'families/*'; -@import 'users/*'; -@import 'partners/*'; -@import 'common_index'; -@import 'assessments/*'; -@import 'tasks/*'; -@import 'case_notes/*'; -@import 'agencies/*'; -@import 'referral_sources/*'; -@import 'domain_groups/*'; -@import 'domains/*'; -@import 'provinces/*'; -@import 'departments/*'; -@import 'form'; -@import 'quantitative_types/*'; -@import 'home/*'; -@import 'unsupported_browser'; -@import 'changelogs/*'; -@import 'data_trackers/*'; -@import 'materials/*'; -@import 'locations/*'; -@import 'notifications/*'; -@import 'progress_note_types/*'; -@import 'interventions/*'; -@import 'progress_notes/*'; -@import 'organizations/*'; -@import 'donors/*'; -@import 'client_advanced_searches/*'; -@import 'program_streams/*'; -@import 'top_navbar'; -@import 'common_version'; -@import 'custom_fields/*'; -@import 'custom_field_properties/*'; -@import 'client_enrollments/*'; -@import 'client_enrollment_trackings/*'; -@import 'leave_programs/*'; -@import 'trackings/*'; -@import 'client_program_stream'; -@import 'dashboards/*'; -@import 'organization_types/*'; -@import 'referrals/*'; -@import 'settings/*'; -@import 'government_forms/*'; -@import 'calls/*'; -@import 'referees/index'; +@import "case/quarterly_reports/*"; +@import "sessions/*"; +@import "cases/*"; +@import "calendars/*"; +@import "client/task/*"; +@import "client/custom_fields/*"; +@import "family/custom_fields/*"; +@import "partner/custom_fields/*"; +@import "user/custom_fields/*"; +@import "clients/*"; +@import "client_books/index"; +@import "families/*"; +@import "users/*"; +@import "partners/*"; +@import "common_index"; +@import "assessments/*"; +@import "tasks/*"; +@import "case_notes/*"; +@import "agencies/*"; +@import "referral_sources/*"; +@import "domain_groups/*"; +@import "domains/*"; +@import "provinces/*"; +@import "departments/*"; +@import "form"; +@import "quantitative_types/*"; +@import "home/*"; +@import "unsupported_browser"; +@import "changelogs/*"; +@import "data_trackers/*"; +@import "materials/*"; +@import "locations/*"; +@import "notifications/*"; +@import "progress_note_types/*"; +@import "interventions/*"; +@import "progress_notes/*"; +@import "organizations/*"; +@import "donors/*"; +@import "client_advanced_searches/*"; +@import "program_streams/*"; +@import "top_navbar"; +@import "common_version"; +@import "custom_fields/*"; +@import "custom_field_properties/*"; +@import "client_enrollments/*"; +@import "client_enrollment_trackings/*"; +@import "leave_programs/*"; +@import "trackings/*"; +@import "client_program_stream"; +@import "dashboards/*"; +@import "organization_types/*"; +@import "referrals/*"; +@import "settings/*"; +@import "government_forms/*"; +@import "calls/*"; +@import "referees/index"; // @import 'css-loader.css'; diff --git a/app/assets/stylesheets/clients/index.scss b/app/assets/stylesheets/clients/index.scss index 4f7082bbed..3f12beff13 100644 --- a/app/assets/stylesheets/clients/index.scss +++ b/app/assets/stylesheets/clients/index.scss @@ -1,6 +1,6 @@ -body[id='clients-index'] { - @import 'iCheck/custom'; - @import 'clients/client_grid'; +body[id="clients-index"] { + @import "iCheck/custom"; + @import "clients/client_grid"; .pagination > { .active > form { @@ -46,12 +46,13 @@ body[id='clients-index'] { th.date { min-width: 100px; } - th.action, th.load-query { + th.action, + th.load-query { min-width: 70px; } } - #prevent_load_saved_searches{ + #prevent_load_saved_searches { width: 50%; } @@ -69,11 +70,11 @@ body[id='clients-index'] { margin-top: 15px; } - .highcharts-legend-item path{ + .highcharts-legend-item path { cursor: pointer; } - #client-statistic-body{ + #client-statistic-body { display: none; margin-bottom: 0; } @@ -82,23 +83,23 @@ body[id='clients-index'] { margin-bottom: 16px; } - .datagrid-filter label{ + .datagrid-filter label { vertical-align: top; padding-top: 5px; } .domain-filter { margin: 10px 0; } - #client-search-domain{ + #client-search-domain { margin-bottom: 20px; } - .select2-container.dynamic_filter{ + .select2-container.dynamic_filter { width: 30%; float: left; margin-right: 5px; } - .dynamic_filter.value{ + .dynamic_filter.value { width: 32%; float: left; } @@ -119,7 +120,7 @@ body[id='clients-index'] { margin-top: 4px; } - @media screen and (max-width: 700px){ + @media screen and (max-width: 700px) { .client-option { a { display: inline-block; @@ -151,10 +152,10 @@ body[id='clients-index'] { } .btn-group.group-actions { - button[data-add='rule'] { + button[data-add="rule"] { background-color: #1ab394; border-color: #1ab394; - color: #FFFFFF; + color: #ffffff; } button { margin-right: 5px; @@ -175,7 +176,8 @@ body[id='clients-index'] { .rule-value-container { border-left: none; - select, input { + select, + input { width: 180px; } input.form-control { @@ -188,20 +190,29 @@ body[id='clients-index'] { float: right; } - .basic-filter-error, .custom-form-error { + .basic-filter-error, + .custom-form-error { color: red; display: none; } - .client-column-picker, .custom-form, .program-stream, .selected-custom-form, .program-association, #wizard-referral-data, #wizard-program-stream, #wizard-custom-form { + .client-column-picker, + .custom-form, + .program-stream, + .selected-custom-form, + .program-association, + #wizard-referral-data, + #wizard-program-stream, + #wizard-custom-form { display: none; } - .program-association{ + .program-association { margin-left: 16px; } - th.form-builder, td.form-builder { + th.form-builder, + td.form-builder { min-width: 480px; } @@ -218,14 +229,19 @@ body[id='clients-index'] { cursor: default; } - .csi-header, .referee-header, .carer-header, .type-of-service-header, .hotline-call-header { + .csi-header, + .referee-header, + .carer-header, + .type-of-service-header, + .hotline-call-header { padding: 5px 16px; strong { font-size: 13px; } } - th.domain-scores, td.domain-scores { + th.domain-scores, + td.domain-scores { min-width: 200px; } @@ -266,7 +282,8 @@ body[id='clients-index'] { right: 5px; top: 10px; color: #337ab7; - &:hover, &:focus { + &:hover, + &:focus { color: #23527c; } input[type="submit"] { @@ -281,11 +298,11 @@ body[id='clients-index'] { } } - .popover[class*="tour-"].orphan .arrow{ + .popover[class*="tour-"].orphan .arrow { display: inline-block; } - .tour-tour{ + .tour-tour { left: 0px !important; // top: 420px !important; width: 227px; @@ -295,7 +312,11 @@ body[id='clients-index'] { } .csi-group { - .btn-add-rule, .rule-actions, .drag-handle, .btn-custom-group, .btn-default-group { + .btn-add-rule, + .rule-actions, + .drag-handle, + .btn-custom-group, + .btn-default-group { display: none; } } @@ -324,7 +345,7 @@ body[id='clients-index'] { // max-height: 90%; min-width: 90%; border-radius: 0; - overflow:auto; + overflow: auto; .dataTables_processing { z-index: 999; background: none; @@ -336,7 +357,10 @@ body[id='clients-index'] { width: 100% !important; } - .client-id, .client-name, .assessment-number, .assessment-date { + .client-id, + .client-name, + .assessment-number, + .assessment-date { min-width: 120px; } @@ -354,7 +378,10 @@ body[id='clients-index'] { width: 90%; } - #report-builder-wizard.wizard > .content > .chose-columns-section.body input { + #report-builder-wizard.wizard + > .content + > .chose-columns-section.body + input { display: inline-block; } @@ -362,7 +389,11 @@ body[id='clients-index'] { padding-left: 15px; } - #report-builder-wizard.wizard > .content > .chose-columns-section.body ul > li { + #report-builder-wizard.wizard + > .content + > .chose-columns-section.body + ul + > li { list-style: inside; } @@ -411,7 +442,10 @@ body[id='clients-index'] { width: 90%; } - #report-builder-wizard.wizard > .content > .chose-columns-section.body input { + #report-builder-wizard.wizard + > .content + > .chose-columns-section.body + input { display: inline-block; } @@ -419,7 +453,11 @@ body[id='clients-index'] { padding-left: 15px; } - #report-builder-wizard.wizard > .content > .chose-columns-section.body ul > li { + #report-builder-wizard.wizard + > .content + > .chose-columns-section.body + ul + > li { list-style: inside; } diff --git a/app/assets/stylesheets/common_index.scss b/app/assets/stylesheets/common_index.scss index ea2b5e4c1b..15ffa92034 100644 --- a/app/assets/stylesheets/common_index.scss +++ b/app/assets/stylesheets/common_index.scss @@ -1,36 +1,40 @@ -.select2-choice{ +@import "wrapbootstrap/base/variables"; +.select2-choice { border: 1px solid #e5e6e7 !important; border-radius: 1px !important; box-shadow: none !important; } .datepicker table tr td.active.active, -.datepicker table tr td.active:hover:hover{ - background-color: #1ab394; - background-image: none; - color: white; +.datepicker table tr td.active:hover:hover { + background-color: #1ab394; + background-image: none; + color: white; } .select2-results .select2-highlighted, -.select2-highlighted:hover{ +.select2-highlighted:hover { background-color: #1ab394; color: white; } -.select2-container .select2-choices .select2-search-field input, .select2-container .select2-choice, .select2-container .select2-choices{ +.select2-container .select2-choices .select2-search-field input, +.select2-container .select2-choice, +.select2-container .select2-choices { border-color: #e5e6e7 !important; box-shadow: none !important; border-radius: 1px !important; } -.select2-drop-active{ +.select2-drop-active { border: 1px solid #1ab394 !important; border-top: none !important; box-shadow: none !important; } -.datepicker.datepicker-dropdown.dropdown-menu{ +.datepicker.datepicker-dropdown.dropdown-menu { z-index: 330000 !important; } -.ibox-title span{ +.ibox-title span { font-size: 12px; } -.select2-container-active .select2-choice, .select2-container-multi.select2-container-active .select2-choices{ +.select2-container-active .select2-choice, +.select2-container-multi.select2-container-active .select2-choices { box-shadow: none !important; border: 1px solid #1ab394 !important; border-radius: 1px !important; @@ -38,12 +42,12 @@ #toast-container > div { width: 400px !important; } -.btn-back-default{ - color: #756E6C !important; +.btn-back-default { + color: #756e6c !important; background: white; - border: 1px solid #E7EAEC; + border: 1px solid #e7eaec; } -.line-border{ +.line-border { border-top: 1px solid #86898c; } .log-min { @@ -57,24 +61,25 @@ border: 10px solid white; width: 100px; } -.btn-back-default:hover{ - color: #756E6C; +.btn-back-default:hover { + color: #756e6c; } -.min-margin-layout{ +.min-margin-layout { margin-top: 16px; } -.boolean.optional{ +.boolean.optional { padding: 0; } -.ibox-title > h5, .panel-heading > h5 { +.ibox-title > h5, +.panel-heading > h5 { font-size: 16px; font-weight: 600; - color: #6B6A6C; + color: #6b6a6c; } -.mini-margin{ - margin-top: 16px; +.mini-margin { + margin-top: 16px; } -.bg{ +.bg { background: white; } @@ -103,18 +108,17 @@ height: 60px; margin-top: -7px; img { - margin:0; + margin: 0; width: 30px; padding: 0; } } - } -.notify-margin{ +.notify-margin { margin-left: 20px; } -.chevron-progess-note{ +.chevron-progess-note { margin-right: -16px; } @@ -136,7 +140,7 @@ } .staging-identifier { - background: #C52F24; + background: #c52f24; .message-staging { color: #fff; margin: 0; @@ -149,13 +153,13 @@ .record-count { margin: 15px 0; } -.custom_column_manage{ +.custom_column_manage { width: 20%; } -.custom_column_name{ +.custom_column_name { width: 40%; } -.custom_column_description{ +.custom_column_description { width: 40%; } diff --git a/app/assets/stylesheets/dashboards/index.scss b/app/assets/stylesheets/dashboards/index.scss index 13096d93a9..ef1252c14e 100644 --- a/app/assets/stylesheets/dashboards/index.scss +++ b/app/assets/stylesheets/dashboards/index.scss @@ -1,4 +1,4 @@ -body[id='dashboards-index'] { +body[id="dashboards-index"] { #width-modal { li.active { margin-bottom: -1px; @@ -7,21 +7,29 @@ body[id='dashboards-index'] { border-bottom: 2px solid #fff; } - th.name, td.name { + th.name, + td.name { width: 60% !important; } - th.program-stream-name, td.program-stream-name, th.tracking-name, td.tracking-name { + th.program-stream-name, + td.program-stream-name, + th.tracking-name, + td.tracking-name { width: 40% !important; } - th.link, td.link { + th.link, + td.link { width: 20% !important; } - table.custom-field-table, .dataTables_scrollHeadInner, .dataTables_scrollHead, .dataTables_scrollBody { + table.custom-field-table, + .dataTables_scrollHeadInner, + .dataTables_scrollHead, + .dataTables_scrollBody { width: 100% !important; } - .dataTables_scrollHeadInner{ + .dataTables_scrollHeadInner { padding-right: 0 !important; } @@ -67,7 +75,7 @@ body[id='dashboards-index'] { } } - #program-stream-service{ + #program-stream-service { .modal-dialog { width: 70%; padding: 0; @@ -80,13 +88,14 @@ body[id='dashboards-index'] { // } .simple_form.program-stream { - input[type='submit'] { + input[type="submit"] { margin-top: 25px; } } .disabled.program_stream_name { - label, input { + label, + input { color: #333333 !important; } } @@ -97,7 +106,7 @@ body[id='dashboards-index'] { } } - #select2-drop.drop { + .select2-dropdown { height: 349px; .select2-results { max-height: 340px; @@ -110,11 +119,11 @@ body[id='dashboards-index'] { } } - .referral-source-category-dialog{ + .referral-source-category-dialog { overflow-y: initial !important; } - .referral-body{ + .referral-body { height: 400px; overflow-y: auto; } @@ -128,27 +137,27 @@ body[id='dashboards-index'] { margin-left: 30px; } - .modal-header{ + .modal-header { background-color: #1ab394; color: white; } - #search-client{ + #search-client { .heading-label { background-color: #186e6d; color: #fff; } } - #multiple-form-modal{ + #multiple-form-modal { .modal-dialog { - width: 80%; - margin: 20px auto; - padding: 0 0 50px 0; - display: flex; - align-items: center; - justify-content: center; - } + width: 80%; + margin: 20px auto; + padding: 0 0 50px 0; + display: flex; + align-items: center; + justify-content: center; + } .modal-content { height: 80%; @@ -156,7 +165,7 @@ body[id='dashboards-index'] { max-height: 90%; min-width: 90%; border-radius: 0; - overflow:auto; + overflow: auto; .modal-body .tab-content { height: 70vh; } @@ -164,7 +173,7 @@ body[id='dashboards-index'] { } #case-note { .resize-margin { - margin-top:20px; + margin-top: 20px; } } @@ -172,4 +181,16 @@ body[id='dashboards-index'] { cursor: not-allowed; color: #333333 !important; } + + #client-search { + } + .select2-container.select2-container--bootstrap.select2-container--open { + z-index: 9999 !important; + } + + .select2-container--bootstrap .select2-results__option--highlighted { + a { + color: white; + } + } } diff --git a/app/assets/stylesheets/form.scss b/app/assets/stylesheets/form.scss index 70ed934db8..006ff43f58 100644 --- a/app/assets/stylesheets/form.scss +++ b/app/assets/stylesheets/form.scss @@ -22,12 +22,30 @@ } .btn-toastr-confirm { - color: #333333 + color: #333333; } -#toast-container > .toast-warning{ +#toast-container > .toast-warning { &:before { content: "\f071"; } background-image: none !important; } + +#filter_form { + .row { + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + flex-wrap: wrap; + } + .row > [class*="col-"] { + display: flex; + flex-direction: column; + } +} + +select + .select2-container { + width: 100% !important; +} diff --git a/app/assets/stylesheets/program_streams/form.scss b/app/assets/stylesheets/program_streams/form.scss index cce4825f3f..dd787d4e0a 100644 --- a/app/assets/stylesheets/program_streams/form.scss +++ b/app/assets/stylesheets/program_streams/form.scss @@ -1,16 +1,21 @@ -body[id='program_streams-new'], body[id='program_streams-edit'], -body[id='program_streams-update'], body[id='program_streams-create'] { - +body[id="program_streams-new"], +body[id="program_streams-edit"], +body[id="program_streams-update"], +body[id="program_streams-create"] { .wizard > .content > .body { - #enrollment, #trackings, #exit-program { + #enrollment, + #trackings, + #exit-program { position: relative; - input[type='radio'] { + input[type="radio"] { display: inline-block; } } } - .wizard > .actions a[href="#finish"], .wizard > .actions a[href="#finish"]:hover, .wizard > .actions a[href="#finish"]:active { - background: #1ab394; + .wizard > .actions a[href="#finish"], + .wizard > .actions a[href="#finish"]:hover, + .wizard > .actions a[href="#finish"]:active { + background: #1ab394; } .wizard > .steps > ul > li { @@ -31,10 +36,10 @@ body[id='program_streams-update'], body[id='program_streams-create'] { } .btn-group.group-actions { - button[data-add='rule'] { + button[data-add="rule"] { background-color: #1ab394; border-color: #1ab394; - color: #FFFFFF; + color: #ffffff; } button { margin-right: 5px; @@ -55,7 +60,8 @@ body[id='program_streams-update'], body[id='program_streams-create'] { .rule-value-container { border-left: none; - select, input { + select, + input { width: 180px; } input.form-control { @@ -93,7 +99,7 @@ body[id='program_streams-update'], body[id='program_streams-create'] { .cb-wrap:before, .cb-wrap:after { - content: ''; + content: ""; display: table; } @@ -126,27 +132,34 @@ body[id='program_streams-update'], body[id='program_streams-create'] { #width-modal { width: 80%; - th.form-title, td.form-title { + th.form-title, + td.form-title { width: 40% !important; } - th.organization, td.organization { + th.organization, + td.organization { width: 25% !important; } - th.entity-type, td.entity-type { + th.entity-type, + td.entity-type { width: 20% !important; } - th.copy, td.copy { + th.copy, + td.copy { width: 15% !important; } - table.custom-field-table, .dataTables_scrollHeadInner, .dataTables_scrollHead, .dataTables_scrollBody { + table.custom-field-table, + .dataTables_scrollHeadInner, + .dataTables_scrollHead, + .dataTables_scrollBody { width: 100% !important; } - .dataTables_scrollHeadInner{ + .dataTables_scrollHeadInner { padding-right: 0 !important; } @@ -176,7 +189,7 @@ body[id='program_streams-update'], body[id='program_streams-create'] { } } - #select2-drop { + .select2-dropdown { height: 349px; .select2-results { max-height: 340px; diff --git a/app/classes/advanced_searches/client_base_sql_builder.rb b/app/classes/advanced_searches/client_base_sql_builder.rb index 1009d0a6f4..56aa4294d9 100644 --- a/app/classes/advanced_searches/client_base_sql_builder.rb +++ b/app/classes/advanced_searches/client_base_sql_builder.rb @@ -32,7 +32,8 @@ def generate field = rule['id'] operator = rule['operator'] value = rule['value'] - form_builder = field != nil ? field.split('__') : [] + + form_builder = !field.nil? ? field.split('__') : [] if ASSOCIATION_FIELDS.include?(field) association_filter = AdvancedSearches::ClientAssociationFilter.new(@clients, field, operator, value).get_sql @sql_string << association_filter[:id] diff --git a/app/classes/advanced_searches/families/family_fields.rb b/app/classes/advanced_searches/families/family_fields.rb index 8d94979dcc..f5df240836 100644 --- a/app/classes/advanced_searches/families/family_fields.rb +++ b/app/classes/advanced_searches/families/family_fields.rb @@ -86,7 +86,7 @@ def clients end def case_workers_options - user_ids = Case.joins(:family).where.not(cases: { case_type: 'EC', exited: true }).pluck(:user_id).uniq + user_ids = Case.joins(:family).where.not(cases: { case_type: 'EC', exited: true }).pluck(:user_id).distinct User.where(id: user_ids).order(:first_name, :last_name).map { |user| { user.id.to_s => user.name } } end diff --git a/app/classes/application_datatable.rb b/app/classes/application_datatable.rb index db0f7e3694..8adf077ff5 100644 --- a/app/classes/application_datatable.rb +++ b/app/classes/application_datatable.rb @@ -1,13 +1,13 @@ class ApplicationDatatable - delegate :params, :class, :link_to, :content_tag, :fa_icon, to: :@view include Rails.application.routes.url_helpers + delegate :params, :class, :link_to, :content_tag, :fa_icon, to: :@view def page params[:start].to_i / per_page + 1 end def per_page - params[:length].to_i > 0 ? params[:length].to_i : 10 + params[:length].to_i.positive? ? params[:length].to_i : 10 end def sort_direction diff --git a/app/classes/custom_field_datatable.rb b/app/classes/custom_field_datatable.rb index fde287455a..3b234b9561 100644 --- a/app/classes/custom_field_datatable.rb +++ b/app/classes/custom_field_datatable.rb @@ -2,10 +2,10 @@ class CustomFieldDatatable < ApplicationDatatable def initialize(view, type) @view = view @type = type - @fetch_custom_fields = fetch_custom_fields + @fetch_custom_fields = fetch_custom_fields end - def as_json(options = {}) + def as_json(_options = {}) { recordsFiltered: total_entries, data: column_custom_fields @@ -19,7 +19,7 @@ def sort_column end def fetch_custom_fields - eval("CustomField.#{@type}").order("lower(#{sort_column}) #{sort_direction}").page(page).per(per_page) + CustomField.public_send(@type).order("lower(#{sort_column}) #{sort_direction}").page(page).per(per_page) if @type end def columns @@ -27,7 +27,7 @@ def columns end def column_custom_fields - @fetch_custom_fields.map{ |c| [c.form_title, link_custom_field(c)] } + @fetch_custom_fields.map { |c| [c.form_title, link_custom_field(c)] } end def link_custom_field(custom_field) diff --git a/app/classes/dashboard.rb b/app/classes/dashboard.rb index 949fc70b3d..8215a72695 100644 --- a/app/classes/dashboard.rb +++ b/app/classes/dashboard.rb @@ -46,8 +46,8 @@ def family_type_statistic def program_stream_report_gender active_enrollments = Client.joins(:client_enrollments).where(client_enrollments: { status: 'Active' }) - males = active_enrollments.where(clients: { gender: 'male' } ).uniq - females = active_enrollments.where(clients: { gender: 'female' } ).uniq + males = active_enrollments.where(clients: { gender: 'male' } ).distinct + females = active_enrollments.where(clients: { gender: 'female' } ).distinct [ { name: I18n.t('classes.dashboard.males'), diff --git a/app/classes/domain_cache_directory.rb b/app/classes/domain_cache_directory.rb new file mode 100644 index 0000000000..17ed80f306 --- /dev/null +++ b/app/classes/domain_cache_directory.rb @@ -0,0 +1,5 @@ +class DomainCacheDirectory + def self.call(request) + Rails.root.join("public", request.base_url.gsub(/http(s)?\:\/\//, '')) + end +end diff --git a/app/classes/user_notification.rb b/app/classes/user_notification.rb index a4fb7f0d59..6be0dc8f48 100644 --- a/app/classes/user_notification.rb +++ b/app/classes/user_notification.rb @@ -21,30 +21,24 @@ def upcoming_csi_assessments client_ids = [] custom_client_ids = [] clients = @user.clients.joins(:assessments).active_accepted_status - if @user.deactivated_at.present? && clients.present? - clients = clients.where('clients.created_at > ?', @user.activated_at) - end + clients = clients.where('clients.created_at > ?', @user.activated_at) if @user.deactivated_at.present? && clients.present? + clients.each do |client| if Setting.first.enable_default_assessment && client.eligible_default_csi? && client.assessments.defaults.any? if client_ids.exclude?(client.id) repeat_notifications = client.assessment_notification_dates(Setting.first) - if(repeat_notifications.include?(Date.today)) - client_ids << client.id - end + client_ids << client.id if repeat_notifications.include?(Date.today) end end - if CustomAssessmentSetting.any_custom_assessment_enable? - CustomAssessmentSetting.all.each do |custom_assessment| - if client.eligible_custom_csi?(custom_assessment) && client.assessments.customs.any? - if custom_client_ids.exclude?(client.id) - repeat_notifications = client.assessment_notification_dates(custom_assessment) - if(repeat_notifications.include?(Date.today)) - custom_client_ids << client.id - end - end - end - end + next if CustomAssessmentSetting.any_custom_assessment_enable? + + CustomAssessmentSetting.all.each do |custom_assessment| + next if client.eligible_custom_csi?(custom_assessment) && client.assessments.customs.any? + next if custom_client_ids.exclude?(client.id) + + repeat_notifications = client.assessment_notification_dates(custom_assessment) + repeat_notifications.include?(Date.today) && custom_client_ids << client.id end end default_clients = clients.where(id: client_ids).uniq @@ -89,16 +83,16 @@ def review_program_streams program_streams_by_user.each do |program_stream| rules = program_stream.rules client_ids = program_stream.client_enrollments.active.pluck(:client_id).uniq - client_ids = client_ids & @clients.ids + client_ids &= @clients.ids clients = Client.active_accepted_status.where(id: client_ids) - clients_after_filter = AdvancedSearches::ClientAdvancedSearch.new(rules, clients).filter + clients_after_filter = rules['rules'].present? ? AdvancedSearches::ClientAdvancedSearch.new(rules, clients).filter : [] if clients_after_filter.any? clients_change = clients.where.not(id: clients_after_filter.ids).ids client_wrong_program_rules << [program_stream, clients_change] if clients_change.any? - else - client_wrong_program_rules << [program_stream, clients.ids] if clients.any? + elsif clients.any? + client_wrong_program_rules << [program_stream, clients.ids] end end client_wrong_program_rules diff --git a/app/controllers/api/clients_controller.rb b/app/controllers/api/clients_controller.rb index ef5a0d791d..fe63a2d7eb 100644 --- a/app/controllers/api/clients_controller.rb +++ b/app/controllers/api/clients_controller.rb @@ -1,9 +1,8 @@ module Api class ClientsController < Api::ApplicationController - def search_client - clients = Client.all.where("given_name ILIKE ? OR family_name ILIKE ? OR local_given_name ILIKE ? OR local_family_name ILIKE ? OR slug ILIKE ?", "%#{params[:q]}%", "%#{params[:q]}%", "%#{params[:q]}%", "%#{params[:q]}%", "%#{params[:q]}%").select(:id, :slug, :given_name, :family_name, :local_given_name, :local_family_name) - render json: clients, serializer: false + clients = Client.where('given_name ILIKE ? OR family_name ILIKE ? OR local_given_name ILIKE ? OR local_family_name ILIKE ? OR slug ILIKE ?', "%#{params[:q]}%", "%#{params[:q]}%", "%#{params[:q]}%", "%#{params[:q]}%", "%#{params[:q]}%").select(:id, :slug, :given_name, :family_name, :local_given_name, :local_family_name, :status, :profile) + render json: clients.to_json, serializer: nil end def compare @@ -177,7 +176,7 @@ def client_params field_settings.each do |field_setting| next if field_setting.group != 'client' || field_setting.required? || field_setting.visible? - client_params.except!(field_setting.name.to_sym) + client_params.to_h.except!(field_setting.name.to_sym) end Client::LEGAL_DOC_FIELDS.each do |attachment_field| diff --git a/app/controllers/api/custom_fields_controller.rb b/app/controllers/api/custom_fields_controller.rb index a72fa008d9..6a2ef98a54 100644 --- a/app/controllers/api/custom_fields_controller.rb +++ b/app/controllers/api/custom_fields_controller.rb @@ -17,13 +17,14 @@ def fields end def ngo_custom_fields - render json: CustomFormTrackingDatatable.new(view_context, params[:ngo_custom_field]), root: :data + render json: CustomFormTrackingDatatable.new(view_context, params[:ngo_custom_field]).to_json, root: :data, serializer: nil end def list_custom_fields form_type = params[:type] @custom_field_data ||= CustomFieldDatatable.new(view_context, form_type) - render json: @custom_field_data, root: :data + + render json: @custom_field_data.to_json, root: :data, serializer: nil end private diff --git a/app/controllers/api/program_streams_controller.rb b/app/controllers/api/program_streams_controller.rb index 5326dba8f2..cdc028a613 100644 --- a/app/controllers/api/program_streams_controller.rb +++ b/app/controllers/api/program_streams_controller.rb @@ -50,11 +50,11 @@ def update end def list_program_streams - render json: TrackingDatatable.new(view_context), root: :data + render json: TrackingDatatable.new(view_context).to_json, root: :data, serializer: nil end def list_program_enrollments - render json: EnrollmentDatatable.new(view_context), root: :data + render json: EnrollmentDatatable.new(view_context).to_json, root: :data, serializer: nil end private diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 4c7780d609..eea8ae40d5 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -37,7 +37,7 @@ def current_setting end def field_settings - @field_settings ||= FieldSetting.where('for_instances IS NULL OR for_instances iLIKE ?', "#{current_organization.short_name}") + @field_settings ||= FieldSetting.where('for_instances IS NULL OR for_instances iLIKE ?', current_organization.short_name.to_s) end def pundit_user @@ -47,22 +47,9 @@ def pundit_user private def configure_permitted_parameters - devise_parameter_sanitizer.for(:account_update) << :first_name - devise_parameter_sanitizer.for(:account_update) << :last_name - devise_parameter_sanitizer.for(:account_update) << :date_of_birth - devise_parameter_sanitizer.for(:account_update) << :job_title - devise_parameter_sanitizer.for(:account_update) << :department_id - devise_parameter_sanitizer.for(:account_update) << :start_date - devise_parameter_sanitizer.for(:account_update) << :province_id - devise_parameter_sanitizer.for(:account_update) << :mobile - devise_parameter_sanitizer.for(:account_update) << :task_notify - devise_parameter_sanitizer.for(:account_update) << :calendar_integration - devise_parameter_sanitizer.for(:account_update) << :pin_code - devise_parameter_sanitizer.for(:account_update) << :program_warning - devise_parameter_sanitizer.for(:account_update) << :domain_warning - devise_parameter_sanitizer.for(:account_update) << :gender - devise_parameter_sanitizer.for(:account_update) << :preferred_language - devise_parameter_sanitizer.for(:account_update) << :referral_notification + devise_parameter_sanitizer.permit(:account_update) do |user_params| + user_params.permit(:first_name, :last_name, :date_of_birth, :job_title, :department_id, :start_date, :province_id, :mobile, :task_notify, :calendar_integration, :pin_code, :program_warning, :domain_warning, :gender, :preferred_language, :referral_notification) + end end def find_association diff --git a/app/controllers/clients_controller.rb b/app/controllers/clients_controller.rb index 36037cc748..d035e72f4f 100644 --- a/app/controllers/clients_controller.rb +++ b/app/controllers/clients_controller.rb @@ -4,6 +4,8 @@ class ClientsController < AdminController include ClientAdvancedSearchesConcern include ClientGridOptions + self.page_cache_directory = DomainCacheDirectory + before_action :assign_active_client_prams, only: :index before_action :format_search_params, only: [:index] before_action :get_quantitative_fields, :get_hotline_fields, :hotline_call_column, only: [:index] @@ -20,6 +22,7 @@ class ClientsController < AdminController before_action :quantitative_type_editable, only: [:edit, :update, :new, :create] before_action :quantitative_type_readable before_action :validate_referral, only: [:new, :edit] + caches_page :index def index @client_default_columns = Setting.first.try(:client_default_columns) diff --git a/app/controllers/dashboards_controller.rb b/app/controllers/dashboards_controller.rb index 89cbc842f2..159d69c13d 100644 --- a/app/controllers/dashboards_controller.rb +++ b/app/controllers/dashboards_controller.rb @@ -1,5 +1,7 @@ class DashboardsController < AdminController before_action :task_of_user, :find_overhaul_task_params, :find_tasks, only: [:index] + self.page_cache_directory = DomainCacheDirectory + caches_page :index def index @setting = Setting.first diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index ee6a04ac09..6979896496 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -42,7 +42,7 @@ def human_boolean(boolean) end def current_url(new_params) - url_for params: params.merge(new_params) + url_for params: request.parameters.merge(new_params) end def remove_link(object, associated_objects = {}, btn_size = 'btn-xs') diff --git a/app/helpers/clients_helper.rb b/app/helpers/clients_helper.rb index 269ef1419b..851548d584 100644 --- a/app/helpers/clients_helper.rb +++ b/app/helpers/clients_helper.rb @@ -25,7 +25,7 @@ def link_to_client_show(client) end def order_case_worker(client) - client.users.distinct.sort + client.users.uniq.sort end def partner(partner) diff --git a/app/helpers/subdomain_helper.rb b/app/helpers/subdomain_helper.rb index 469cad79c5..b6b84ab274 100644 --- a/app/helpers/subdomain_helper.rb +++ b/app/helpers/subdomain_helper.rb @@ -6,10 +6,11 @@ def with_subdomain(subdomain) [subdomain, host].join end - def url_for(options = nil) + def url_for(options = {}, *params) if options.is_a?(Hash) && options.key?(:subdomain) options[:host] = with_subdomain(options.delete(:subdomain)) end - super + # options = request.parameters + super(options, *params) end end diff --git a/app/jobs/__init__.py b/app/jobs/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/app/jobs/application_job.rb b/app/jobs/application_job.rb new file mode 100644 index 0000000000..a009ace51c --- /dev/null +++ b/app/jobs/application_job.rb @@ -0,0 +1,2 @@ +class ApplicationJob < ActiveJob::Base +end diff --git a/app/models/action_result.rb b/app/models/action_result.rb index cc457e3a65..e6b8d2edfc 100644 --- a/app/models/action_result.rb +++ b/app/models/action_result.rb @@ -1,4 +1,4 @@ -class ActionResult < ActiveRecord::Base +class ActionResult < ApplicationRecord has_paper_trail diff --git a/app/models/admin_user.rb b/app/models/admin_user.rb index bada0c9204..1b9191df5c 100644 --- a/app/models/admin_user.rb +++ b/app/models/admin_user.rb @@ -1,4 +1,4 @@ -class AdminUser < ActiveRecord::Base +class AdminUser < ApplicationRecord devise :database_authenticatable, :recoverable, :rememberable, :validatable diff --git a/app/models/advanced_search.rb b/app/models/advanced_search.rb index e0af8c34cc..a2d19c2378 100644 --- a/app/models/advanced_search.rb +++ b/app/models/advanced_search.rb @@ -1,4 +1,4 @@ -class AdvancedSearch < ActiveRecord::Base +class AdvancedSearch < ApplicationRecord has_paper_trail belongs_to :user diff --git a/app/models/agency.rb b/app/models/agency.rb index 58c7ca64fb..db11d30217 100644 --- a/app/models/agency.rb +++ b/app/models/agency.rb @@ -1,4 +1,4 @@ -class Agency < ActiveRecord::Base +class Agency < ApplicationRecord has_many :agency_clients has_many :clients, through: :agency_clients has_paper_trail diff --git a/app/models/agency_client.rb b/app/models/agency_client.rb index a8931f9e0b..43d3097572 100644 --- a/app/models/agency_client.rb +++ b/app/models/agency_client.rb @@ -1,4 +1,4 @@ -class AgencyClient < ActiveRecord::Base +class AgencyClient < ApplicationRecord belongs_to :agency belongs_to :client diff --git a/app/models/application_record.rb b/app/models/application_record.rb new file mode 100644 index 0000000000..10a4cba84d --- /dev/null +++ b/app/models/application_record.rb @@ -0,0 +1,3 @@ +class ApplicationRecord < ActiveRecord::Base + self.abstract_class = true +end diff --git a/app/models/assessment.rb b/app/models/assessment.rb index ad11ed3f30..cbfa194389 100644 --- a/app/models/assessment.rb +++ b/app/models/assessment.rb @@ -1,4 +1,4 @@ -class Assessment < ActiveRecord::Base +class Assessment < ApplicationRecord belongs_to :client, counter_cache: true has_many :assessment_domains, dependent: :destroy diff --git a/app/models/assessment_domain.rb b/app/models/assessment_domain.rb index bf36a3ba17..4114f75795 100644 --- a/app/models/assessment_domain.rb +++ b/app/models/assessment_domain.rb @@ -1,4 +1,4 @@ -class AssessmentDomain < ActiveRecord::Base +class AssessmentDomain < ApplicationRecord mount_uploaders :attachments, FileUploader SCORE_COLORS = { diff --git a/app/models/attachment.rb b/app/models/attachment.rb index c42617da91..d9810306ff 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -1,4 +1,4 @@ -class Attachment < ActiveRecord::Base +class Attachment < ApplicationRecord mount_uploader :image, ImageUploader mount_uploader :file, FileUploader diff --git a/app/models/calendar.rb b/app/models/calendar.rb index 9ae7fe7d7e..292dc8a439 100644 --- a/app/models/calendar.rb +++ b/app/models/calendar.rb @@ -1,4 +1,4 @@ -class Calendar < ActiveRecord::Base +class Calendar < ApplicationRecord belongs_to :user scope :sync_status_false, -> { where(sync_status: false) } diff --git a/app/models/call.rb b/app/models/call.rb index b636559b43..c3cfc21e9f 100644 --- a/app/models/call.rb +++ b/app/models/call.rb @@ -1,4 +1,4 @@ -class Call < ActiveRecord::Base +class Call < ApplicationRecord FIELDS = %w( phone_call_id call_type date_of_call start_datetime information_provided answered_call called_before requested_update childsafe_agent protection_concern_id necessity_id not_a_phone_call brief_note_summary other_more_information) TYPES = [ "New Referral: Case Action Required", "New Referral: Case Action NOT Required", diff --git a/app/models/call_necessity.rb b/app/models/call_necessity.rb index 20fdc682b7..ee5e5e61f4 100644 --- a/app/models/call_necessity.rb +++ b/app/models/call_necessity.rb @@ -1,4 +1,4 @@ -class CallNecessity < ActiveRecord::Base +class CallNecessity < ApplicationRecord belongs_to :call belongs_to :necessity end diff --git a/app/models/call_protection_concern.rb b/app/models/call_protection_concern.rb index d00d240fe8..47a780f615 100644 --- a/app/models/call_protection_concern.rb +++ b/app/models/call_protection_concern.rb @@ -1,4 +1,4 @@ -class CallProtectionConcern < ActiveRecord::Base +class CallProtectionConcern < ApplicationRecord belongs_to :call belongs_to :protection_concern end diff --git a/app/models/carer.rb b/app/models/carer.rb index 1bfb1c186a..e355fb6352 100644 --- a/app/models/carer.rb +++ b/app/models/carer.rb @@ -1,4 +1,4 @@ -class Carer < ActiveRecord::Base +class Carer < ApplicationRecord belongs_to :province belongs_to :district belongs_to :commune diff --git a/app/models/case.rb b/app/models/case.rb index a0a9c0448c..7f93be90b1 100644 --- a/app/models/case.rb +++ b/app/models/case.rb @@ -1,4 +1,4 @@ -class Case < ActiveRecord::Base +class Case < ApplicationRecord belongs_to :family, counter_cache: true belongs_to :client belongs_to :partner, counter_cache: true diff --git a/app/models/case_closure.rb b/app/models/case_closure.rb index c921bbe528..70718cf2a2 100644 --- a/app/models/case_closure.rb +++ b/app/models/case_closure.rb @@ -1,4 +1,4 @@ -class CaseClosure < ActiveRecord::Base +class CaseClosure < ApplicationRecord has_paper_trail has_many :government_forms diff --git a/app/models/case_contract.rb b/app/models/case_contract.rb index e1869ebc1f..938313471c 100644 --- a/app/models/case_contract.rb +++ b/app/models/case_contract.rb @@ -1,3 +1,3 @@ -class CaseContract < ActiveRecord::Base +class CaseContract < ApplicationRecord belongs_to :case end diff --git a/app/models/case_note.rb b/app/models/case_note.rb index c52e370147..7cc86d2388 100644 --- a/app/models/case_note.rb +++ b/app/models/case_note.rb @@ -1,4 +1,4 @@ -class CaseNote < ActiveRecord::Base +class CaseNote < ApplicationRecord INTERACTION_TYPE = ['Visit', 'Non face to face', '3rd Party','Supervision','Other'].freeze paginates_per 1 diff --git a/app/models/case_note_domain_group.rb b/app/models/case_note_domain_group.rb index d07a785791..2850ca5069 100644 --- a/app/models/case_note_domain_group.rb +++ b/app/models/case_note_domain_group.rb @@ -1,4 +1,4 @@ -class CaseNoteDomainGroup < ActiveRecord::Base +class CaseNoteDomainGroup < ApplicationRecord mount_uploaders :attachments, FileUploader belongs_to :case_note belongs_to :domain_group diff --git a/app/models/case_worker_client.rb b/app/models/case_worker_client.rb index 92a273da09..7b11f85074 100644 --- a/app/models/case_worker_client.rb +++ b/app/models/case_worker_client.rb @@ -1,4 +1,4 @@ -class CaseWorkerClient < ActiveRecord::Base +class CaseWorkerClient < ApplicationRecord has_paper_trail belongs_to :user diff --git a/app/models/changelog.rb b/app/models/changelog.rb index 93d4026b5e..c08b96d50f 100644 --- a/app/models/changelog.rb +++ b/app/models/changelog.rb @@ -1,4 +1,4 @@ -class Changelog < ActiveRecord::Base +class Changelog < ApplicationRecord belongs_to :user, counter_cache: true has_many :changelog_types, dependent: :destroy diff --git a/app/models/changelog_type.rb b/app/models/changelog_type.rb index b954c512e9..e9f14952eb 100644 --- a/app/models/changelog_type.rb +++ b/app/models/changelog_type.rb @@ -1,4 +1,4 @@ -class ChangelogType < ActiveRecord::Base +class ChangelogType < ApplicationRecord belongs_to :changelog default_scope { order(:change_type) } diff --git a/app/models/children_plan.rb b/app/models/children_plan.rb index 3a940613f0..92b1fdaaec 100644 --- a/app/models/children_plan.rb +++ b/app/models/children_plan.rb @@ -1,4 +1,4 @@ -class ChildrenPlan < ActiveRecord::Base +class ChildrenPlan < ApplicationRecord has_paper_trail has_many :government_form_children_plans, dependent: :restrict_with_error diff --git a/app/models/client.rb b/app/models/client.rb index 85ee6d7a2c..9ae6234bd3 100644 --- a/app/models/client.rb +++ b/app/models/client.rb @@ -1,4 +1,4 @@ -class Client < ActiveRecord::Base +class Client < ApplicationRecord include ActionView::Helpers::DateHelper include EntityTypeCustomField include NextClientEnrollmentTracking @@ -37,24 +37,24 @@ class Client < ActiveRecord::Base delegate :name_en, to: :village, prefix: true, allow_nil: true belongs_to :referral_source, counter_cache: true - belongs_to :province, counter_cache: true - belongs_to :district - belongs_to :subdistrict - belongs_to :township - belongs_to :state - belongs_to :received_by, class_name: 'User', foreign_key: 'received_by_id', counter_cache: true - belongs_to :followed_up_by, class_name: 'User', foreign_key: 'followed_up_by_id', counter_cache: true - belongs_to :birth_province, class_name: 'Province', foreign_key: 'birth_province_id', counter_cache: true - belongs_to :commune - belongs_to :village - belongs_to :referee - belongs_to :carer - belongs_to :call - - belongs_to :concern_province, class_name: 'Province', foreign_key: 'concern_province_id' - belongs_to :concern_district, class_name: 'District', foreign_key: 'concern_district_id' - belongs_to :concern_commune, class_name: 'Commune', foreign_key: 'concern_commune_id' - belongs_to :concern_village, class_name: 'Village', foreign_key: 'concern_village_id' + belongs_to :province, counter_cache: true, optional: true + belongs_to :district, optional: true + belongs_to :subdistrict, optional: true + belongs_to :township, optional: true + belongs_to :state, optional: true + belongs_to :received_by, class_name: 'User', foreign_key: 'received_by_id', counter_cache: true, optional: true + belongs_to :followed_up_by, class_name: 'User', foreign_key: 'followed_up_by_id', counter_cache: true, optional: true + belongs_to :birth_province, class_name: 'Province', foreign_key: 'birth_province_id', counter_cache: true, optional: true + belongs_to :commune, optional: true + belongs_to :village, optional: true + belongs_to :referee, optional: true + belongs_to :carer, optional: true + belongs_to :call, optional: true + + belongs_to :concern_province, class_name: 'Province', foreign_key: 'concern_province_id', optional: true + belongs_to :concern_district, class_name: 'District', foreign_key: 'concern_district_id', optional: true + belongs_to :concern_commune, class_name: 'Commune', foreign_key: 'concern_commune_id', optional: true + belongs_to :concern_village, class_name: 'Village', foreign_key: 'concern_village_id', optional: true belongs_to :global_identity, class_name: 'GlobalIdentity', foreign_key: 'global_id', primary_key: :ulid has_many :hotlines, dependent: :destroy @@ -82,14 +82,14 @@ class Client < ActiveRecord::Base accepts_nested_attributes_for :tasks - has_many :families, through: :cases has_many :cases, dependent: :destroy + has_many :families, through: :cases has_many :case_notes, dependent: :destroy has_many :assessments, dependent: :destroy has_paper_trail - validates :kid_id, uniqueness: { case_sensitive: false }, if: 'kid_id.present?' + validates :kid_id, uniqueness: { case_sensitive: false }, if: -> { kid_id.present? } validates :user_ids, presence: true, on: :create validates :user_ids, presence: true, on: :update, unless: :exit_ngo? validates :initial_referral_date, :received_by_id, :gender, :referral_source_category_id, presence: true diff --git a/app/models/client_enrollment.rb b/app/models/client_enrollment.rb index 6e0029c7d1..46a2aae842 100644 --- a/app/models/client_enrollment.rb +++ b/app/models/client_enrollment.rb @@ -1,4 +1,4 @@ -class ClientEnrollment < ActiveRecord::Base +class ClientEnrollment < ApplicationRecord include ClientRetouch include NestedAttributesConcern include ClientEnrollmentTrackingConcern @@ -15,7 +15,7 @@ class ClientEnrollment < ActiveRecord::Base alias_attribute :new_date, :enrollment_date validates :enrollment_date, presence: true - validate :enrollment_date_value, if: 'enrollment_date.present?' + validate :enrollment_date_value, if: -> { enrollment_date.present? } has_paper_trail diff --git a/app/models/client_enrollment_tracking.rb b/app/models/client_enrollment_tracking.rb index e40d358eab..ef7fe18bb6 100644 --- a/app/models/client_enrollment_tracking.rb +++ b/app/models/client_enrollment_tracking.rb @@ -1,4 +1,4 @@ -class ClientEnrollmentTracking < ActiveRecord::Base +class ClientEnrollmentTracking < ApplicationRecord include NestedAttributesConcern include ClientEnrollmentTrackingConcern diff --git a/app/models/client_history.rb b/app/models/client_history.rb index 735debadd3..bdab334eba 100644 --- a/app/models/client_history.rb +++ b/app/models/client_history.rb @@ -2,11 +2,11 @@ class ClientHistory include Mongoid::Document include Mongoid::Timestamps - store_in database: ->{ Organization.current.mho? ? ENV['MHO_HISTORY_DATABASE_NAME'] : ENV['HISTORY_DATABASE_NAME'] } + store_in database: -> { Organization.current.mho? ? ENV['MHO_HISTORY_DATABASE_NAME'] : ENV['HISTORY_DATABASE_NAME'] } default_scope { where(tenant: Organization.current.try(:short_name)) } field :object, type: Hash - field :tenant, type: String, default: ->{ Organization.current.short_name } + field :tenant, type: String, default: -> { Organization.current.short_name } embeds_many :agency_client_histories embeds_many :sponsor_histories @@ -16,13 +16,13 @@ class ClientHistory embeds_many :client_family_histories embeds_many :client_quantitative_case_histories - after_save :create_sponsor_history, if: 'object.key?("donor_ids")' - after_save :create_agency_client_history, if: 'object.key?("agency_ids")' - after_save :create_case_worker_client_history, if: 'object.key?("user_ids")' - after_save :create_client_quantitative_case_history, if: 'object.key?("quantitative_case_ids")' - after_save :create_case_client_history, if: 'object.key?("case_ids")' - after_save :create_client_family_history, if: 'object.key?("family_ids")' - after_save :create_client_custom_field_property_history, if: 'object.key?("custom_field_property_ids")' + after_save :create_sponsor_history, if: -> { object.key?('donor_ids') } + after_save :create_agency_client_history, if: -> { object.key?('agency_ids') } + after_save :create_case_worker_client_history, if: -> { object.key?('user_ids') } + after_save :create_client_quantitative_case_history, if: -> { object.key?('quantitative_case_ids') } + after_save :create_case_client_history, if: -> { object.key?('case_ids') } + after_save :create_client_family_history, if: -> { object.key?('family_ids') } + after_save :create_client_custom_field_property_history, if: -> { object.key?('custom_field_property_ids') } def self.initial(client) attributes = client.attributes diff --git a/app/models/client_quantitative_case.rb b/app/models/client_quantitative_case.rb index 6289981316..3ee605783f 100644 --- a/app/models/client_quantitative_case.rb +++ b/app/models/client_quantitative_case.rb @@ -1,4 +1,4 @@ -class ClientQuantitativeCase < ActiveRecord::Base +class ClientQuantitativeCase < ApplicationRecord belongs_to :client belongs_to :quantitative_case diff --git a/app/models/client_right.rb b/app/models/client_right.rb index 4a0a7781fb..3967ac0e4c 100644 --- a/app/models/client_right.rb +++ b/app/models/client_right.rb @@ -1,4 +1,4 @@ -class ClientRight < ActiveRecord::Base +class ClientRight < ApplicationRecord has_paper_trail has_many :client_right_government_forms, dependent: :restrict_with_error diff --git a/app/models/client_right_government_form.rb b/app/models/client_right_government_form.rb index 58c73e0694..8b083bfdaf 100644 --- a/app/models/client_right_government_form.rb +++ b/app/models/client_right_government_form.rb @@ -1,4 +1,4 @@ -class ClientRightGovernmentForm < ActiveRecord::Base +class ClientRightGovernmentForm < ApplicationRecord has_paper_trail delegate :name, to: :client_right, prefix: true, allow_nil: true diff --git a/app/models/client_type.rb b/app/models/client_type.rb index f8c713b423..dcf02edea2 100644 --- a/app/models/client_type.rb +++ b/app/models/client_type.rb @@ -1,4 +1,4 @@ -class ClientType < ActiveRecord::Base +class ClientType < ApplicationRecord has_paper_trail has_many :client_type_government_forms, dependent: :restrict_with_error diff --git a/app/models/client_type_government_form.rb b/app/models/client_type_government_form.rb index ea0d787864..e7112bc313 100644 --- a/app/models/client_type_government_form.rb +++ b/app/models/client_type_government_form.rb @@ -1,4 +1,4 @@ -class ClientTypeGovernmentForm < ActiveRecord::Base +class ClientTypeGovernmentForm < ApplicationRecord has_paper_trail belongs_to :government_form diff --git a/app/models/commune.rb b/app/models/commune.rb index 6a011c7710..e29028c57d 100644 --- a/app/models/commune.rb +++ b/app/models/commune.rb @@ -1,4 +1,4 @@ -class Commune < ActiveRecord::Base +class Commune < ApplicationRecord attr_accessor :name has_paper_trail diff --git a/app/models/custom_assessment_setting.rb b/app/models/custom_assessment_setting.rb index aeeb36d80c..b253cc96c2 100644 --- a/app/models/custom_assessment_setting.rb +++ b/app/models/custom_assessment_setting.rb @@ -1,4 +1,4 @@ -class CustomAssessmentSetting < ActiveRecord::Base +class CustomAssessmentSetting < ApplicationRecord belongs_to :setting has_many :domains, dependent: :destroy has_many :case_notes, dependent: :restrict_with_error diff --git a/app/models/custom_field.rb b/app/models/custom_field.rb index 7fa288ac29..65d73ddd91 100644 --- a/app/models/custom_field.rb +++ b/app/models/custom_field.rb @@ -1,4 +1,4 @@ -class CustomField < ActiveRecord::Base +class CustomField < ApplicationRecord include UpdateFieldLabelsFormBuilder FREQUENCIES = ['Daily', 'Weekly', 'Monthly', 'Yearly'].freeze diff --git a/app/models/custom_field_permission.rb b/app/models/custom_field_permission.rb index eaee1c9bd1..bbc669bbb6 100644 --- a/app/models/custom_field_permission.rb +++ b/app/models/custom_field_permission.rb @@ -1,4 +1,4 @@ -class CustomFieldPermission < ActiveRecord::Base +class CustomFieldPermission < ApplicationRecord belongs_to :user_permission, class_name: 'User', foreign_key: :user_id belongs_to :user_custom_field_permission, class_name: 'CustomField', foreign_key: :custom_field_id diff --git a/app/models/custom_field_property.rb b/app/models/custom_field_property.rb index 19deaf67e2..d12c8bec96 100644 --- a/app/models/custom_field_property.rb +++ b/app/models/custom_field_property.rb @@ -1,4 +1,4 @@ -class CustomFieldProperty < ActiveRecord::Base +class CustomFieldProperty < ApplicationRecord include NestedAttributesConcern include ClientEnrollmentTrackingConcern diff --git a/app/models/data_tracker.rb b/app/models/data_tracker.rb index 2ec8464ad3..0081d97763 100644 --- a/app/models/data_tracker.rb +++ b/app/models/data_tracker.rb @@ -1,3 +1,3 @@ -class DataTracker < ActiveRecord::Base +class DataTracker < ApplicationRecord # intentionally left blank end diff --git a/app/models/department.rb b/app/models/department.rb index d56513a1e3..5c270531e1 100644 --- a/app/models/department.rb +++ b/app/models/department.rb @@ -1,4 +1,4 @@ -class Department < ActiveRecord::Base +class Department < ApplicationRecord has_many :users has_paper_trail diff --git a/app/models/district.rb b/app/models/district.rb index e993d52f48..c9c5020eaf 100644 --- a/app/models/district.rb +++ b/app/models/district.rb @@ -1,4 +1,4 @@ -class District < ActiveRecord::Base +class District < ApplicationRecord include AddressConcern has_paper_trail diff --git a/app/models/domain.rb b/app/models/domain.rb index 089b1d282e..f0ceb57c5d 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -1,4 +1,4 @@ -class Domain < ActiveRecord::Base +class Domain < ApplicationRecord belongs_to :domain_group, counter_cache: true has_many :assessment_domains, dependent: :restrict_with_error @@ -26,7 +26,7 @@ class Domain < ActiveRecord::Base enum domain_score_colors: { danger: 'Red', warning: 'Yellow', success: 'Blue', primary: 'Green' } def convert_identity - identity.downcase.parameterize('_') + identity.downcase.parameterize(separator: '_') end def translate_description diff --git a/app/models/domain_group.rb b/app/models/domain_group.rb index 7f8f79391a..c24a74f56f 100644 --- a/app/models/domain_group.rb +++ b/app/models/domain_group.rb @@ -1,4 +1,4 @@ -class DomainGroup < ActiveRecord::Base +class DomainGroup < ApplicationRecord include ActionView::Helpers has_many :domains diff --git a/app/models/domain_program_stream.rb b/app/models/domain_program_stream.rb index 56596c3d71..0f5e821ef7 100644 --- a/app/models/domain_program_stream.rb +++ b/app/models/domain_program_stream.rb @@ -1,4 +1,4 @@ -class DomainProgramStream < ActiveRecord::Base +class DomainProgramStream < ApplicationRecord acts_as_paranoid belongs_to :program_stream diff --git a/app/models/donor.rb b/app/models/donor.rb index a97e30de50..2bfa10c62b 100644 --- a/app/models/donor.rb +++ b/app/models/donor.rb @@ -1,4 +1,4 @@ -class Donor < ActiveRecord::Base +class Donor < ApplicationRecord has_many :sponsors, dependent: :restrict_with_error has_many :clients, through: :sponsors has_many :donor_organizations, dependent: :destroy @@ -9,7 +9,7 @@ class Donor < ActiveRecord::Base scope :has_clients, -> { joins(:clients).uniq } - validates :name, presence: true, uniqueness: { case_sensitive: false }, if: 'code.blank?' - validates :name, presence: true, uniqueness: { case_sensitive: false, scope: :code }, if: 'code.present?' - validates :code, uniqueness: { case_sensitive: false }, if: 'code.present?' + validates :name, presence: true, uniqueness: { case_sensitive: false }, if: -> { code.blank? } + validates :name, presence: true, uniqueness: { case_sensitive: false, scope: :code }, if: -> { code.present? } + validates :code, uniqueness: { case_sensitive: false }, if: -> { code.present? } end diff --git a/app/models/donor_organization.rb b/app/models/donor_organization.rb index a660a33156..08d4d00602 100644 --- a/app/models/donor_organization.rb +++ b/app/models/donor_organization.rb @@ -1,4 +1,4 @@ -class DonorOrganization < ActiveRecord::Base +class DonorOrganization < ApplicationRecord belongs_to :donor belongs_to :organization end diff --git a/app/models/enter_ngo.rb b/app/models/enter_ngo.rb index 252a60af4b..4fbe25bcef 100644 --- a/app/models/enter_ngo.rb +++ b/app/models/enter_ngo.rb @@ -1,4 +1,4 @@ -class EnterNgo < ActiveRecord::Base +class EnterNgo < ApplicationRecord has_paper_trail acts_as_paranoid double_tap_destroys_fully: true diff --git a/app/models/enter_ngo_history.rb b/app/models/enter_ngo_history.rb index 86557518ae..6aa004dea4 100644 --- a/app/models/enter_ngo_history.rb +++ b/app/models/enter_ngo_history.rb @@ -10,7 +10,7 @@ class EnterNgoHistory embeds_many :enter_ngo_user_histories - after_save :create_enter_ngo_user_history, if: 'object.key?("user_ids")' + after_save :create_enter_ngo_user_history, if: -> { object.key?('user_ids') } def self.initial(enter_ngo) attributes = enter_ngo.attributes diff --git a/app/models/enter_ngo_user.rb b/app/models/enter_ngo_user.rb index 5bce0bf933..faaf99bfcc 100644 --- a/app/models/enter_ngo_user.rb +++ b/app/models/enter_ngo_user.rb @@ -1,4 +1,4 @@ -class EnterNgoUser < ActiveRecord::Base +class EnterNgoUser < ApplicationRecord belongs_to :enter_ngo belongs_to :user diff --git a/app/models/exit_ngo.rb b/app/models/exit_ngo.rb index 13204208a4..b8af57afca 100644 --- a/app/models/exit_ngo.rb +++ b/app/models/exit_ngo.rb @@ -1,4 +1,4 @@ -class ExitNgo < ActiveRecord::Base +class ExitNgo < ApplicationRecord has_paper_trail acts_as_paranoid double_tap_destroys_fully: true diff --git a/app/models/external_system.rb b/app/models/external_system.rb index 71f429dd4b..0062fa5044 100644 --- a/app/models/external_system.rb +++ b/app/models/external_system.rb @@ -1,4 +1,4 @@ -class ExternalSystem < ActiveRecord::Base +class ExternalSystem < ApplicationRecord has_many :external_system_global_identities, class_name: 'ExternalSystemGlobalIdentity', foreign_key: 'global_id', dependent: :destroy validates :name, :token, presence: true diff --git a/app/models/external_system_global_identity.rb b/app/models/external_system_global_identity.rb index a0848e4323..10df131af4 100644 --- a/app/models/external_system_global_identity.rb +++ b/app/models/external_system_global_identity.rb @@ -1,4 +1,4 @@ -class ExternalSystemGlobalIdentity < ActiveRecord::Base +class ExternalSystemGlobalIdentity < ApplicationRecord belongs_to :external_system belongs_to :global_identity, class_name: 'GlobalIdentity', foreign_key: 'global_id', primary_key: :ulid diff --git a/app/models/family.rb b/app/models/family.rb index 2998e4ac0c..4d8de1a037 100644 --- a/app/models/family.rb +++ b/app/models/family.rb @@ -1,4 +1,4 @@ -class Family < ActiveRecord::Base +class Family < ApplicationRecord include EntityTypeCustomField include Brc::Family @@ -32,7 +32,7 @@ class Family < ActiveRecord::Base before_validation :assign_family_type, if: [:new_record?, :brc?] validates :family_type, presence: true, inclusion: { in: TYPES } - validates :code, uniqueness: { case_sensitive: false }, if: 'code.present?' + validates :code, uniqueness: { case_sensitive: false }, if: -> { code.present? } validates :status, presence: true, inclusion: { in: STATUSES } validate :client_must_only_belong_to_a_family diff --git a/app/models/family_member.rb b/app/models/family_member.rb index f60e44047d..415ce2ef73 100644 --- a/app/models/family_member.rb +++ b/app/models/family_member.rb @@ -1,4 +1,4 @@ -class FamilyMember < ActiveRecord::Base +class FamilyMember < ApplicationRecord extend Enumerize belongs_to :family diff --git a/app/models/family_plan.rb b/app/models/family_plan.rb index acd26e639e..9605b724ab 100644 --- a/app/models/family_plan.rb +++ b/app/models/family_plan.rb @@ -1,4 +1,4 @@ -class FamilyPlan < ActiveRecord::Base +class FamilyPlan < ApplicationRecord has_paper_trail has_many :government_form_family_plans, dependent: :restrict_with_error diff --git a/app/models/field_setting.rb b/app/models/field_setting.rb index e2a63b5ff0..5e7a4e21c5 100644 --- a/app/models/field_setting.rb +++ b/app/models/field_setting.rb @@ -1,4 +1,4 @@ -class FieldSetting < ActiveRecord::Base +class FieldSetting < ApplicationRecord self.inheritance_column = :_type_disabled translates :label diff --git a/app/models/form_builder_attachment.rb b/app/models/form_builder_attachment.rb index 0a6d7154c6..14f57674a3 100644 --- a/app/models/form_builder_attachment.rb +++ b/app/models/form_builder_attachment.rb @@ -1,4 +1,4 @@ -class FormBuilderAttachment < ActiveRecord::Base +class FormBuilderAttachment < ApplicationRecord mount_uploaders :file, FormBuilderAttachmentUploader belongs_to :form_buildable, polymorphic: true diff --git a/app/models/global_identity.rb b/app/models/global_identity.rb index 3fccc9716f..681c253ec8 100644 --- a/app/models/global_identity.rb +++ b/app/models/global_identity.rb @@ -1,4 +1,4 @@ -class GlobalIdentity < ActiveRecord::Base +class GlobalIdentity < ApplicationRecord self.primary_key = "ulid" has_many :clients, class_name: 'Client', foreign_key: 'global_id', dependent: :restrict_with_error has_many :organizations, through: :global_identity_organizations diff --git a/app/models/global_identity_organization.rb b/app/models/global_identity_organization.rb index 9e31554cc1..824d998866 100644 --- a/app/models/global_identity_organization.rb +++ b/app/models/global_identity_organization.rb @@ -1,4 +1,4 @@ -class GlobalIdentityOrganization < ActiveRecord::Base +class GlobalIdentityOrganization < ApplicationRecord belongs_to :organization belongs_to :global_identity, class_name: 'GlobalIdentity', foreign_key: 'global_id', primary_key: :ulid belongs_to :client diff --git a/app/models/global_service.rb b/app/models/global_service.rb index 7cade8a09f..d99ba27c14 100644 --- a/app/models/global_service.rb +++ b/app/models/global_service.rb @@ -1,4 +1,4 @@ -class GlobalService < ActiveRecord::Base +class GlobalService < ApplicationRecord self.primary_key = "uuid" has_many :services, class_name: 'Service', foreign_key: 'uuid', dependent: :restrict_with_error diff --git a/app/models/government_form.rb b/app/models/government_form.rb index b22cdb853f..761922032e 100644 --- a/app/models/government_form.rb +++ b/app/models/government_form.rb @@ -1,4 +1,4 @@ -class GovernmentForm < ActiveRecord::Base +class GovernmentForm < ApplicationRecord has_paper_trail CASEWORKER_ASSUMPTIONS = ['អាចធ្វើសមាហរណកម្មបាន', 'មិនអាចធ្វើសមាហរណកម្មបានទេ', 'បន្តករណី', 'បិទករណី'] diff --git a/app/models/government_form_children_plan.rb b/app/models/government_form_children_plan.rb index 090ffbd257..8321b3acb0 100644 --- a/app/models/government_form_children_plan.rb +++ b/app/models/government_form_children_plan.rb @@ -1,4 +1,4 @@ -class GovernmentFormChildrenPlan < ActiveRecord::Base +class GovernmentFormChildrenPlan < ApplicationRecord has_paper_trail delegate :name, to: :children_plan, prefix: true, allow_nil: true diff --git a/app/models/government_form_family_plan.rb b/app/models/government_form_family_plan.rb index b5c5f3dc16..71eb889142 100644 --- a/app/models/government_form_family_plan.rb +++ b/app/models/government_form_family_plan.rb @@ -1,4 +1,4 @@ -class GovernmentFormFamilyPlan < ActiveRecord::Base +class GovernmentFormFamilyPlan < ApplicationRecord has_paper_trail delegate :name, to: :family_plan, prefix: true, allow_nil: true diff --git a/app/models/government_form_interviewee.rb b/app/models/government_form_interviewee.rb index 5a5eab91a0..1d23e99345 100644 --- a/app/models/government_form_interviewee.rb +++ b/app/models/government_form_interviewee.rb @@ -1,4 +1,4 @@ -class GovernmentFormInterviewee < ActiveRecord::Base +class GovernmentFormInterviewee < ApplicationRecord has_paper_trail belongs_to :government_form diff --git a/app/models/government_form_need.rb b/app/models/government_form_need.rb index e8e584ebab..01131eb216 100644 --- a/app/models/government_form_need.rb +++ b/app/models/government_form_need.rb @@ -1,4 +1,4 @@ -class GovernmentFormNeed < ActiveRecord::Base +class GovernmentFormNeed < ApplicationRecord has_paper_trail RANKS = [1, 2, 3, 4, 5, 6, 7, 8] diff --git a/app/models/government_form_problem.rb b/app/models/government_form_problem.rb index 69a202b1e2..588f354867 100644 --- a/app/models/government_form_problem.rb +++ b/app/models/government_form_problem.rb @@ -1,4 +1,4 @@ -class GovernmentFormProblem < ActiveRecord::Base +class GovernmentFormProblem < ApplicationRecord has_paper_trail RANKS = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16] diff --git a/app/models/government_form_service_type.rb b/app/models/government_form_service_type.rb index c67bf4f019..8f5ae75425 100644 --- a/app/models/government_form_service_type.rb +++ b/app/models/government_form_service_type.rb @@ -1,4 +1,4 @@ -class GovernmentFormServiceType < ActiveRecord::Base +class GovernmentFormServiceType < ApplicationRecord has_paper_trail delegate :name, to: :service_type, prefix: true, allow_nil: true diff --git a/app/models/hotline.rb b/app/models/hotline.rb index af0ec1c15d..0c74bfb049 100644 --- a/app/models/hotline.rb +++ b/app/models/hotline.rb @@ -1,4 +1,4 @@ -class Hotline < ActiveRecord::Base +class Hotline < ApplicationRecord belongs_to :call belongs_to :client -end \ No newline at end of file +end diff --git a/app/models/intervention.rb b/app/models/intervention.rb index db7c70055a..1d3edb55fc 100644 --- a/app/models/intervention.rb +++ b/app/models/intervention.rb @@ -1,2 +1,2 @@ -class Intervention < ActiveRecord::Base +class Intervention < ApplicationRecord end diff --git a/app/models/interviewee.rb b/app/models/interviewee.rb index 09f6adf620..08c660a66d 100644 --- a/app/models/interviewee.rb +++ b/app/models/interviewee.rb @@ -1,4 +1,4 @@ -class Interviewee < ActiveRecord::Base +class Interviewee < ApplicationRecord has_paper_trail has_many :government_form_interviewees, dependent: :restrict_with_error diff --git a/app/models/leave_program.rb b/app/models/leave_program.rb index 7b20f645a4..f741b151ad 100644 --- a/app/models/leave_program.rb +++ b/app/models/leave_program.rb @@ -1,4 +1,4 @@ -class LeaveProgram < ActiveRecord::Base +class LeaveProgram < ApplicationRecord include NestedAttributesConcern include ClientEnrollmentTrackingConcern @@ -10,7 +10,7 @@ class LeaveProgram < ActiveRecord::Base alias_attribute :new_date, :exit_date validates :exit_date, presence: true - validate :exit_date_value, if: 'exit_date.present?' + validate :exit_date_value, if: -> { exit_date.present? } after_save :create_leave_program_history after_create :update_enrollment_status, :set_client_status diff --git a/app/models/location.rb b/app/models/location.rb index e3acd9004d..ff1668ee2a 100644 --- a/app/models/location.rb +++ b/app/models/location.rb @@ -1,2 +1,2 @@ -class Location < ActiveRecord::Base +class Location < ApplicationRecord end diff --git a/app/models/material.rb b/app/models/material.rb index 56f8e90c58..1f2074f081 100644 --- a/app/models/material.rb +++ b/app/models/material.rb @@ -1,2 +1,2 @@ -class Material < ActiveRecord::Base +class Material < ApplicationRecord end diff --git a/app/models/necessity.rb b/app/models/necessity.rb index 71d43bdaab..2b31383a68 100644 --- a/app/models/necessity.rb +++ b/app/models/necessity.rb @@ -1,4 +1,4 @@ -class Necessity < ActiveRecord::Base +class Necessity < ApplicationRecord has_many :call_necessities, dependent: :restrict_with_error has_many :calls, through: :call_necessities diff --git a/app/models/need.rb b/app/models/need.rb index b3c6dd67de..a6a18f314e 100644 --- a/app/models/need.rb +++ b/app/models/need.rb @@ -1,4 +1,4 @@ -class Need < ActiveRecord::Base +class Need < ApplicationRecord has_paper_trail has_many :government_form_needs, dependent: :restrict_with_error diff --git a/app/models/organization.rb b/app/models/organization.rb index 810c04a4b6..28a2e5e3d3 100644 --- a/app/models/organization.rb +++ b/app/models/organization.rb @@ -1,5 +1,5 @@ require 'rake' -class Organization < ActiveRecord::Base +class Organization < ApplicationRecord SUPPORTED_LANGUAGES = %w(en km my).freeze mount_uploader :logo, ImageUploader diff --git a/app/models/organization_type.rb b/app/models/organization_type.rb index 0ed273a27e..c4319cac2d 100644 --- a/app/models/organization_type.rb +++ b/app/models/organization_type.rb @@ -1,4 +1,4 @@ -class OrganizationType < ActiveRecord::Base +class OrganizationType < ApplicationRecord has_many :partners, dependent: :restrict_with_error has_paper_trail diff --git a/app/models/partner.rb b/app/models/partner.rb index 4c24e40f0f..4c2e0d0ed5 100644 --- a/app/models/partner.rb +++ b/app/models/partner.rb @@ -1,4 +1,4 @@ -class Partner < ActiveRecord::Base +class Partner < ApplicationRecord include EntityTypeCustomField belongs_to :province, counter_cache: true belongs_to :organization_type diff --git a/app/models/permission.rb b/app/models/permission.rb index 8a5da79348..f1c95d37ff 100644 --- a/app/models/permission.rb +++ b/app/models/permission.rb @@ -1,3 +1,3 @@ -class Permission < ActiveRecord::Base +class Permission < ApplicationRecord belongs_to :user end diff --git a/app/models/problem.rb b/app/models/problem.rb index 377ad0c26b..52fce71682 100644 --- a/app/models/problem.rb +++ b/app/models/problem.rb @@ -1,4 +1,4 @@ -class Problem < ActiveRecord::Base +class Problem < ApplicationRecord has_paper_trail has_many :government_form_problems, dependent: :restrict_with_error diff --git a/app/models/program_stream.rb b/app/models/program_stream.rb index 4f163517c5..98b7cf8f4b 100644 --- a/app/models/program_stream.rb +++ b/app/models/program_stream.rb @@ -1,4 +1,4 @@ -class ProgramStream < ActiveRecord::Base +class ProgramStream < ApplicationRecord include UpdateFieldLabelsFormBuilder FORM_BUILDER_FIELDS = ['enrollment', 'exit_program'].freeze acts_as_paranoid without_default_scope: true, column: :archived_at diff --git a/app/models/program_stream_permission.rb b/app/models/program_stream_permission.rb index 6eeed037e7..522062d973 100644 --- a/app/models/program_stream_permission.rb +++ b/app/models/program_stream_permission.rb @@ -1,4 +1,4 @@ -class ProgramStreamPermission < ActiveRecord::Base +class ProgramStreamPermission < ApplicationRecord acts_as_paranoid belongs_to :user, with_deleted: true diff --git a/app/models/program_stream_service.rb b/app/models/program_stream_service.rb index 317243f60c..d595c5ccf4 100644 --- a/app/models/program_stream_service.rb +++ b/app/models/program_stream_service.rb @@ -1,4 +1,4 @@ -class ProgramStreamService < ActiveRecord::Base +class ProgramStreamService < ApplicationRecord acts_as_paranoid belongs_to :program_stream diff --git a/app/models/progress_note.rb b/app/models/progress_note.rb index efb3d3144b..e2c50fcf97 100644 --- a/app/models/progress_note.rb +++ b/app/models/progress_note.rb @@ -1,3 +1,3 @@ -class ProgressNote < ActiveRecord::Base +class ProgressNote < ApplicationRecord belongs_to :client end diff --git a/app/models/progress_note_type.rb b/app/models/progress_note_type.rb index abe5e23086..d07444d016 100644 --- a/app/models/progress_note_type.rb +++ b/app/models/progress_note_type.rb @@ -1,2 +1,2 @@ -class ProgressNoteType < ActiveRecord::Base +class ProgressNoteType < ApplicationRecord end diff --git a/app/models/protection_concern.rb b/app/models/protection_concern.rb index 5cfa9fc3ad..65064cd536 100644 --- a/app/models/protection_concern.rb +++ b/app/models/protection_concern.rb @@ -1,4 +1,4 @@ -class ProtectionConcern < ActiveRecord::Base +class ProtectionConcern < ApplicationRecord has_many :call_protection_concerns, dependent: :restrict_with_error has_many :calls, through: :call_protection_concerns diff --git a/app/models/province.rb b/app/models/province.rb index b45e4fc4ef..1a9cd32445 100644 --- a/app/models/province.rb +++ b/app/models/province.rb @@ -1,4 +1,4 @@ -class Province < ActiveRecord::Base +class Province < ApplicationRecord include AddressConcern has_paper_trail diff --git a/app/models/quantitative_case.rb b/app/models/quantitative_case.rb index f74eb40e5f..4ffb0679ca 100644 --- a/app/models/quantitative_case.rb +++ b/app/models/quantitative_case.rb @@ -1,4 +1,4 @@ -class QuantitativeCase < ActiveRecord::Base +class QuantitativeCase < ApplicationRecord validates :value, presence: true, uniqueness: { case_sensitive: false, scope: :quantitative_type_id } belongs_to :quantitative_type, counter_cache: true diff --git a/app/models/quantitative_type.rb b/app/models/quantitative_type.rb index 36cdc89ea5..dde59190fb 100644 --- a/app/models/quantitative_type.rb +++ b/app/models/quantitative_type.rb @@ -1,4 +1,4 @@ -class QuantitativeType < ActiveRecord::Base +class QuantitativeType < ApplicationRecord validates :name, presence: true, uniqueness: { case_sensitive: false } has_many :quantitative_cases diff --git a/app/models/quantitative_type_permission.rb b/app/models/quantitative_type_permission.rb index 62f1acfd2d..7a10eb1dc8 100644 --- a/app/models/quantitative_type_permission.rb +++ b/app/models/quantitative_type_permission.rb @@ -1,4 +1,4 @@ -class QuantitativeTypePermission < ActiveRecord::Base +class QuantitativeTypePermission < ApplicationRecord belongs_to :user belongs_to :quantitative_type diff --git a/app/models/quarterly_report.rb b/app/models/quarterly_report.rb index b7333318d2..7842ab6ea9 100644 --- a/app/models/quarterly_report.rb +++ b/app/models/quarterly_report.rb @@ -1,4 +1,4 @@ -class QuarterlyReport < ActiveRecord::Base +class QuarterlyReport < ApplicationRecord belongs_to :case belongs_to :staff_information, class_name: 'User', foreign_key: 'staff_id' diff --git a/app/models/referee.rb b/app/models/referee.rb index 69d1ad690a..c4e17a98e3 100644 --- a/app/models/referee.rb +++ b/app/models/referee.rb @@ -1,4 +1,4 @@ -class Referee < ActiveRecord::Base +class Referee < ApplicationRecord ADDRESS_TYPES = ['Home', 'Business', 'RCI', 'Dormitory', 'Other'].freeze FIELDS = %w(id name gender adult anonymous phone email address_type outside province_id district_id commune_id village_id current_address house_number locality outside_address street_number created_at updated_at) GENDER_OPTIONS = ['female', 'male', 'lgbt', 'unknown', 'prefer_not_to_say', 'other'] diff --git a/app/models/referral.rb b/app/models/referral.rb index c4db949a20..12389b3db1 100644 --- a/app/models/referral.rb +++ b/app/models/referral.rb @@ -1,4 +1,4 @@ -class Referral < ActiveRecord::Base +class Referral < ApplicationRecord include ClientRetouch has_paper_trail diff --git a/app/models/referral_source.rb b/app/models/referral_source.rb index 6a4f9df65e..e494d138ba 100644 --- a/app/models/referral_source.rb +++ b/app/models/referral_source.rb @@ -1,4 +1,4 @@ -class ReferralSource < ActiveRecord::Base +class ReferralSource < ApplicationRecord has_ancestry has_many :clients, dependent: :restrict_with_error has_paper_trail diff --git a/app/models/service.rb b/app/models/service.rb index f5b7109b29..7f8f2c3115 100644 --- a/app/models/service.rb +++ b/app/models/service.rb @@ -1,4 +1,4 @@ -class Service < ActiveRecord::Base +class Service < ApplicationRecord acts_as_paranoid belongs_to :global_service, class_name: 'GlobalService', foreign_key: 'uuid', primary_key: :uuid diff --git a/app/models/service_type.rb b/app/models/service_type.rb index 87943f3b29..c3b819777f 100644 --- a/app/models/service_type.rb +++ b/app/models/service_type.rb @@ -1,4 +1,4 @@ -class ServiceType < ActiveRecord::Base +class ServiceType < ApplicationRecord has_paper_trail has_many :government_form_service_types, dependent: :restrict_with_error diff --git a/app/models/setting.rb b/app/models/setting.rb index 6467236f84..e241e3783a 100644 --- a/app/models/setting.rb +++ b/app/models/setting.rb @@ -1,4 +1,4 @@ -class Setting < ActiveRecord::Base +class Setting < ApplicationRecord extend Enumerize has_paper_trail diff --git a/app/models/shared_client.rb b/app/models/shared_client.rb index fe1bd5a69b..8030aa9f40 100644 --- a/app/models/shared_client.rb +++ b/app/models/shared_client.rb @@ -1,4 +1,4 @@ -class SharedClient < ActiveRecord::Base +class SharedClient < ApplicationRecord has_paper_trail belongs_to :birth_province, class_name: 'Province', foreign_key: :birth_province_id diff --git a/app/models/sponsor.rb b/app/models/sponsor.rb index 7cb295c455..bb0e1ba4c7 100644 --- a/app/models/sponsor.rb +++ b/app/models/sponsor.rb @@ -1,4 +1,4 @@ -class Sponsor < ActiveRecord::Base +class Sponsor < ApplicationRecord has_paper_trail belongs_to :donor diff --git a/app/models/state.rb b/app/models/state.rb index 4dd8c12cdb..b5a50eb28e 100644 --- a/app/models/state.rb +++ b/app/models/state.rb @@ -1,4 +1,4 @@ -class State < ActiveRecord::Base +class State < ApplicationRecord has_many :townships has_many :clients, dependent: :restrict_with_error diff --git a/app/models/subdistrict.rb b/app/models/subdistrict.rb index dc64d0b943..7fc4ebeea7 100644 --- a/app/models/subdistrict.rb +++ b/app/models/subdistrict.rb @@ -1,4 +1,4 @@ -class Subdistrict < ActiveRecord::Base +class Subdistrict < ApplicationRecord belongs_to :district has_many :clients, dependent: :restrict_with_error diff --git a/app/models/survey.rb b/app/models/survey.rb index 0251a1dcfe..83716c6315 100644 --- a/app/models/survey.rb +++ b/app/models/survey.rb @@ -1,4 +1,4 @@ -class Survey < ActiveRecord::Base +class Survey < ApplicationRecord belongs_to :client end diff --git a/app/models/task.rb b/app/models/task.rb index 1a649e4a80..07de86e866 100644 --- a/app/models/task.rb +++ b/app/models/task.rb @@ -1,4 +1,4 @@ -class Task < ActiveRecord::Base +class Task < ApplicationRecord belongs_to :domain, counter_cache: true belongs_to :case_note_domain_group belongs_to :client diff --git a/app/models/township.rb b/app/models/township.rb index f0535f5046..ccf8ac394b 100644 --- a/app/models/township.rb +++ b/app/models/township.rb @@ -1,4 +1,4 @@ -class Township < ActiveRecord::Base +class Township < ApplicationRecord belongs_to :state has_many :clients, dependent: :restrict_with_error diff --git a/app/models/tracking.rb b/app/models/tracking.rb index 8d4a68f2cc..7c58e1fdbb 100644 --- a/app/models/tracking.rb +++ b/app/models/tracking.rb @@ -1,4 +1,4 @@ -class Tracking < ActiveRecord::Base +class Tracking < ApplicationRecord include UpdateFieldLabelsFormBuilder FREQUENCIES = ['Daily', 'Weekly', 'Monthly', 'Yearly'].freeze acts_as_paranoid diff --git a/app/models/user.rb b/app/models/user.rb index 40a7923346..e86eaa433e 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,4 +1,4 @@ -class User < ActiveRecord::Base +class User < ApplicationRecord include EntityTypeCustomField include EntityTypeCustomFieldNotification include NextClientEnrollmentTracking @@ -78,7 +78,7 @@ class User < ActiveRecord::Base before_save :assign_as_admin after_commit :set_manager_ids - after_save :detach_manager, if: 'roles_changed?' + after_save :detach_manager, if: :roles_changed? after_save :toggle_referral_notification after_create :build_permission diff --git a/app/models/village.rb b/app/models/village.rb index 0191c07abb..35a0be3d1a 100644 --- a/app/models/village.rb +++ b/app/models/village.rb @@ -1,4 +1,4 @@ -class Village < ActiveRecord::Base +class Village < ApplicationRecord has_paper_trail belongs_to :commune diff --git a/app/models/visit.rb b/app/models/visit.rb index bda5d0d50e..ef4934e479 100644 --- a/app/models/visit.rb +++ b/app/models/visit.rb @@ -1,4 +1,4 @@ -class Visit < ActiveRecord::Base +class Visit < ApplicationRecord has_paper_trail belongs_to :user diff --git a/app/models/visit_client.rb b/app/models/visit_client.rb index ebcc9803be..963fb136ca 100644 --- a/app/models/visit_client.rb +++ b/app/models/visit_client.rb @@ -1,4 +1,4 @@ -class VisitClient < ActiveRecord::Base +class VisitClient < ApplicationRecord acts_as_paranoid belongs_to :user, with_deleted: true diff --git a/app/serializers/program_stream_serializer.rb b/app/serializers/program_stream_serializer.rb index a80719fd0c..0d832e4e96 100644 --- a/app/serializers/program_stream_serializer.rb +++ b/app/serializers/program_stream_serializer.rb @@ -3,6 +3,6 @@ class ProgramStreamSerializer < ActiveModel::Serializer has_many :trackings def enrollable_client_ids - AdvancedSearches::ClientAdvancedSearch.new(object.rules, Client.all).filter.ids if object.rules.present? + (AdvancedSearches::ClientAdvancedSearch.new(object.rules, Client.all).filter&.ids || []) if object.rules && object.rules['rules'].present? end end diff --git a/app/uploaders/image_uploader.rb b/app/uploaders/image_uploader.rb index c5a0e194d8..ebc6808926 100644 --- a/app/uploaders/image_uploader.rb +++ b/app/uploaders/image_uploader.rb @@ -2,6 +2,8 @@ class ImageUploader < CarrierWave::Uploader::Base # include CarrierWave::RMagick # include CarrierWave::MimeTypes include CarrierWave::MiniMagick + storage Rails.env.development? ? :file : :fog + process :auto_orient version :thumb do process resize_to_limit: [nil, 200] diff --git a/app/views/clients/_client_rows.html.haml b/app/views/clients/_client_rows.html.haml index b64b70deee..5eb3bcd46d 100644 --- a/app/views/clients/_client_rows.html.haml +++ b/app/views/clients/_client_rows.html.haml @@ -1 +1 @@ -= datagrid_rows(@client_grid, @client_grid.assets) \ No newline at end of file += datagrid_rows(@client_grid, @client_grid.assets) diff --git a/app/views/clients/index.html.haml b/app/views/clients/index.html.haml index 667059a877..db7e81e0b5 100644 --- a/app/views/clients/index.html.haml +++ b/app/views/clients/index.html.haml @@ -19,7 +19,7 @@ = t('.save_search_settings') - if params['commit'].present? || params['client_advanced_search'].present? - = button_to ad_search_clients_path, params: params.merge(format: 'xls', type: 'basic_info'), class: 'btn btn-primary btn-export clients-list', form_class: 'hidden-post-form', data: { toggle: 'popover', trigger: "hover", html: 'true', content: "#{I18n.t('inline_help.clients.index.buttons.export_to_xls')}", placement: "auto" } do + = button_to ad_search_clients_path, params: request.parameters.merge(format: 'xls', type: 'basic_info'), class: 'btn btn-primary btn-export clients-list', form_class: 'hidden-post-form', data: { toggle: 'popover', trigger: "hover", html: 'true', content: "#{I18n.t('inline_help.clients.index.buttons.export_to_xls')}", placement: "auto" } do %i.fa.fa-download = t('.export_to_xls') - if enable_all_csi_tools? @@ -103,14 +103,14 @@ %span.label.label-info= t('.results') .ibox-tools - if params[:data] == 'recent' - = button_to t('.show_all'), ad_search_clients_path, params: params.merge({data: 'all'}), class: 'btn btn-primary', form_class: 'hidden-post-form', id: 'show-all' + = button_to t('.show_all'), ad_search_clients_path, params: request.parameters.merge({data: 'all'}), class: 'btn btn-primary', form_class: 'hidden-post-form', id: 'show-all' - else - = button_to t('.most_recent'), ad_search_clients_path, params: params.merge({data: 'recent'}), class: 'btn btn-primary', form_class: 'hidden-post-form', id: 'most-recent' + = button_to t('.most_recent'), ad_search_clients_path, params: request.parameters.merge({data: 'recent'}), class: 'btn btn-primary', form_class: 'hidden-post-form', id: 'most-recent' .ibox-content .clients-table{ data: { 'info-load': t('.load'), 'info-end': t('.end'), 'read-more': t('.read_more'), 'read-less': t('.read_less') } } %table.table.table-bordered.table-striped.table-hover.clients#clients-list - = content_tag :div, 'hidden_param', class: 'hide', id: 'hidden-param', data: { 'hidden-param': url_for(params) } + = content_tag :div, 'hidden_param', class: 'hide', id: 'hidden-param', data: { 'hidden-param': url_for(request.parameters) } %thead = datagrid_header(@client_grid) %tbody.page diff --git a/app/views/clients/show.haml b/app/views/clients/show.haml index 638a365f81..4f57d554fc 100644 --- a/app/views/clients/show.haml +++ b/app/views/clients/show.haml @@ -12,7 +12,7 @@ %tr %td{rowspan: '4'} - if @client.profile? - = image_tag @client.profile.photo, alt: @client.profile.file.filename, id: 'client_photo' + = image_tag @client.profile.photo.url, alt: @client.profile.file.filename, id: 'client_photo' %td = "#{t('.name')} :" = editable @client, :given_name, value: @client.given_name, url: api_client_path(@client.id), pk: @client.id diff --git a/app/views/dashboards/_client_search.haml b/app/views/dashboards/_client_search.haml index b2fc8c0c11..5a3b5d6c41 100644 --- a/app/views/dashboards/_client_search.haml +++ b/app/views/dashboards/_client_search.haml @@ -1,15 +1,15 @@ #client-search.modal.fade{ role: 'dialog' } - .modal-dialog.modal-lg - .modal-content - .modal-body - .panel.panel-default#search-client - .panel-heading.heading-label.text-font - %h3.text-center= t('.search_client') - .panel-body - .row - .col-xs-12 - = hidden_field :search_for_client, 'format-input', value: t('.search_for_client') - = hidden_field :searching, 'format-input', value: t('.searching') - = hidden_field :not_found, 'format-input', value: t('.not_found') - = hidden_field :please_enter_more_char, 'format-input', value: t('.please_enter_more') - = text_field_tag 'client-search', nil, class: 'form-control select2-search-client', id: 'search-client-select2' + .modal-dialog.modal-lg + .modal-content + .modal-body + .panel.panel-default#search-client + .panel-heading.heading-label.text-font + %h3.text-center= t('.search_client') + .panel-body + .row + .col-xs-12 + = hidden_field :search_for_client, 'format-input', value: t('.search_for_client') + = hidden_field :searching, 'format-input', value: t('.searching') + = hidden_field :not_found, 'format-input', value: t('.not_found') + = hidden_field :please_enter_more_char, 'format-input', value: t('.please_enter_more') + = select_tag 'client-search', nil, prompt: t('.search_for_client'), class: 'form-control select2-search-client', id: 'search-client-select2' diff --git a/app/views/dashboards/_referral_source_category_reminder.haml b/app/views/dashboards/_referral_source_category_reminder.haml index 22081ba172..0f55a87876 100644 --- a/app/views/dashboards/_referral_source_category_reminder.haml +++ b/app/views/dashboards/_referral_source_category_reminder.haml @@ -17,7 +17,7 @@ %label %abbr{ title: 'required' } * = t('.ancestry') - = f.input :ancestry, collection: referral_source_name(ReferralSource.parent_categories), label: false, input_html: { class: "#{referral_source.id}" } + = f.input :ancestry, collection: referral_source_name(ReferralSource.parent_categories), label: false, input_html: { class: "referral_source_ancestry select #{referral_source.id}", id: "referral_source_ancestry-#{referral_source.id}" } .col-xs-2 = f.submit t('save'), class: "btn btn-primary form-btn save-#{referral_source.id} save-referral-btn", disabled: :disabled, data: { disable_with: "#{t('save')}..." } = image_tag 'success.png', class: "save-success hide save-success#{referral_source.id}" diff --git a/app/views/datagrid/_order_for.html.haml b/app/views/datagrid/_order_for.html.haml index e54105932a..754c206668 100644 --- a/app/views/datagrid/_order_for.html.haml +++ b/app/views/datagrid/_order_for.html.haml @@ -1,8 +1,8 @@ - if params["controller"] == "clients" .order.pull-right - = button_to I18n.t('datagrid.table.order.asc').html_safe, ad_search_clients_path, params: params.merge(grid.param_name => grid.as_query.merge(order: column.name, descending: false)), class: 'asc btn btn-link', form_class: 'hidden-post-form', style: 'padding: 0' - = button_to I18n.t('datagrid.table.order.desc').html_safe, ad_search_clients_path, params: params.merge(grid.param_name => grid.as_query.merge(order: column.name, descending: true)), class: 'desc btn btn-link', form_class: 'hidden-post-form', style: 'padding: 0' + = button_to I18n.t('datagrid.table.order.asc').html_safe, ad_search_clients_path, params: request.parameters.merge(grid.param_name => grid.as_query.merge(order: column.name, descending: false)), class: 'asc btn btn-link', form_class: 'hidden-post-form', style: 'padding: 0' + = button_to I18n.t('datagrid.table.order.desc').html_safe, ad_search_clients_path, params: request.parameters.merge(grid.param_name => grid.as_query.merge(order: column.name, descending: true)), class: 'desc btn btn-link', form_class: 'hidden-post-form', style: 'padding: 0' - else .order.pull-right - = link_to(I18n.t('datagrid.table.order.asc').html_safe, url_for(params.merge(grid.param_name => grid.as_query.merge(order: column.name, descending: false))), class: 'asc') - = link_to(I18n.t('datagrid.table.order.desc').html_safe, url_for(params.merge(grid.param_name => grid.as_query.merge(order: column.name, descending: true))), class: 'desc') + = link_to(I18n.t('datagrid.table.order.asc').html_safe, url_for(request.parameters.merge(grid.param_name => grid.as_query.merge(order: column.name, descending: false))), class: 'asc') + = link_to(I18n.t('datagrid.table.order.desc').html_safe, url_for(request.parameters.merge(grid.param_name => grid.as_query.merge(order: column.name, descending: true))), class: 'desc') diff --git a/app/views/devise/sessions/new.html.haml b/app/views/devise/sessions/new.html.haml index b38512354d..b438cb152b 100644 --- a/app/views/devise/sessions/new.html.haml +++ b/app/views/devise/sessions/new.html.haml @@ -2,7 +2,7 @@ .col-xs-12.col-sm-6.col-sm-offset-3.col-md-4.col-md-offset-4 .ibox.normal-space .ibox-title.text-center - = image_tag(@current_ngo&.logo || 'OSCaR.png') + = image_tag(@current_ngo&.logo&.url || 'OSCaR.png') .ibox-content = simple_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| = f.error_notification diff --git a/app/views/kaminari/_last_page.html.haml b/app/views/kaminari/_last_page.html.haml index d02712d68a..f6344dd248 100644 --- a/app/views/kaminari/_last_page.html.haml +++ b/app/views/kaminari/_last_page.html.haml @@ -1,7 +1,7 @@ %li - if params[:controller] == 'clients' - unless current_page.last? - - pagination_params = url.include?('page') ? params.merge(page: Rack::Utils.parse_nested_query(url)['page'].to_i) : params + - pagination_params = url.include?('page') ? request.parameters.merge(page: Rack::Utils.parse_nested_query(url)['page'].to_i) : params = button_to raw(t 'views.pagination.last'), ad_search_clients_path, params: pagination_params, :remote => remote, form_class: 'hidden-post-form' - else = link_to_unless current_page.last?, raw(t 'views.pagination.last'), url, {:remote => remote} diff --git a/app/views/kaminari/_next_page.html.haml b/app/views/kaminari/_next_page.html.haml index 448bf93b3f..ce51231951 100644 --- a/app/views/kaminari/_next_page.html.haml +++ b/app/views/kaminari/_next_page.html.haml @@ -1,7 +1,7 @@ %li - if params[:controller] == 'clients' - unless current_page.last? - - pagination_params = url.include?('page') ? params.merge(page: Rack::Utils.parse_nested_query(url)['page'].to_i) : params + - pagination_params = url.include?('page') ? request.parameters.merge(page: Rack::Utils.parse_nested_query(url)['page'].to_i) : params = button_to raw(t 'views.pagination.next'), ad_search_clients_path, params: pagination_params, :rel => 'next', :remote => remote, form_class: 'hidden-post-form' - else = link_to_unless current_page.last?, raw(t 'views.pagination.next'), url, :rel => 'next', :remote => remote diff --git a/app/views/kaminari/_page.html.haml b/app/views/kaminari/_page.html.haml index 2803f42919..4ba519eb69 100644 --- a/app/views/kaminari/_page.html.haml +++ b/app/views/kaminari/_page.html.haml @@ -4,7 +4,7 @@ - else %li - if params[:controller] == 'clients' - - pagination_params = url.include?('page') ? params.merge(page: Rack::Utils.parse_nested_query(url)['page'].to_i) : params.merge(page: 1) + - pagination_params = url.include?('page') ? request.parameters.merge(page: Rack::Utils.parse_nested_query(url)['page'].to_i) : request.parameters.merge(page: 1) = button_to page, ad_search_clients_path, params: pagination_params, remote: remote, rel: (page.next? ? 'next' : (page.prev? ? 'prev' : nil)), form_class: 'hidden-post-form' - else = link_to page, url, remote: remote, rel: (page.next? ? 'next' : (page.prev? ? 'prev' : nil)) diff --git a/app/views/layouts/_side_menu.haml b/app/views/layouts/_side_menu.haml index 189f3a4095..2f4fe28148 100644 --- a/app/views/layouts/_side_menu.haml +++ b/app/views/layouts/_side_menu.haml @@ -5,7 +5,7 @@ .dropdown.profile-element .image-wrapper.text-center = link_to root_path do - = image_tag(Organization.current.logo.thumb, class: 'img-circle') + = image_tag(Organization.current.logo.thumb.url, class: 'img-circle') %hr.line-border %a.dropdown-toggle{"data-toggle" => "dropdown", :href => "#"} %span.clear @@ -26,7 +26,7 @@ = link_to t('.log_out'), destroy_user_session_path, method: :delete .logo-element.custom = link_to root_path do - = image_tag(Organization.current.logo, class: 'log-min img-responsive') + = image_tag(Organization.current.logo.url, class: 'log-min img-responsive') - if user_signed_in? %li{class: "#{active_menu('dashboards')}"} = link_to root_path do diff --git a/app/views/layouts/_top_navbar.haml b/app/views/layouts/_top_navbar.haml index 393c5ddf88..80a27d4bf7 100644 --- a/app/views/layouts/_top_navbar.haml +++ b/app/views/layouts/_top_navbar.haml @@ -21,7 +21,7 @@ - request_method = (params[:controller] == 'clients' && params[:action] == 'index') ? 'Post' : 'Get' - supported_languages = (current_organization&.supported_languages || Organization::SUPPORTED_LANGUAGES) - supported_languages.each do |supported_lang| - = link_to(url_for(params.merge({locale: supported_lang})), id: "lang-#{supported_lang}", method: request_method) do + = link_to(url_for(request.parameters.merge({locale: supported_lang})), id: "lang-#{supported_lang}", method: request_method) do = image_tag(supported_languages_data.dig(supported_lang.to_sym, :flag_file_name)) = supported_languages_data.dig(supported_lang.to_sym, :label) diff --git a/app/views/layouts/mailer.html.haml b/app/views/layouts/mailer.html.haml index 28739ee901..f992a524d0 100644 --- a/app/views/layouts/mailer.html.haml +++ b/app/views/layouts/mailer.html.haml @@ -1,3 +1,7 @@ -%hmtl - %body - = yield \ No newline at end of file +!!! +%html + %head + %meta{:content => "text/html; charset=utf-8", "http-equiv" => "Content-Type"}/ + :css + /* Email styles need to be inline */ + %body= yield diff --git a/app/views/organizations/index.html.haml b/app/views/organizations/index.html.haml index b473b81137..2340f76495 100644 --- a/app/views/organizations/index.html.haml +++ b/app/views/organizations/index.html.haml @@ -6,4 +6,4 @@ .col-xs-6.col-sm-4 = link_to dashboards_url(subdomain: org.short_name), class: 'org-link' do .organization - = image_tag(org.logo.thumb) + = image_tag(org.logo.thumb.url) diff --git a/bin/bundle b/bin/bundle index 66e9889e8b..f19acf5b5c 100755 --- a/bin/bundle +++ b/bin/bundle @@ -1,3 +1,3 @@ #!/usr/bin/env ruby -ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) load Gem.bin_path('bundler', 'bundle') diff --git a/bin/rails b/bin/rails index 0138d79b75..5badb2fde0 100755 --- a/bin/rails +++ b/bin/rails @@ -4,6 +4,6 @@ begin rescue LoadError => e raise unless e.message.include?('spring') end -APP_PATH = File.expand_path('../../config/application', __FILE__) +APP_PATH = File.expand_path('../config/application', __dir__) require_relative '../config/boot' require 'rails/commands' diff --git a/bin/setup b/bin/setup index acdb2c1389..94fd4d7977 100755 --- a/bin/setup +++ b/bin/setup @@ -1,29 +1,36 @@ #!/usr/bin/env ruby -require 'pathname' +require 'fileutils' +include FileUtils # path to your application root. -APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) +APP_ROOT = File.expand_path('..', __dir__) -Dir.chdir APP_ROOT do +def system!(*args) + system(*args) || abort("\n== Command #{args} failed ==") +end + +chdir APP_ROOT do # This script is a starting point to setup your application. - # Add necessary setup steps to this file: + # Add necessary setup steps to this file. + + puts '== Installing dependencies ==' + system! 'gem install bundler --conservative' + system('bundle check') || system!('bundle install') - puts "== Installing dependencies ==" - system "gem install bundler --conservative" - system "bundle check || bundle install" + # Install JavaScript dependencies if using Yarn + # system('bin/yarn') # puts "\n== Copying sample files ==" - # unless File.exist?("config/database.yml") - # system "cp config/database.yml.sample config/database.yml" + # unless File.exist?('config/database.yml') + # cp 'config/database.yml.sample', 'config/database.yml' # end puts "\n== Preparing database ==" - system "bin/rake db:setup" + system! 'bin/rails db:setup' puts "\n== Removing old logs and tempfiles ==" - system "rm -f log/*" - system "rm -rf tmp/cache" + system! 'bin/rails log:clear tmp:clear' puts "\n== Restarting application server ==" - system "touch tmp/restart.txt" + system! 'bin/rails restart' end diff --git a/bin/update b/bin/update new file mode 100755 index 0000000000..58bfaed518 --- /dev/null +++ b/bin/update @@ -0,0 +1,31 @@ +#!/usr/bin/env ruby +require 'fileutils' +include FileUtils + +# path to your application root. +APP_ROOT = File.expand_path('..', __dir__) + +def system!(*args) + system(*args) || abort("\n== Command #{args} failed ==") +end + +chdir APP_ROOT do + # This script is a way to update your development environment automatically. + # Add necessary update steps to this file. + + puts '== Installing dependencies ==' + system! 'gem install bundler --conservative' + system('bundle check') || system!('bundle install') + + # Install JavaScript dependencies if using Yarn + # system('bin/yarn') + + puts "\n== Updating database ==" + system! 'bin/rails db:migrate' + + puts "\n== Removing old logs and tempfiles ==" + system! 'bin/rails log:clear tmp:clear' + + puts "\n== Restarting application server ==" + system! 'bin/rails restart' +end diff --git a/bin/yarn b/bin/yarn new file mode 100755 index 0000000000..460dd565b4 --- /dev/null +++ b/bin/yarn @@ -0,0 +1,11 @@ +#!/usr/bin/env ruby +APP_ROOT = File.expand_path('..', __dir__) +Dir.chdir(APP_ROOT) do + begin + exec "yarnpkg", *ARGV + rescue Errno::ENOENT + $stderr.puts "Yarn executable was not detected in the system." + $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install" + exit 1 + end +end diff --git a/config/application.rb b/config/application.rb index 41f7c1d35a..f23491beb5 100644 --- a/config/application.rb +++ b/config/application.rb @@ -1,14 +1,29 @@ -require File.expand_path('../boot', __FILE__) - -require "rails/all" +require_relative 'boot' + +require 'rails/all' + +# Pick the frameworks you want: +require 'active_model/railtie' +require 'active_job/railtie' +require 'active_record/railtie' +require 'active_storage/engine' +require 'action_controller/railtie' +require 'action_mailer/railtie' +require 'action_view/railtie' +require 'action_cable/engine' +require 'sprockets/railtie' +require 'apartment/elevators/subdomain' # Require the gems listed in Gemfile, including any gems + # you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) module CifWeb class Application < Rails::Application - config.middleware.use 'Apartment::Elevators::Subdomain' - config.middleware.insert_before 'Warden::Manager', 'Apartment::Elevators::Subdomain' + config.load_defaults 5.2 + + config.middleware.use Apartment::Elevators::Subdomain + config.middleware.insert_before Warden::Manager, Apartment::Elevators::Subdomain # Settings in config/environments/* take precedence over those specified here. # Application configuration should go into files in config/initializers # -- all .rb files in that directory are automatically loaded. @@ -42,9 +57,6 @@ class Application < Rails::Application end end - # Do not allow errors in after_commit/after_rollback callbacks. - config.active_record.raise_in_transactional_callbacks = true - # custom error page config.exceptions_app = self.routes end diff --git a/config/boot.rb b/config/boot.rb index 6b750f00b1..b9e460cef3 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,3 +1,4 @@ -ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) require 'bundler/setup' # Set up gems listed in the Gemfile. +require 'bootsnap/setup' # Speed up boot time by caching expensive operations. diff --git a/config/cable.yml b/config/cable.yml new file mode 100644 index 0000000000..ed89642475 --- /dev/null +++ b/config/cable.yml @@ -0,0 +1,10 @@ +development: + adapter: async + +test: + adapter: async + +production: + adapter: redis + url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %> + channel_prefix: cif_web_production diff --git a/config/environment.rb b/config/environment.rb index ee8d90dc65..426333bb46 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,5 +1,5 @@ # Load the Rails application. -require File.expand_path('../application', __FILE__) +require_relative 'application' # Initialize the Rails application. Rails.application.initialize! diff --git a/config/environments/development.rb b/config/environments/development.rb index b56744af5d..84db3154d8 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -11,13 +11,32 @@ # Show full error reports and disable caching. config.consider_all_requests_local = true - config.action_controller.perform_caching = false + # Enable/disable caching. By default caching is disabled. + # Run rails dev:cache to toggle caching. + if Rails.root.join('tmp', 'caching-dev.txt').exist? + config.action_controller.perform_caching = true + + config.cache_store = :memory_store + config.public_file_server.headers = { + 'Cache-Control' => "public, max-age=#{2.days.to_i}" + } + else + # config.perform_caching = true + config.action_controller.perform_caching = false + # config.cache_store = :mem_cache_store + + config.cache_store = :null_store + end + + # Store uploaded files on the local file system (see config/storage.yml for options) + config.active_storage.service = :local + # Don't care if the mailer can't send. config.action_mailer.perform_deliveries = true config.action_mailer.raise_delivery_errors = false # config.action_mailer.delivery_method = :smtp - + config.action_mailer.perform_caching = false # config.action_mailer.smtp_settings = { # address: 'email-smtp.us-east-1.amazonaws.com', # authentication: :login, @@ -42,6 +61,8 @@ # number of complex assets. config.assets.debug = true + # Suppress logger output for asset requests. + config.assets.quiet = true # Asset digests allow you to set far-future HTTP expiration dates on all assets, # yet still be able to expire them through the digest params. config.assets.digest = true diff --git a/config/environments/production.rb b/config/environments/production.rb index 5bce3bdf49..b52eff642a 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -20,9 +20,13 @@ # NGINX, varnish or squid. # config.action_dispatch.rack_cache = true + # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"] + # or in config/master.key. This key is used to decrypt credentials (and other encrypted files). + # config.require_master_key = true + # Disable serving static files from the `/public` folder by default since # Apache or NGINX already handles this. - config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present? + config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? # Compress JavaScripts and CSS. config.assets.js_compressor = :uglifier @@ -59,9 +63,21 @@ } # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb + # Enable serving of images, stylesheets, and JavaScripts from an asset server. + # config.action_controller.asset_host = 'http://assets.example.com' + + # Specifies the header that your server uses for sending files. # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX + # Store uploaded files on the local file system (see config/storage.yml for options) + # config.active_storage.service = :local + + # Mount Action Cable outside main process or domain + # config.action_cable.mount_path = nil + # config.action_cable.url = 'wss://example.com/cable' + # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ] + # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. # config.force_ssl = true @@ -72,6 +88,7 @@ # Prepend all log lines with the following tags. # config.log_tags = [ :subdomain, :uuid ] + config.log_tags = [ :request_id ] # Use a different logger for distributed setups. # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) @@ -81,6 +98,11 @@ # Enable serving of images, stylesheets, and JavaScripts from an asset server. # config.action_controller.asset_host = 'http://assets.example.com' + # Use a real queuing backend for Active Job (and separate queues per environment) + # config.active_job.queue_adapter = :resqu + # config.active_job.queue_name_prefix = "cif_web_#{Rails.env}" + + config.action_mailer.perform_caching = false # Ignore bad email addresses and do not raise email delivery errors. # Set this to true and configure the email server for immediate delivery to raise delivery errors. @@ -96,6 +118,17 @@ # Use default logging formatter so that PID and timestamp are not suppressed. config.log_formatter = ::Logger::Formatter.new + # Use a different logger for distributed setups. + # require 'syslog/logger' + # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') + + if ENV["RAILS_LOG_TO_STDOUT"].present? + logger = ActiveSupport::Logger.new(STDOUT) + logger.formatter = config.log_formatter + config.logger = ActiveSupport::TaggedLogging.new(logger) + end + + # Do not dump schema after migrations. config.active_record.dump_schema_after_migration = false end diff --git a/config/environments/test.rb b/config/environments/test.rb index 414787bf18..48c3e58d3d 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -12,9 +12,11 @@ # preloads Rails for running tests, you may have to set it to true. config.eager_load = false - # Configure static file server for tests with Cache-Control for performance. - config.serve_static_files = true - config.static_cache_control = 'public, max-age=3600' + # Configure public file server for tests with Cache-Control for performance. + config.public_file_server.enabled = true + config.public_file_server.headers = { + 'Cache-Control' => "public, max-age=#{1.hour.to_i}" + } # Show full error reports and disable caching. config.consider_all_requests_local = true @@ -26,10 +28,21 @@ # Disable request forgery protection in test environment. config.action_controller.allow_forgery_protection = false + # Store uploaded files on the local file system in a temporary directory + config.active_storage.service = :test + + config.action_mailer.perform_caching = false + # Tell Action Mailer not to deliver emails to the real world. # The :test delivery method accumulates sent emails in the # ActionMailer::Base.deliveries array. config.action_mailer.delivery_method = :test + + # Print deprecation notices to the stderr. + config.active_support.deprecation = :stderr + + # Raises error for missing translations + # config.action_view.raise_on_missing_translations = true config.action_mailer.default_url_options = { host: 'lvh.me', port: 3001 } config.logger = ActiveSupport::Logger.new(config.paths['log'].first, 1, 50 * 1024 * 1024) diff --git a/config/initializers/active_record_belongs_to_required_by_default.rb b/config/initializers/active_record_belongs_to_required_by_default.rb new file mode 100644 index 0000000000..6ee4b37e32 --- /dev/null +++ b/config/initializers/active_record_belongs_to_required_by_default.rb @@ -0,0 +1 @@ +Rails.application.config.active_record.belongs_to_required_by_default = true diff --git a/config/initializers/application_controller_renderer.rb b/config/initializers/application_controller_renderer.rb new file mode 100644 index 0000000000..89d2efab2b --- /dev/null +++ b/config/initializers/application_controller_renderer.rb @@ -0,0 +1,8 @@ +# Be sure to restart your server when you modify this file. + +# ActiveSupport::Reloader.to_prepare do +# ApplicationController.renderer.defaults.merge!( +# http_host: 'example.org', +# https: false +# ) +# end diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index 03cfd986b5..5f239ce646 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -3,12 +3,14 @@ # Version of your assets, change this if you want to expire all your assets. Rails.application.config.assets.version = '1.0' -# Add additional assets to the asset load path +# Add additional assets to the asset load path. # Rails.application.config.assets.paths << Emoji.images_path +# Add Yarn node_modules folder to the asset load path. +Rails.application.config.assets.paths << Rails.root.join('node_modules') # Precompile additional assets. -# application.js, application.css, and all non-JS/CSS in app/assets folder are already added. - -# Rich text editor for the Domain +# application.js, application.css, and all non-JS/CSS in the app/assets +# folder are already added. +# Rails.application.config.assets.precompile += %w( admin.js admin.css ) Rails.application.config.assets.precompile += %w(jquery.nicescroll.js animate.css toastr.min.css custom.css green.png) Rails.application.config.assets.precompile += %w(chariot.min.js chariot.min.css) diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb new file mode 100644 index 0000000000..d3bcaa5ec8 --- /dev/null +++ b/config/initializers/content_security_policy.rb @@ -0,0 +1,25 @@ +# Be sure to restart your server when you modify this file. + +# Define an application-wide content security policy +# For further information see the following documentation +# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy + +# Rails.application.config.content_security_policy do |policy| +# policy.default_src :self, :https +# policy.font_src :self, :https, :data +# policy.img_src :self, :https, :data +# policy.object_src :none +# policy.script_src :self, :https +# policy.style_src :self, :https + +# # Specify URI for violation reports +# # policy.report_uri "/csp-violation-report-endpoint" +# end + +# If you are using UJS then enable automatic nonce generation +# Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) } + +# Report CSP violations to a specified URI +# For further information see the following documentation: +# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only +# Rails.application.config.content_security_policy_report_only = true diff --git a/config/initializers/cookies_serializer.rb b/config/initializers/cookies_serializer.rb index 7f70458dee..5a6a32d371 100644 --- a/config/initializers/cookies_serializer.rb +++ b/config/initializers/cookies_serializer.rb @@ -1,3 +1,5 @@ # Be sure to restart your server when you modify this file. +# Specify a serializer for the signed and encrypted cookie jars. +# Valid options are :json, :marshal, and :hybrid. Rails.application.config.action_dispatch.cookies_serializer = :json diff --git a/config/initializers/i18n/backend/custom.rb b/config/initializers/i18n/backend/custom.rb index c8a68992e1..92253ff6f6 100644 --- a/config/initializers/i18n/backend/custom.rb +++ b/config/initializers/i18n/backend/custom.rb @@ -25,11 +25,14 @@ module I18n::Backend::Custom def load_translations(*filenames) filenames = I18n.load_path if filenames.empty? filenames.flatten.each { |filename| load_file(filename) } + load_custom_labels = nil - if ActiveRecord::Base.connection.table_exists? 'settings' - nepal_commune_mapping if Setting.first&.country_name == 'nepal' + def database_exists? + nepal_commune_mapping if ActiveRecord::Base.connection.table_exists?('settings') && Setting.first&.country_name == 'nepal' + load_custom_labels if ActiveRecord::Base.connection.table_exists? 'field_settings' + rescue ActiveRecord::NoDatabaseError + false end - load_custom_labels if ActiveRecord::Base.connection.table_exists? 'field_settings' end def load_custom_labels diff --git a/config/initializers/new_framework_defaults_5_2.rb b/config/initializers/new_framework_defaults_5_2.rb new file mode 100644 index 0000000000..c383d072bc --- /dev/null +++ b/config/initializers/new_framework_defaults_5_2.rb @@ -0,0 +1,38 @@ +# Be sure to restart your server when you modify this file. +# +# This file contains migration options to ease your Rails 5.2 upgrade. +# +# Once upgraded flip defaults one by one to migrate to the new default. +# +# Read the Guide for Upgrading Ruby on Rails for more info on each option. + +# Make Active Record use stable #cache_key alongside new #cache_version method. +# This is needed for recyclable cache keys. +# Rails.application.config.active_record.cache_versioning = true + +# Use AES-256-GCM authenticated encryption for encrypted cookies. +# Also, embed cookie expiry in signed or encrypted cookies for increased security. +# +# This option is not backwards compatible with earlier Rails versions. +# It's best enabled when your entire app is migrated and stable on 5.2. +# +# Existing cookies will be converted on read then written with the new scheme. +# Rails.application.config.action_dispatch.use_authenticated_cookie_encryption = true + +# Use AES-256-GCM authenticated encryption as default cipher for encrypting messages +# instead of AES-256-CBC, when use_authenticated_message_encryption is set to true. +# Rails.application.config.active_support.use_authenticated_message_encryption = true + +# Add default protection from forgery to ActionController::Base instead of in +# ApplicationController. +# Rails.application.config.action_controller.default_protect_from_forgery = true + +# Store boolean values are in sqlite3 databases as 1 and 0 instead of 't' and +# 'f' after migrating old data. +# Rails.application.config.active_record.sqlite3.represent_boolean_as_integer = true + +# Use SHA-1 instead of MD5 to generate non-sensitive digests, such as the ETag header. +# Rails.application.config.active_support.use_sha1_digests = true + +# Make `form_with` generate id attributes for any generated HTML tags. +# Rails.application.config.action_view.form_with_generates_ids = true diff --git a/config/initializers/paper_trail.rb b/config/initializers/paper_trail.rb index 61426eb7be..af876e3590 100644 --- a/config/initializers/paper_trail.rb +++ b/config/initializers/paper_trail.rb @@ -1,13 +1,21 @@ -PaperTrail.config.track_associations = true +require 'rake' PaperTrail.config.version_limit = nil +PaperTrail.config.track_associations = true # set whodunnit in rails console PaperTrail::Rails::Engine.eager_load! +module PaperTrail + class Version < ::ActiveRecord::Base + include PaperTrail::VersionConcern + # belongs_to :user, foreign_key: :whodunnit + end +end + if defined?(::Rails::Console) # PaperTrail.whodunnit = "#{`whoami`.strip}: console" - PaperTrail.whodunnit = "#{`whoami`.strip}@rotati" + PaperTrail.request.whodunnit = "#{`whoami`.strip}@rotati" elsif defined?(Rake) && Rake.application.name # PaperTrail.whodunnit = "#{`whoami`.strip}: #{File.basename($0)} #{ARGV.join ' '}" - PaperTrail.whodunnit = "#{`whoami`.strip}@rotati" + PaperTrail.request.whodunnit = "#{`whoami`.strip}@rotati" end diff --git a/config/initializers/thredded.rb b/config/initializers/thredded.rb index 6c534f90a6..55e0b241cb 100644 --- a/config/initializers/thredded.rb +++ b/config/initializers/thredded.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + # Thredded configuration # ==> User Configuration @@ -7,23 +8,29 @@ # for your user class - change it here. Thredded.user_class = 'User' -# User email column, used in @mention syntax and should be unique. +# User name column, used in @mention syntax and *must* be unique. # This is the column used to search for users' names if/when someone is @ mentioned. Thredded.user_name_column = :email +# User display name method, by default thredded uses the user_name_column defined above +# You may want to use :to_s or some more elaborate method +# Thredded.user_display_name_method = :to_s + # The path (or URL) you will use to link to your users' profiles. # When linking to a user, Thredded will use this lambda to spit out # the path or url to your user. This lambda is evaluated in the view context. -Thredded.user_path = lambda do |user| - user_path = :"#{Thredded.user_class.name.underscore}_path" +# If the lambda returns nil, a span element is returned instead of a link; so +# setting this to always return nil effectively disables all user links. +Thredded.user_path = ->(user) { + user_path = :"#{Thredded.user_class_name.demodulize.underscore}_path" main_app.respond_to?(user_path) ? main_app.send(user_path, user) : "/users/#{user.to_param}" -end +} # This method is used by Thredded controllers and views to fetch the currently signed-in user -Thredded.current_user_method = :"current_#{Thredded.user_class.name.underscore}" +Thredded.current_user_method = :"current_#{Thredded.user_class_name.demodulize.underscore}" # User avatar URL. rb-gravatar gem is used by default: -Thredded.avatar_url = ->(user) { Gravatar.src(user.email, 128, 'mm') } +Thredded.avatar_url = ->(user) { Gravatar.src(user.email, 156, 'mm') } # ==> Permissions Configuration # By default, thredded uses a simple permission model, where all the users can post to all message boards, @@ -40,44 +47,139 @@ # This model can be customized further by overriding a handful of methods on the User model. # For more information, see app/models/thredded/user_extender.rb. +# ==> UI configuration + +# How to calculate the position of messageboards in a list: +# :position (default) set the position manually (new messageboards go to the bottom, by creation timestamp) +# :last_post_at_desc most recent post first +# :topics_count_desc most topics first +Thredded.messageboards_order = :position + +# Whether users that are following a topic are listed on the topic page. +Thredded.show_topic_followers = false + +# Whether the list of users who are currently online is displayed. +Thredded.currently_online_enabled = true + +# Whether private messaging functionality is enabled. +Thredded.private_messaging_enabled = true + +# The number of topics to display per page. +# Thredded.topics_per_page = 50 + +# The number of posts to display per page in a topic. +# Thredded.posts_per_page = 25 + +# The layout for rendering Thredded views. +Thredded.layout = 'thredded/application' + # ==> Email Configuration # Email "From:" field will use the following +# (this is also used as the "To" address for both email notifcations, as all the recipients are on bcc) Thredded.email_from = ENV['SENDER_EMAIL'] -# Incoming email will be directed to this host -Thredded.email_incoming_host = ENV['HOST_SERVER'] - # Emails going out will prefix the "Subject:" with the following string Thredded.email_outgoing_prefix = '[FAQ] ' +# +# The parent mailer for all Thredded mailers +# Thredded.parent_mailer = 'ActionMailer::Base' -# Reply to field for email notifications -Thredded.email_reply_to = -> postable { "#{postable.hash_id}@#{Thredded.email_incoming_host}" } +# ==> Model configuration +# The range of valid messageboard name lengths. Default: +# Thredded.messageboard_name_length_range = (1..60) +# +# The range of valid topic title lengths. Default: +# Thredded.topic_title_length_range = (1..200) -# ==> View Configuration -# Set the layout for rendering the thredded views. -Thredded.layout = 'thredded/application' +# ==> Routes and URLs +# How Thredded generates URL slugs from text: + +# Default: +# Thredded.slugifier = ->(input) { input.parameterize } + +# If your forum is in a language other than English, you might want to use the babosa gem instead +# Thredded.slugifier = ->(input) { Babosa::Identifier.new(input).normalize.transliterate(:russian).to_s } + +# By default, thredded uses integers for record ID route constraints. +# For integer based IDs (default): +# Thredded.routes_id_constraint = /[1-9]\d*/ +# +# For UUID based IDs (example): +# Thredded.routes_id_constraint = /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/ # ==> Post Content Formatting # Customize the way Thredded handles post formatting. -# Change the default html-pipeline filters used by thredded. -# E.g. to remove BBCode support: -# Thredded::ContentFormatter.pipeline_filters -= [HTML::Pipeline::BbcodeFilter] +# ===> Emoji using the 'gemoji' gem +# 1. Install `gemoji` following instruction at https://github.com/github/gemoji. +# 2. Uncomment the following line: +# Thredded::ContentFormatter.after_markup_filters.insert(1, HTML::Pipeline::EmojiFilter) # Change the HTML sanitization settings used by Thredded. # See the Sanitize docs for more information on the underlying library: https://github.com/rgrove/sanitize/#readme # E.g. to allow a custom element