diff --git a/.browserslistrc b/.browserslistrc deleted file mode 100644 index e94f8140..00000000 --- a/.browserslistrc +++ /dev/null @@ -1 +0,0 @@ -defaults diff --git a/.docker/base/Dockerfile b/.docker/base/Dockerfile index 214baa89..75106232 100644 --- a/.docker/base/Dockerfile +++ b/.docker/base/Dockerfile @@ -2,9 +2,9 @@ ### app/rails config ### ######################## -FROM ruby:2.7.8 AS app +FROM ruby:3.4.2 AS app -LABEL author="IdeaCrew" +LABEL author="DCHBX" ARG NODE_MAJOR @@ -19,8 +19,8 @@ ARG YARN_VERSION # Install required packages/libraries RUN apt-get update && \ apt-get -yq dist-upgrade && \ - apt-get install -y git gcc openssl libyaml-dev libyaml-cpp-dev libyaml-cpp0.6 libffi-dev libffi7 libreadline-dev libsodium-dev \ - zlib1g libgdbm-dev libncurses-dev autoconf fontconfig unzip zip sshpass bzip2 libxrender1 libxext6 \ + apt-get install -y git gcc openssl libyaml-dev libyaml-cpp-dev libyaml-cpp0.6 libffi-dev libffi6 libreadline-dev libsodium-dev \ + zlibc libgdbm-dev libncurses-dev autoconf fontconfig unzip zip sshpass bzip2 libxrender1 libxext6 \ build-essential nodejs yarn=$YARN_VERSION-1 && \ apt-get autoremove -y diff --git a/.docker/development/Dockerfile b/.docker/development/Dockerfile index 7ff6992f..445b45bd 100644 --- a/.docker/development/Dockerfile +++ b/.docker/development/Dockerfile @@ -1,12 +1,12 @@ -FROM --platform=linux/amd64 ruby:2.7.8 AS polypress +FROM --platform=linux/amd64 ruby:3.4.2 AS polypress -LABEL author="IdeaCrew" +LABEL author="DCHBX" ENV HOME /polypress RUN mkdir -p $HOME WORKDIR $HOME -RUN curl -sL https://deb.nodesource.com/setup_12.x | bash - +RUN curl -sL https://deb.nodesource.com/setup_20.x | bash - RUN apt-get update \ && apt-get -yq dist-upgrade \ diff --git a/.docker/production/Dockerfile.gha b/.docker/production/Dockerfile.gha index bfcc1321..17a09151 100644 --- a/.docker/production/Dockerfile.gha +++ b/.docker/production/Dockerfile.gha @@ -3,19 +3,19 @@ ############################################ # Taken from .ruby-version -ARG RUBY_VERSION=2.7.8 +ARG RUBY_VERSION=3.4.2 ARG NODE_VERSION=14.21.3 -FROM ruby:$RUBY_VERSION-slim-bullseye as base -LABEL author="IdeaCrew" +FROM ruby:$RUBY_VERSION-slim-bookworm as base +LABEL author="DCHBX" ENV USERNAME=polypress ARG DEBIAN_FRONTEND=noninteractive # Taken from Gemfile.lock -ARG BUNDLER_VERSION=2.2.24 +ARG BUNDLER_VERSION=2.5.22 -# Must be set as ENV variable to override the default +# Must be set as ENV variable to overrride the default ENV BUNDLER_VERSION=$BUNDLER_VERSION # Needed for Java install @@ -29,11 +29,13 @@ RUN apt-get update \ curl \ fontconfig \ libcurl4 \ - libffi7 \ + libffi-dev \ libsodium23 \ libxext6 \ libxrender1 \ - libyaml-cpp0.6 \ + libyaml-dev \ + nodejs \ + default-jre \ openssl \ nano \ sshpass \ @@ -41,6 +43,7 @@ RUN apt-get update \ vim \ zip \ zlib1g \ + libjemalloc2 \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \ && truncate -s 0 /var/log/*log @@ -50,8 +53,6 @@ RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2 && /tmp/aws/install \ && rm -rf /tmp/aws /tmp/awscliv2.zip awscliv2.zip -RUN mkdir /etc/infra - # Configure bundler and PATH, install bundler version ENV GEM_HOME=/usr/local/bundle ENV BUNDLE_PATH=$GEM_HOME @@ -114,16 +115,23 @@ RUN apt-get update -qq && \ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \ && truncate -s 0 /var/log/*log -COPY --from=node_runtime /usr/local/bin/node /usr/local/bin/node -COPY --from=node_runtime /usr/local/bin/npm /usr/local/bin/npm -COPY --from=node_runtime /usr/local/bin/npx /usr/local/bin/npx -COPY --from=node_runtime /usr/local/lib/node_modules /usr/local/lib/node_modules +ARG NODE_MAJOR=20 +ENV NODE_MAJOR=$NODE_MAJOR +RUN curl -fsSL https://deb.nodesource.com/setup_$NODE_MAJOR.x | bash - -RUN ln -sf /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm \ - && ln -sf /usr/local/lib/node_modules/npm/bin/npx-cli.js /usr/local/bin/npx \ - && npm install -g yarn@1 +RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \ + && echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list -RUN node --version && npm --version && yarn --version +RUN apt-get update -qq \ + && apt-get install -yq --no-install-recommends \ + build-essential \ + git \ + libpq-dev \ + nodejs \ + yarn \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \ + && truncate -s 0 /var/log/*log ######################################################## ### Node and Bundle for production ### @@ -147,7 +155,7 @@ ARG RABBITMQ_VHOST=event_source COPY --chown=$USERNAME:$USERNAME package.json $HOME/ COPY --chown=$USERNAME:$USERNAME yarn.lock $HOME/ -RUN yarn install \ +RUN yarn install --check-files \ && (rm -rf /tmp/* || true) COPY --chown=$USERNAME:$USERNAME ./project_gems/effective_datatables-2.6.14/effective_datatables-2.6.14.gemspec $HOME/project_gems/effective_datatables-2.6.14/effective_datatables-2.6.14.gemspec @@ -157,15 +165,18 @@ COPY --chown=$USERNAME:$USERNAME ./project_gems/liquid-5.0.1/lib/liquid/version. COPY --chown=$USERNAME:$USERNAME ./Gemfile $HOME/Gemfile COPY --chown=$USERNAME:$USERNAME ./Gemfile.lock $HOME/Gemfile.lock -COPY --chown=$USERNAME:$USERNAME . $HOME -COPY --chown=$USERNAME:$USERNAME ./.docker/config/master.key $HOME/config -COPY --chown=$USERNAME:$USERNAME ./.docker/config/credentials.yml.enc $HOME/config -COPY --chown=$USERNAME:$USERNAME ./.docker/config/mongoid.yml $HOME/config +ARG GEM_OAUTH_TOKEN +ARG BUNDLE_GITHUB__COM=$GEM_OAUTH_TOKEN RUN bundle config set --local without 'development test' \ && bundle install -RUN bundle exec rails webpacker:install:erb +RUN bundle exec rails shakapacker:install + +COPY --chown=$USERNAME:$USERNAME . $HOME +COPY --chown=$USERNAME:$USERNAME ./.docker/config/master.key $HOME/config +COPY --chown=$USERNAME:$USERNAME ./.docker/config/credentials.yml.enc $HOME/config +COPY --chown=$USERNAME:$USERNAME ./.docker/config/mongoid.yml $HOME/config RUN bundle exec rails assets:precompile \ && yarn cache clean \ @@ -214,6 +225,7 @@ COPY --chown=$USERNAME:$USERNAME ./.docker/config/mongoid.yml $HOME/config COPY --chown=$USERNAME:$USERNAME ./.docker/config/credentials.yml.enc $HOME/config COPY --chown=$USERNAME:$USERNAME ./.docker/config/master.key $HOME/config -RUN echo '[ ! -z "$TERM" -a -r /etc/infra/motd ] && cat /etc/infra/motd' >> /etc/bash.bashrc USER $USERNAME + +ENTRYPOINT ["bin/docker-entrypoint"] diff --git a/.rubocop.yml b/.rubocop.yml index 429b448f..b8be727c 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -128,3 +128,6 @@ Bundler/OrderedGems: Gemspec/OrderedDependencies: Enabled: false + +Style/SafeNavigationChainLength: + Enabled: false diff --git a/.ruby-version b/.ruby-version index 6a81b4c8..4d9d11cf 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.7.8 +3.4.2 diff --git a/Gemfile b/Gemfile index d730d327..f6eadf12 100644 --- a/Gemfile +++ b/Gemfile @@ -3,15 +3,16 @@ source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } -ruby '2.7.8' +ruby '3.4.2' -gem 'aca_entities', git: 'https://github.com/ideacrew/aca_entities.git', branch: 'trunk' +gem 'aca_entities', git: 'https://github.com/ideacrew/aca_entities.git', ref: '0350721' # Reduces boot times through caching; required in config/boot.rb -gem 'bootsnap', '>= 1.4.4', require: false +gem 'bootsnap', '>= 1.10.3', require: false gem 'ckeditor', '~> 4.2.4' gem 'combine_pdf', '~> 1.0' -gem 'config', '~> 2.0' # Deprecate for Resource Registry +gem 'config', '~> 5.1' # Deprecate for Resource Registry +gem 'csv' gem 'devise', '~> 4.8' # for account locking @@ -29,11 +30,11 @@ gem 'effective_datatables', path: './project_gems/effective_datatables-2.6.14' gem 'event_source', git: 'https://github.com/ideacrew/event_source.git', - branch: 'trunk' + ref: '7530e5a' # not merged yet gem 'sneakers', '~> 2.12' -gem 'httparty', '~> 0.16' +gem 'httparty', '~> 0.21.0' # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder gem 'jbuilder', '~> 2.7' @@ -43,7 +44,7 @@ gem 'jquery-ui-rails' # Had to clone to make nested search work in where filter gem 'liquid', path: './project_gems/liquid-5.0.1' -gem 'mongoid', '~> 7.3.3' +gem 'mongoid', '~> 8.1.0' gem 'mongoid-locker' gem 'prawn', '~> 2.2' @@ -51,27 +52,23 @@ gem 'prawn-templates', '~> 0.1.2' gem 'pundit', '~> 2.1.0' -gem 'puma', '~> 5.0' +gem 'puma', '~> 6.0' # Use SCSS for stylesheets -gem 'rails', '~> 6.1.4' +gem 'rails', '~> 7.2' # Use Puma as the app server gem 'resource_registry', git: 'https://github.com/ideacrew/resource_registry.git', - branch: 'trunk' + ref: '846050d' # not merged yet # gem 'resource_registry', path: '../resource_registry' -gem 'roo', '~> 2.7.0' +gem 'roo', '~> 2.10.1' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' -gem 'sass-rails', '>= 6' +gem 'sass-rails', '>= 6' # This is required for ckeditor-4 gem. -# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker -# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks -gem 'turbolinks', '~> 5' - -gem 'webpacker', '~> 5.0' +gem 'shakapacker', '~> 7.0' # Use Redis adapter to run Action Cable in production # gem 'redis', '~> 4.0' # Use Active Model has_secure_password @@ -89,9 +86,9 @@ group :development, :test do gem 'database_cleaner-mongoid' gem 'factory_bot_rails' gem 'pry-byebug', require: false - gem 'rspec-rails', '~> 5.0' + gem 'rspec-rails', '~> 7.0' gem 'shoulda-matchers', '~> 3' - gem 'yard' + gem 'yard', '0.9.36' gem 'rubocop-git' end @@ -105,13 +102,13 @@ group :development do # Display performance information such as SQL time and flame graphs for each request in your browser. # Can be configured to work on production as well see: https://github.com/MiniProfiler/rack-mini-profiler/blob/master/README.md gem 'rack-mini-profiler', '~> 2.0', require: false - gem 'rubocop', require: false + gem 'rubocop', '~> 1.69.0' gem 'rubocop-rails', require: false gem 'rubocop-rake' gem 'rubocop-rspec' # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring - gem 'spring' + gem 'spring', '~> 4.2.1' # Access an interactive console on exception pages or by calling 'console' anywhere in the code. gem 'web-console', '>= 4.1.0' @@ -119,7 +116,7 @@ end group :production do gem 'eye', '0.10.0' - gem 'unicorn', '~> 4.8' + gem 'unicorn', '~> 6.1' end # Windows does not include zoneinfo files, so bundle the tzinfo-data gem diff --git a/Gemfile.lock b/Gemfile.lock index b9f8b5c6..ffac0255 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ GIT remote: https://github.com/ideacrew/aca_entities.git - revision: 5db1c3417d2b5e9d55ad93572f8142b386591006 - branch: trunk + revision: 0350721195d92a5026d2db7d196b9399dcfd2c07 + ref: 0350721 specs: aca_entities (0.10.0) deep_merge @@ -18,8 +18,8 @@ GIT GIT remote: https://github.com/ideacrew/event_source.git - revision: d108374e4df95a9dc61662052b06b0955e7b317d - branch: trunk + revision: 7530e5a51c740b2652d4fc825c9c43143e60f552 + ref: 7530e5a specs: event_source (0.6.0) addressable (>= 2.8.0) @@ -46,8 +46,8 @@ GIT GIT remote: https://github.com/ideacrew/resource_registry.git - revision: 920af75fa42eb25a04fd8bc17aec4d87df9b1211 - branch: trunk + revision: 846050db9dd98d29d522c05aa40fca96f099e429 + ref: 846050d specs: resource_registry (0.10.1) bootsnap (~> 1.0) @@ -83,65 +83,79 @@ GEM remote: https://rubygems.org/ specs: Ascii85 (2.0.1) - actioncable (6.1.7.10) - actionpack (= 6.1.7.10) - activesupport (= 6.1.7.10) + actioncable (7.2.3.1) + actionpack (= 7.2.3.1) + activesupport (= 7.2.3.1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (6.1.7.10) - actionpack (= 6.1.7.10) - activejob (= 6.1.7.10) - activerecord (= 6.1.7.10) - activestorage (= 6.1.7.10) - activesupport (= 6.1.7.10) - mail (>= 2.7.1) - actionmailer (6.1.7.10) - actionpack (= 6.1.7.10) - actionview (= 6.1.7.10) - activejob (= 6.1.7.10) - activesupport (= 6.1.7.10) - mail (~> 2.5, >= 2.5.4) - rails-dom-testing (~> 2.0) - actionpack (6.1.7.10) - actionview (= 6.1.7.10) - activesupport (= 6.1.7.10) - rack (~> 2.0, >= 2.0.9) + zeitwerk (~> 2.6) + actionmailbox (7.2.3.1) + actionpack (= 7.2.3.1) + activejob (= 7.2.3.1) + activerecord (= 7.2.3.1) + activestorage (= 7.2.3.1) + activesupport (= 7.2.3.1) + mail (>= 2.8.0) + actionmailer (7.2.3.1) + actionpack (= 7.2.3.1) + actionview (= 7.2.3.1) + activejob (= 7.2.3.1) + activesupport (= 7.2.3.1) + mail (>= 2.8.0) + rails-dom-testing (~> 2.2) + actionpack (7.2.3.1) + actionview (= 7.2.3.1) + activesupport (= 7.2.3.1) + cgi + nokogiri (>= 1.8.5) + racc + rack (>= 2.2.4, < 3.3) + rack-session (>= 1.0.1) rack-test (>= 0.6.3) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (6.1.7.10) - actionpack (= 6.1.7.10) - activerecord (= 6.1.7.10) - activestorage (= 6.1.7.10) - activesupport (= 6.1.7.10) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + useragent (~> 0.16) + actiontext (7.2.3.1) + actionpack (= 7.2.3.1) + activerecord (= 7.2.3.1) + activestorage (= 7.2.3.1) + activesupport (= 7.2.3.1) + globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (6.1.7.10) - activesupport (= 6.1.7.10) + actionview (7.2.3.1) + activesupport (= 7.2.3.1) builder (~> 3.1) - erubi (~> 1.4) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (6.1.7.10) - activesupport (= 6.1.7.10) + cgi + erubi (~> 1.11) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + activejob (7.2.3.1) + activesupport (= 7.2.3.1) globalid (>= 0.3.6) - activemodel (6.1.7.10) - activesupport (= 6.1.7.10) - activerecord (6.1.7.10) - activemodel (= 6.1.7.10) - activesupport (= 6.1.7.10) - activestorage (6.1.7.10) - actionpack (= 6.1.7.10) - activejob (= 6.1.7.10) - activerecord (= 6.1.7.10) - activesupport (= 6.1.7.10) + activemodel (7.2.3.1) + activesupport (= 7.2.3.1) + activerecord (7.2.3.1) + activemodel (= 7.2.3.1) + activesupport (= 7.2.3.1) + timeout (>= 0.4.0) + activestorage (7.2.3.1) + actionpack (= 7.2.3.1) + activejob (= 7.2.3.1) + activerecord (= 7.2.3.1) + activesupport (= 7.2.3.1) marcel (~> 1.0) - mini_mime (>= 1.1.0) - activesupport (6.1.7.10) - concurrent-ruby (~> 1.0, >= 1.0.2) + activesupport (7.2.3.1) + base64 + benchmark (>= 0.3) + bigdecimal + concurrent-ruby (~> 1.0, >= 1.3.1) + connection_pool (>= 2.2.5) + drb i18n (>= 1.6, < 2) - minitest (>= 5.1) - tzinfo (~> 2.0) - zeitwerk (~> 2.3) + logger (>= 1.4.2) + minitest (>= 5.1, < 6) + securerandom (>= 0.3) + tzinfo (~> 2.0, >= 2.0.5) addressable (2.8.7) public_suffix (>= 2.0.2, < 7.0) afm (0.2.2) @@ -149,11 +163,12 @@ GEM ast (2.4.3) base64 (0.3.0) bcrypt (3.1.20) + benchmark (0.5.0) bigdecimal (3.2.2) bindex (0.8.1) bootsnap (1.18.6) msgpack (~> 1.2) - bson (5.1.1) + bson (5.2.0) builder (3.3.0) bunny (2.24.0) amq-protocol (~> 2.3) @@ -180,6 +195,7 @@ GEM timers (>= 4.1.1) celluloid-supervision (0.20.6) timers (>= 4.1.1) + cgi (0.5.1) ckeditor (4.2.4) cocaine orm_adapter (~> 0.5.0) @@ -198,9 +214,10 @@ GEM matrix ruby-rc4 (>= 0.1.5) concurrent-ruby (1.3.5) - config (2.2.3) + config (5.6.1) deep_merge (~> 1.2, >= 1.2.1) - dry-validation (~> 1.0, >= 1.0.0) + ostruct + connection_pool (3.0.2) crack (1.0.0) bigdecimal rexml @@ -210,7 +227,7 @@ GEM database_cleaner-mongoid (2.0.1) database_cleaner-core (~> 2.0.0) mongoid - date (3.4.1) + date (3.5.1) deep_merge (1.2.2) devise (4.9.4) bcrypt (~> 3.0) @@ -221,6 +238,7 @@ GEM devise-security (0.18.0) devise (>= 4.3.0) diff-lcs (1.6.2) + drb (2.2.3) dry-configurable (0.16.1) dry-core (~> 0.6) zeitwerk (~> 2.6) @@ -272,6 +290,7 @@ GEM dry-core (~> 0.5, >= 0.5) dry-initializer (~> 3.0) dry-schema (~> 1.8, >= 1.8.0) + erb (6.0.2) erubi (1.13.1) ethon (0.16.0) ffi (>= 1.15.0) @@ -303,7 +322,7 @@ GEM faraday_middleware (1.2.1) faraday (~> 1.0) ffi (1.17.2-arm64-darwin) - globalid (1.2.1) + globalid (1.3.0) activesupport (>= 6.1) haml (6.3.0) temple (>= 0.8.2) @@ -316,13 +335,18 @@ GEM railties (>= 5.1) hashdiff (1.2.0) hashery (2.1.2) - httparty (0.23.1) - csv + httparty (0.21.0) mini_mime (>= 1.0.0) multi_xml (>= 0.5.2) i18n (1.14.7) concurrent-ruby (~> 1.0) ice_nine (0.11.2) + io-console (0.8.2) + irb (1.17.0) + pp (>= 0.6.0) + prism (>= 1.3.0) + rdoc (>= 4.0.0) + reline (>= 0.4.2) iso_country_codes (0.7.8) jbuilder (2.13.0) actionview (>= 5.0.0) @@ -333,6 +357,7 @@ GEM thor (>= 0.14, < 2.0) jquery-ui-rails (8.0.0) railties (>= 3.2.16) + json (2.19.2) json-schema (5.2.1) addressable (~> 2.8) bigdecimal (~> 3.1) @@ -350,6 +375,7 @@ GEM kaminari-core (1.2.2) kgio (2.11.4) kostya-sigar (2.0.11) + language_server-protocol (3.17.0.5) listen (3.9.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) @@ -361,12 +387,13 @@ GEM loofah (2.24.1) crass (~> 1.0.2) nokogiri (>= 1.12.0) - mail (2.8.1) + mail (2.9.0) + logger mini_mime (>= 0.1.1) net-imap net-pop net-smtp - marcel (1.0.4) + marcel (1.1.0) matrix (0.4.3) method_source (1.1.0) mime-types (3.7.0) @@ -374,21 +401,24 @@ GEM mime-types-data (~> 3.2025, >= 3.2025.0507) mime-types-data (3.2025.0722) mini_mime (1.1.5) + mini_portile2 (2.8.9) minitest (5.25.5) - mongo (2.21.2) + mongo (2.23.0) base64 bson (>= 4.14.1, < 6.0.0) - mongoid (7.3.5) - activemodel (>= 5.1, < 7.1, != 7.0.0) - mongo (>= 2.10.5, < 3.0.0) + mongoid (8.1.12) + activemodel (>= 5.1, < 8.1, != 7.0.0) + concurrent-ruby (>= 1.0.5, < 2.0) + mongo (>= 2.18.0, < 3.0.0) ruby2_keywords (~> 0.0.5) mongoid-locker (2.2.0) mongoid (>= 5.0, < 10) msgpack (1.8.0) multi_json (1.15.0) - multi_xml (0.6.0) + multi_xml (0.8.1) + bigdecimal (>= 3.1, < 5) multipart-post (2.4.1) - net-imap (0.4.22) + net-imap (0.6.3) date net-protocol net-pop (0.1.2) @@ -398,7 +428,8 @@ GEM net-smtp (0.5.1) net-protocol nio4r (2.7.4) - nokogiri (1.15.7-arm64-darwin) + nokogiri (1.15.7) + mini_portile2 (~> 2.8.2) racc (~> 1.4) nokogiri-happymapper (0.9.0) nokogiri (~> 1.5) @@ -409,8 +440,9 @@ GEM ostruct (0.6.3) ox (2.14.23) bigdecimal (>= 3.0) + package_json (0.2.0) parallel (1.27.0) - parser (3.3.8.0) + parser (3.3.10.2) ast (~> 2.4.1) racc pdf-core (0.10.0) @@ -420,6 +452,8 @@ GEM hashery (~> 2.0) ruby-rc4 ttfunk + pp (0.6.3) + prettyprint prawn (2.5.0) matrix (~> 0.4) pdf-core (~> 0.10.0) @@ -427,15 +461,19 @@ GEM prawn-templates (0.1.2) pdf-reader (~> 2.0) prawn (~> 2.2) - prism (1.4.0) + prettyprint (0.2.0) + prism (1.9.0) pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) pry-byebug (3.10.1) byebug (~> 11.0) pry (>= 0.13, < 0.15) + psych (5.3.1) + date + stringio public_suffix (5.1.1) - puma (5.6.9) + puma (6.6.1) nio4r (~> 2.0) pundit (2.1.1) activesupport (>= 3.0.0) @@ -445,23 +483,27 @@ GEM rack (>= 1.2.0) rack-proxy (0.7.7) rack + rack-session (1.0.2) + rack (< 3) rack-test (2.2.0) rack (>= 1.3) - rails (6.1.7.10) - actioncable (= 6.1.7.10) - actionmailbox (= 6.1.7.10) - actionmailer (= 6.1.7.10) - actionpack (= 6.1.7.10) - actiontext (= 6.1.7.10) - actionview (= 6.1.7.10) - activejob (= 6.1.7.10) - activemodel (= 6.1.7.10) - activerecord (= 6.1.7.10) - activestorage (= 6.1.7.10) - activesupport (= 6.1.7.10) + rackup (1.0.1) + rack (< 3) + webrick + rails (7.2.3.1) + actioncable (= 7.2.3.1) + actionmailbox (= 7.2.3.1) + actionmailer (= 7.2.3.1) + actionpack (= 7.2.3.1) + actiontext (= 7.2.3.1) + actionview (= 7.2.3.1) + activejob (= 7.2.3.1) + activemodel (= 7.2.3.1) + activerecord (= 7.2.3.1) + activestorage (= 7.2.3.1) + activesupport (= 7.2.3.1) bundler (>= 1.15.0) - railties (= 6.1.7.10) - sprockets-rails (>= 2.0.0) + railties (= 7.2.3.1) rails-dom-testing (2.3.0) activesupport (>= 5.0.0) minitest @@ -469,12 +511,16 @@ GEM rails-html-sanitizer (1.6.2) loofah (~> 2.21) nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) - railties (6.1.7.10) - actionpack (= 6.1.7.10) - activesupport (= 6.1.7.10) - method_source + railties (7.2.3.1) + actionpack (= 7.2.3.1) + activesupport (= 7.2.3.1) + cgi + irb (~> 1.13) + rackup (>= 1.0.0) rake (>= 12.2) - thor (~> 1.0) + thor (~> 1.0, >= 1.2.2) + tsort (>= 0.2) + zeitwerk (~> 2.6) rainbow (3.1.1) raindrops (0.20.1) rake (12.3.3) @@ -484,43 +530,50 @@ GEM rbnacl (7.1.2) ffi (~> 1) rbtree (0.4.6) - regexp_parser (2.10.0) + rdoc (7.2.0) + erb + psych (>= 4.0.0) + tsort + regexp_parser (2.11.3) + reline (0.6.3) + io-console (~> 0.5) responders (3.1.1) actionpack (>= 5.2) railties (>= 5.2) rexml (3.4.1) - roo (2.7.1) + roo (2.10.1) nokogiri (~> 1) - rubyzip (~> 1.1, < 2.0.0) - rspec-core (3.13.5) + rubyzip (>= 1.3.0, < 3.0.0) + rspec-core (3.13.6) rspec-support (~> 3.13.0) rspec-expectations (3.13.5) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - rspec-mocks (3.13.5) + rspec-mocks (3.13.8) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - rspec-rails (5.1.2) - actionpack (>= 5.2) - activesupport (>= 5.2) - railties (>= 5.2) - rspec-core (~> 3.10) - rspec-expectations (~> 3.10) - rspec-mocks (~> 3.10) - rspec-support (~> 3.10) - rspec-support (3.13.4) - rubocop (1.21.0) + rspec-rails (7.1.1) + actionpack (>= 7.0) + activesupport (>= 7.0) + railties (>= 7.0) + rspec-core (~> 3.13) + rspec-expectations (~> 3.13) + rspec-mocks (~> 3.13) + rspec-support (~> 3.13) + rspec-support (3.13.7) + rubocop (1.69.2) + json (~> 2.3) + language_server-protocol (>= 3.17.0) parallel (~> 1.10) - parser (>= 3.0.0.0) + parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 1.8, < 3.0) - rexml - rubocop-ast (>= 1.9.1, < 2.0) + regexp_parser (>= 2.9.3, < 3.0) + rubocop-ast (>= 1.36.2, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 3.0) - rubocop-ast (1.46.0) + unicode-display_width (>= 2.4.0, < 4.0) + rubocop-ast (1.49.1) parser (>= 3.3.7.2) - prism (~> 1.4) + prism (~> 1.7) rubocop-git (0.1.3) rubocop (>= 0.24.1) rubocop-rails (2.15.2) @@ -534,7 +587,7 @@ GEM ruby-progressbar (1.13.0) ruby-rc4 (0.1.5) ruby2_keywords (0.0.5) - rubyzip (1.3.0) + rubyzip (2.4.1) sass-rails (6.0.0) sassc-rails (~> 2.1, >= 2.1.1) sassc (2.4.0) @@ -545,10 +598,17 @@ GEM sprockets (> 3.0) sprockets-rails tilt - semantic_range (3.1.0) + securerandom (0.4.1) + semantic_range (3.1.1) serverengine (2.1.1) sigdump (~> 0.2.2) set (1.0.4) + shakapacker (7.2.3) + activesupport (>= 5.2) + package_json + rack-proxy (>= 0.6.1) + railties (>= 5.2) + semantic_range (>= 2.3.0) shoulda-matchers (3.1.3) activesupport (>= 4.0.0) sigdump (0.2.5) @@ -564,7 +624,7 @@ GEM sorted_set (1.0.3) rbtree set (~> 1.0) - spring (4.3.0) + spring (4.2.1) sprockets (4.2.2) concurrent-ruby (~> 1.0) logger @@ -574,27 +634,28 @@ GEM activesupport (>= 6.1) sprockets (>= 3.0.0) state_machines (0.5.0) + stringio (3.2.0) temple (0.10.3) terrapin (0.6.0) climate_control (>= 0.0.3, < 1.0) thor (1.4.0) tilt (2.6.1) - timeout (0.4.3) + timeout (0.6.1) timers (4.3.5) + tsort (0.2.0) ttfunk (1.8.0) bigdecimal (~> 3.1) - turbolinks (5.2.1) - turbolinks-source (~> 5.2) - turbolinks-source (5.2.0) typhoeus (1.4.1) ethon (>= 0.9.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - unicode-display_width (2.6.0) - unicorn (4.9.0) + unicode-display_width (3.2.0) + unicode-emoji (~> 4.1) + unicode-emoji (4.2.0) + unicorn (6.1.0) kgio (~> 2.6) - rack raindrops (~> 0.7) + useragent (0.16.11) warden (1.2.9) rack (>= 2.0.9) web-console (4.2.1) @@ -606,11 +667,7 @@ GEM addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) - webpacker (5.4.4) - activesupport (>= 5.2) - rack-proxy (>= 0.6.1) - railties (>= 5.2) - semantic_range (>= 2.3.0) + webrick (1.9.2) websocket-driver (0.8.0) base64 websocket-extensions (>= 0.1.0) @@ -619,19 +676,20 @@ GEM activesupport ostruct wkhtmltopdf-binary-edge (0.12.3.0) - yard (0.9.37) + yard (0.9.36) zeitwerk (2.6.18) PLATFORMS - arm64-darwin-24 + arm64-darwin-25 DEPENDENCIES aca_entities! - bootsnap (>= 1.4.4) + bootsnap (>= 1.10.3) byebug ckeditor (~> 4.2.4) combine_pdf (~> 1.0) - config (~> 2.0) + config (~> 5.1) + csv database_cleaner-mongoid devise (~> 4.8) devise-security @@ -646,45 +704,44 @@ DEPENDENCIES event_source! eye (= 0.10.0) factory_bot_rails - httparty (~> 0.16) + httparty (~> 0.21.0) jbuilder (~> 2.7) jquery-rails (~> 4.3) jquery-ui-rails liquid! listen (~> 3.3) - mongoid (~> 7.3.3) + mongoid (~> 8.1.0) mongoid-locker prawn (~> 2.2) prawn-templates (~> 0.1.2) pry-byebug - puma (~> 5.0) + puma (~> 6.0) pundit (~> 2.1.0) rack-mini-profiler (~> 2.0) - rails (~> 6.1.4) + rails (~> 7.2) resource_registry! - roo (~> 2.7.0) - rspec-rails (~> 5.0) - rubocop (~> 1.21.0) + roo (~> 2.10.1) + rspec-rails (~> 7.0) + rubocop (~> 1.69.0) rubocop-git rubocop-rails rubocop-rake rubocop-rspec sass-rails (>= 6) + shakapacker (~> 7.0) shoulda-matchers (~> 3) sneakers (~> 2.12) - spring - turbolinks (~> 5) + spring (~> 4.2.1) tzinfo-data - unicorn (~> 4.8) + unicorn (~> 6.1) web-console (>= 4.1.0) webmock - webpacker (~> 5.0) wicked_pdf (~> 2.1) wkhtmltopdf-binary-edge (~> 0.12.3.0) - yard + yard (= 0.9.36) RUBY VERSION - ruby 2.7.8p225 + ruby 3.4.2p28 BUNDLED WITH 2.4.22 diff --git a/app/controllers/new/templates_controller.rb b/app/controllers/new/templates_controller.rb index f2272136..5eed48df 100644 --- a/app/controllers/new/templates_controller.rb +++ b/app/controllers/new/templates_controller.rb @@ -158,7 +158,7 @@ def upload_notices @notice_kinds = Templates::TemplateModel.all @datatable = Effective::Datatables::NoticesDatatable.new - render action: 'index' + redirect_to action: :index end def fetch_tokens diff --git a/app/controllers/templates_controller.rb b/app/controllers/templates_controller.rb index 933bc0a8..d58ec7a0 100644 --- a/app/controllers/templates_controller.rb +++ b/app/controllers/templates_controller.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true # TemplatesController -class TemplatesController < ::ApplicationController +class TemplatesController < ApplicationController include ::DataTablesAdapter # include ::DataTablesSearch # before_action :check_hbx_staff_role diff --git a/app/entities/blocks/block.rb b/app/entities/blocks/block.rb index a3c65a28..f8b366f8 100644 --- a/app/entities/blocks/block.rb +++ b/app/entities/blocks/block.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true module Blocks + # block class Block < Dry::Struct attribute :key, Types::String attribute :type, Types::String diff --git a/app/entities/bodies/body.rb b/app/entities/bodies/body.rb index 09c23857..72da012c 100644 --- a/app/entities/bodies/body.rb +++ b/app/entities/bodies/body.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true module Bodies + # body class Body < Dry::Struct attribute :markup, Types::Any.meta(omittable: false) attribute :encoding_type, Types::String.optional.meta(omittable: true) diff --git a/app/entities/sections/section.rb b/app/entities/sections/section.rb index 264da401..cc233bf5 100644 --- a/app/entities/sections/section.rb +++ b/app/entities/sections/section.rb @@ -85,7 +85,7 @@ def flatten_map # Strip any Mondoid-managed attributes from hash def sanitize_attributes(params) - params.reject { |k, _v| Polypress::Types::MONGOID_PRIVATE_KEYS.include?(k) } + params.except(*Polypress::Types::MONGOID_PRIVATE_KEYS) end end end diff --git a/app/entities/templates/template.rb b/app/entities/templates/template.rb index 8cc8495e..7a21a39d 100644 --- a/app/entities/templates/template.rb +++ b/app/entities/templates/template.rb @@ -115,7 +115,7 @@ def update_model(record_id) # Strip any Mondoid-managed attributes from hash def sanitize_attributes - to_h.reject { |k, _v| Polypress::Types::MONGOID_PRIVATE_KEYS.include?(k) } + to_h.except(*Polypress::Types::MONGOID_PRIVATE_KEYS) end end end diff --git a/app/event_source/subscribers/reports/pre_audit_report_generation_subscriber.rb b/app/event_source/subscribers/reports/pre_audit_report_generation_subscriber.rb index b3207e17..1133c3a8 100644 --- a/app/event_source/subscribers/reports/pre_audit_report_generation_subscriber.rb +++ b/app/event_source/subscribers/reports/pre_audit_report_generation_subscriber.rb @@ -31,7 +31,6 @@ class PreAuditReportGenerationSubscriber ) nack(delivery_info.delivery_tag) end - rescue Exception => e logger.error( "Exception: :on_receive_report_generation_event\n Exception: #{e.inspect}" + diff --git a/app/event_source/subscribers/reports/pre_audit_report_processor_subscriber.rb b/app/event_source/subscribers/reports/pre_audit_report_processor_subscriber.rb index 8ef68da0..dc5e3287 100644 --- a/app/event_source/subscribers/reports/pre_audit_report_processor_subscriber.rb +++ b/app/event_source/subscribers/reports/pre_audit_report_processor_subscriber.rb @@ -26,7 +26,6 @@ class PreAuditReportProcessorSubscriber ) nack(delivery_info.delivery_tag) end - rescue Exception => e logger.error( "Exception: :on_generate_recon_preaudit_report\n Exception: #{e.inspect}" + diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 02bbd458..dc33a481 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -4,20 +4,15 @@ module ApplicationHelper def format_flash(name, msg) return unless msg.is_a?(String) + alert_type = name.to_s == 'notice' ? 'alert-success' : 'alert-danger' - content_tag( - :div, - "#{msg} \n" + - tag.button( - nil, - type: 'button', - class: 'btn-close', - 'data-bs-dismiss': 'alert', - 'aria-label': 'Close' - ), - class: %W[alert #{alert_type} alert-dismissible fade show], - role: 'alert' - ) + + content_tag(:div, class: ['alert', alert_type, 'alert-dismissible', 'fade', 'show'], role: 'alert') do + safe_join([ + msg, + tag.button('', type: 'button', class: 'btn-close', 'data-bs-dismiss': 'alert', 'aria-label': 'Close') + ]) + end end def prepend_glyph_to_text(template) diff --git a/app/javascript/packs/application.js b/app/javascript/packs/application.js index 5b691c0d..38c18190 100644 --- a/app/javascript/packs/application.js +++ b/app/javascript/packs/application.js @@ -3,10 +3,12 @@ // a relevant structure within app/javascript and only use these pack files to reference // that code so it'll be compiled. -import Rails from "rails-ujs"; -import Turbolinks from "turbolinks"; +import Rails from "@rails/ujs"; +import "@hotwired/turbo-rails"; import "channels"; +import * as bootstrap from "bootstrap"; + // JS import "../js/bootstrap_js_files"; @@ -14,18 +16,27 @@ import "../js/bootstrap_js_files"; const images = require.context("../images", true); const imagePath = (name) => images(name, true); -import "jquery"; -import "jquery-ui"; -import "popper.js"; - +import $ from "jquery"; window.jQuery = $; window.$ = $; + Rails.start(); -Turbolinks.start(); - -// import "css/polypress"; -// import "css/datatable_custom_filter"; -// import "css/effective_datatable"; -// import "datatables/datatable_custom_filter.js"; -// import "bootstrap"; -import "@fortawesome/fontawesome-free/css/all"; \ No newline at end of file + +import "@fortawesome/fontawesome-free/css/all.css"; +import "../stylesheets/application.scss"; + +$.fn.tab = function (action) { + return this.each(function () { + const tabInstance = bootstrap.Tab.getOrCreateInstance(this); + if (action === "show") tabInstance.show(); + }); +}; + +$.fn.modal = function (action) { + return this.each(function () { + const modalInstance = bootstrap.Modal.getOrCreateInstance(this); + if (action === "show") modalInstance.show(); + else if (action === "hide") modalInstance.hide(); + else if (action === "toggle") modalInstance.toggle(); + }); +}; diff --git a/app/javascript/packs/application.scss b/app/javascript/packs/application.scss deleted file mode 100644 index fefc1f11..00000000 --- a/app/javascript/packs/application.scss +++ /dev/null @@ -1 +0,0 @@ -@import "../stylesheets/site"; \ No newline at end of file diff --git a/app/javascript/stylesheets/application.scss b/app/javascript/stylesheets/application.scss new file mode 100644 index 00000000..8f0e6d7c --- /dev/null +++ b/app/javascript/stylesheets/application.scss @@ -0,0 +1,3 @@ +@import "variables/colors"; +@import "~bootstrap/scss/bootstrap"; +@import "datatable_custom_filter"; diff --git a/app/javascript/stylesheets/signin.scss b/app/javascript/stylesheets/signin.scss deleted file mode 100644 index 38b98a9b..00000000 --- a/app/javascript/stylesheets/signin.scss +++ /dev/null @@ -1,55 +0,0 @@ -// html, -// body { -// height: 100%; -// } - -// body { -// display: flex; -// align-items: center; -// padding-top: 40px; -// padding-bottom: 40px; -// background-color: #f5f5f5; -// } - -// .form-login, -// .form-signup { -// width: 100%; -// max-width: 330px; -// padding: 15px; -// margin: auto; -// } - -// .form-login, -// .form-signup .checkbox { -// font-weight: 400; -// } - -// .form-login, -// .form-signup .form-floating:focus-within { -// z-index: 2; -// } - -// .form-login, -// .form-signup input[type="email"] { -// margin-bottom: -1px; -// border-bottom-right-radius: 0; -// border-bottom-left-radius: 0; -// } - -// .form-login input[type="password"] { -// margin-bottom: 10px; -// border-top-left-radius: 0; -// border-top-right-radius: 0; -// } - -// .form-signup input[type="password"] { -// margin-bottom: -1px; -// border-top-left-radius: 0; -// border-top-right-radius: 0; -// } - -// .form-signup #floating_password_confirm { -// margin-bottom: 10px; -// border-top-left-radius: 0; -// border-top-right-radius: 0; -// } diff --git a/app/javascript/stylesheets/site.scss b/app/javascript/stylesheets/site.scss deleted file mode 100644 index a8045def..00000000 --- a/app/javascript/stylesheets/site.scss +++ /dev/null @@ -1,21 +0,0 @@ -@import "variables/colors"; -// @import "signin"; -// inside app/frontend/packs/application.scss -// Import all Bootstrap v5 -@import "~bootstrap/scss/bootstrap"; -@import "datatable_custom_filter"; -// Include parts of Bootstrap -// // 1. Include functions first (so you can manipulate colors, SVGs, calc, etc) -// @import "~/bootstrap/scss/functions"; -// // 3. Include remainder of required Bootstrap stylesheets -// @import "~/bootstrap/scss/variables"; -// @import "~/bootstrap/scss/mixins"; -// // 4. Include any optional Bootstrap components as you like -// @import "~/bootstrap/scss/root"; -// @import "~/bootstrap/scss/reboot"; -// @import "~/bootstrap/scss/type"; -// @import "~/bootstrap/scss/images"; -// @import "~/bootstrap/scss/containers"; -// @import "~/bootstrap/scss/grid"; -// // 5. Add additional custom code here -// @import "../stylesheets/signin"; \ No newline at end of file diff --git a/app/liquid/tags/gist_tag.rb b/app/liquid/tags/gist_tag.rb index b415d288..94b0e661 100644 --- a/app/liquid/tags/gist_tag.rb +++ b/app/liquid/tags/gist_tag.rb @@ -4,8 +4,7 @@ module Tags # GistTag class GistTag < Tags::LiquidTagBase PARTIAL = 'liquids/gist' - VALID_LINK_REGEXP = %r{\Ahttps://gist\.github\.com/([a-zA-Z0-9](-?[a-zA-Z0-9]){0,38})/([a-zA-Z0-9]){1,32}(/[a-zA-Z0-9]+)?\Z} - .freeze + VALID_LINK_REGEXP = %r{\Ahttps://gist\.github\.com/([a-zA-Z0-9](-?[a-zA-Z0-9]){0,38})/([a-zA-Z0-9]){1,32}(/[a-zA-Z0-9]+)?\Z}.freeze def initialize(_tag_name, link, _parse_context) super diff --git a/app/models/account.rb b/app/models/account.rb index 618b8b80..e3995a89 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -1,5 +1,6 @@ # frozen_string_literal: true +# Account class Account include Mongoid::Document # Include default devise modules. Others available are: diff --git a/app/models/effective/datatables/notices_datatable.rb b/app/models/effective/datatables/notices_datatable.rb index 62f3e403..dbe1f00e 100644 --- a/app/models/effective/datatables/notices_datatable.rb +++ b/app/models/effective/datatables/notices_datatable.rb @@ -20,18 +20,12 @@ class NoticesDatatable < Effective::MongoidDatatable table_column :title, :proc => proc { |row| link_to row.title, preview_template_path(row), target: '_blank' }, :filter => false, :sortable => false - table_column :doc_type, :proc => proc { |row| - row.doc_type - }, :filter => false, :sortable => false - table_column :description, :proc => proc { |row| - row.description - }, :filter => false, :sortable => false + table_column :doc_type, :proc => proc(&:doc_type), :filter => false, :sortable => false + table_column :description, :proc => proc(&:description), :filter => false, :sortable => false table_column :recipient, :proc => proc { |row| row.recipient_klass_name.to_s.titleize }, :filter => false, :sortable => false - table_column :key, :proc => proc { |row| - row.key - }, :filter => false, :sortable => true + table_column :key, :proc => proc(&:key), :filter => false, :sortable => true table_column :last_updated_at, :proc => proc { |row| row.updated_at.in_time_zone('Eastern Time (US & Canada)').strftime('%m/%d/%Y %H:%M') }, :filter => false, :sortable => false diff --git a/app/models/entities/templates/main.rb b/app/models/entities/templates/main.rb index 45f278d0..974c64be 100644 --- a/app/models/entities/templates/main.rb +++ b/app/models/entities/templates/main.rb @@ -2,6 +2,7 @@ module Entities module Templates + # main class Main < Dry::Struct # @!attribute [r] sections diff --git a/app/models/notice_builder.rb b/app/models/notice_builder.rb index bc98f3b1..f2c02858 100644 --- a/app/models/notice_builder.rb +++ b/app/models/notice_builder.rb @@ -524,14 +524,12 @@ def notice_type end def valid_resource? - (employee? || consumer? || employer?) + employee? || consumer? || employer? end def sub_resource? - ( - resource.is_a?(EmployeeRole) || resource.is_a?(BrokerRole) || - resource.is_a?(ConsumerRole) - ) + resource.is_a?(EmployeeRole) || resource.is_a?(BrokerRole) || + resource.is_a?(ConsumerRole) end def envelope diff --git a/app/models/notice_kind.rb b/app/models/notice_kind.rb index 3ede19b0..86b81c38 100644 --- a/app/models/notice_kind.rb +++ b/app/models/notice_kind.rb @@ -51,7 +51,7 @@ class NoticeKind attr_accessor :resource, :payload def tokens - template.raw_body.scan(/\#\{([\w|.\s+\-]*)\}/).flatten.reject {|element| element.scan(/Settings/).any?}.uniq.map(&:strip) + template.raw_body.scan(/\#\{([\w|.\s+\-]*)\}/).flatten.reject {|element| element.scan('Settings').any?}.uniq.map(&:strip) end def conditional_tokens @@ -70,7 +70,7 @@ def set_data_elements iterator_subloop_tokens = [] loop_tokens = [] loop_iterators = conditional_tokens.inject([]) do |iterators, conditional_token| - iterators unless conditional_token.match(/(.+)\.each/i) + return iterators unless conditional_token.match(/(.+)\.each/i) loop_match = conditional_token.match(/\|(.+)\|/i) if loop_match.present? loop_token = conditional_token.match(/(.+)\.each/i)[1] diff --git a/app/models/pdf_report.rb b/app/models/pdf_report.rb index f7811079..3f64e804 100644 --- a/app/models/pdf_report.rb +++ b/app/models/pdf_report.rb @@ -7,7 +7,7 @@ class PdfReport < Prawn::Document def initialize(options = {}) options.merge!(:margin => [50, 70]) if options[:margin].nil? - super(options) + super font "Times-Roman" font_size 12 @@ -23,7 +23,7 @@ def footer def text(text, options = {}) options.merge!({ :align => :justify }) unless options.key?(:align) - super text, options + super end def subheading(sub_heading) diff --git a/app/models/services/token_builder.rb b/app/models/services/token_builder.rb index 18c4f797..ab9b6606 100644 --- a/app/models/services/token_builder.rb +++ b/app/models/services/token_builder.rb @@ -44,16 +44,12 @@ def sections end def placeholders - placeholders = [] - - [:if, :iterator, :tablerow, :comment].each do |type| - placeholders << { + [:if, :iterator, :tablerow, :comment].map do |type| + { title: type.to_s.titleize, type: type } end - - placeholders end def editor_tokens diff --git a/app/models/templates/template_model.rb b/app/models/templates/template_model.rb index 9be8e4b4..5b7ccbc8 100644 --- a/app/models/templates/template_model.rb +++ b/app/models/templates/template_model.rb @@ -161,13 +161,13 @@ def conditional_tokens body.scan(/\[\[([\s|\w.?]*)/).flatten.map(&:strip).collect do |ele| ele.gsub(/\w+/) { |m| keywords.fetch(m, m) } end.map(&:strip) - .reject(&:blank?) - .uniq + .reject(&:blank?) + .uniq end def tokens body.scan(/\#\{([\w|.\s+\-]*)\}/).flatten.reject do |element| - element.scan(/Settings/).any? + element.scan('Settings').any? end.uniq.map(&:strip) end diff --git a/app/operations/documents/cartafact_helpers.rb b/app/operations/documents/cartafact_helpers.rb index 157affd7..c9b47e93 100644 --- a/app/operations/documents/cartafact_helpers.rb +++ b/app/operations/documents/cartafact_helpers.rb @@ -8,7 +8,7 @@ def encoded_payload(payload) end def fetch_secret_key - Rails.application.secrets.secret_key_base + PolypressRegistry[:secret_key_base].item end def fetch_url diff --git a/app/operations/reports/generate_rcno_report.rb b/app/operations/reports/generate_rcno_report.rb index b1e39f22..582445a6 100644 --- a/app/operations/reports/generate_rcno_report.rb +++ b/app/operations/reports/generate_rcno_report.rb @@ -981,7 +981,7 @@ def insert_data # rubocop:enable Metrics/MethodLength def insert_total_record_data - ["02", @rcni_row[1], "----------".gsub(/-/, " "), + ["02", @rcni_row[1], "----------".gsub('-', " "), @rcni_row[3], @rcni_row[4], @rcni_row[5], @rcni_row[6], @total_number_of_issuer_records, @total_subscribers, @total_dependents, format('%.2f', @total_premium_amount), diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 6ef78fd9..df89c71e 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -6,11 +6,11 @@ <%= favicon_link_tag Settings.site.tab_icon, :rel => 'shortcut icon', :type => 'image/vnd.microsoft.icon' %> - Polypress - <%= csrf_meta_tags %> - <%= csp_meta_tag %> - <%= stylesheet_pack_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> - <%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %> + Polypress + <%= csrf_meta_tags %> + <%= csp_meta_tag %> + <%= stylesheet_pack_tag 'application', media: 'all', 'data-turbo-track': 'reload' %> + <%= javascript_pack_tag 'application', 'data-turbo-track': 'reload' %> @@ -20,7 +20,7 @@
-
+
<%= render 'layouts/flash' %>
diff --git a/app/views/layouts/single_column.html.erb b/app/views/layouts/single_column.html.erb index 0a535643..8873c34e 100644 --- a/app/views/layouts/single_column.html.erb +++ b/app/views/layouts/single_column.html.erb @@ -8,8 +8,8 @@ <%= content_for?(:title) ? yield(:title) : "Welcome to DC HealthLink" %> - <%= stylesheet_pack_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> - <%= javascript_pack_tag "application", 'data-turbolinks-track': 'reload' %> + <%= stylesheet_pack_tag 'application', media: 'all', 'data-turbo-track': 'reload' %> + <%= javascript_pack_tag "application", 'data-turbo-track': 'reload' %> <%= csrf_meta_tags %> diff --git a/app/views/new/sections/_form.html.erb b/app/views/new/sections/_form.html.erb index 0d84eafa..c503dc49 100644 --- a/app/views/new/sections/_form.html.erb +++ b/app/views/new/sections/_form.html.erb @@ -1,7 +1,7 @@

<%= section.persisted? ? 'Edit' : 'Create' %> Section

- <%= form_with scope: :section, url: new_sections_path(section.id), method: :post do |f| %> + <%= form_with scope: :section, url: new_sections_path(section.id), method: :post, data: { turbo: false, remote: false } do |f| %> - <%= form_with scope: :section, url: "/new/sections/#{@section.id}", method: :put do |f| %> + <%= form_with scope: :section, url: "/new/sections/#{@section.id}", method: :put, data: { turbo: false, remote: false } do |f| %>
<%= render(:partial => 'edit_form', :locals => { section: @section, f: f }) %> @@ -36,10 +36,10 @@
<% end %>
-
+
- <%= link_to 'Cancel', new_templates_path, class: "btn btn-secondary" %> + <%= link_to 'Cancel', new_templates_path, class: "btn btn-secondary", data: { turbo: false } %>
@@ -130,19 +130,21 @@ }); } - $('#instant_preview').click(function(e) { - $.ajax({ - type:"POST", - url: "/new/sections/instant_preview", - // dataType: 'json', - data: { body: CKEDITOR.instances.section_body_markup.getData(), key: $('#section_key').val(), title: $('#section_title').val(), marketplace: $('#section_marketplace').val()}, - success: function(result){ - } + document.addEventListener('turbo:load', function() { + $('#instant_preview').click(function(e) { + $.ajax({ + type:"POST", + url: "/new/sections/instant_preview", + // dataType: 'json', + data: { body: CKEDITOR.instances.section_body_markup.getData(), key: $('#section_key').val(), title: $('#section_title').val(), marketplace: $('#section_marketplace').val()}, + success: function(result){ + } + }) }) - }) - $(document).ready(function() { - updateCkEditor(); - }); + $(document).ready(function() { + updateCkEditor(); + }); + }) \ No newline at end of file diff --git a/app/views/new/templates/_new_form.html.erb b/app/views/new/templates/_new_form.html.erb index fe5c857b..89cbde4b 100644 --- a/app/views/new/templates/_new_form.html.erb +++ b/app/views/new/templates/_new_form.html.erb @@ -1,21 +1,19 @@
-

- <%= template.persisted? ? 'Edit' : 'Create' %> Template

+

<%= template.persisted? ? 'Edit' : 'Create' %> Template

- <%#= form_for [:new, template], as: :template do |f| %> - <%= form_with scope: :template, url: new_templates_path(template.id), method: :post do |f| %> - + <%= form_with scope: :template, url: new_templates_path(template.id), method: :post, data: {turbo: false, remote: false} do |f| %> + - <%= render(:partial => 'form', :locals => { template: template, f: f }) %> + <%= render(:partial => 'form', :locals => { template: template, f: f }) %> -
- - <%= link_to 'Cancel', new_templates_path, class: "btn btn-secondary" %> -
- <% end %> +
+ + <%= link_to 'Cancel', new_templates_path, class: "btn btn-secondary" %> +
+ <% end %>
-
\ No newline at end of file +
diff --git a/app/views/new/templates/_templates.html.erb b/app/views/new/templates/_templates.html.erb index a239814d..faefab80 100644 --- a/app/views/new/templates/_templates.html.erb +++ b/app/views/new/templates/_templates.html.erb @@ -66,15 +66,15 @@
<%= form_tag(upload_notices_new_templates_path, multipart: true, method: :post) do %> - + - + <% end %>
-
\ No newline at end of file + diff --git a/app/views/new/templates/edit.html.erb b/app/views/new/templates/edit.html.erb index 7c44ff7b..5ccfb488 100644 --- a/app/views/new/templates/edit.html.erb +++ b/app/views/new/templates/edit.html.erb @@ -18,38 +18,39 @@ - <%= form_with scope: :template, url: "/new/templates/#{@template.id}", method: :put do |f| %> -
+ <%= form_with scope: :template, url: "/new/templates/#{@template.id}", method: :put, data: { turbo: false, remote: false } do |f| %> +
<%= render(:partial => 'form', :locals => { template: @template, f: f }) %>
+ <%= f.fields_for :body do |body_form| %> -
+
-
-
- <%= body_form.cktext_area :markup, value: @template.body.markup, class: 'notice_template form-control' %> -
+
+
+ <%= body_form.cktext_area :markup, value: @template.body.markup, class: 'notice_template form-control' %>
+
-
+
<% end %> -
+
-
-
- - <%= link_to 'Cancel', new_templates_path, class: "btn btn-secondary" %> - -
+
+
+ + <%= link_to 'Cancel', new_templates_path, class: "btn btn-secondary", data: { turbo: false } %> +
+
-
@@ -136,48 +137,50 @@ }); } - $('#instant_preview').click(function(e) { - $.ajax({ - type:"POST", - url: "/new/templates/instant_preview", - // dataType: 'json', - data: { - body: CKEDITOR.instances.template_body_markup.getData(), - subject: $('#print_code').val(), - key: $('#key').val(), - title: $('#title').val(), - marketplace: $('#template_marketplace').val(), - recipient: $('#template_recipient').val() - }, - success: function(result){ - } + document.addEventListener('turbo:load', function() { + $('#instant_preview').click(function(e) { + $.ajax({ + type:"POST", + url: "/new/templates/instant_preview", + // dataType: 'json', + data: { + body: CKEDITOR.instances.template_body_markup.getData(), + subject: $('#print_code').val(), + key: $('#key').val(), + title: $('#title').val(), + marketplace: $('#template_marketplace').val(), + recipient: $('#template_recipient').val() + }, + success: function(result){ + } + }) }) - }) - $('#template_marketplace').change(function() { - $.ajax({ - type:"GET", - url:"/new/templates/fetch_recipients", - dataType:"json", - data: {market_kind: $('#template_marketplace').val()}, - complete:function(result){ - var select = $('#template_recipient'); - select.empty(); - - $.each( result.responseJSON.recipients, function( key, value ) { - select.append(""); - }); - updateCkEditor(); - } + $('#template_marketplace').change(function() { + $.ajax({ + type:"GET", + url:"/new/templates/fetch_recipients", + dataType:"json", + data: {market_kind: $('#template_marketplace').val()}, + complete:function(result){ + var select = $('#template_recipient'); + select.empty(); + + $.each( result.responseJSON.recipients, function( key, value ) { + select.append(""); + }); + updateCkEditor(); + } + }) }) - }) - $('#template_recipient').change(function() { - updateCkEditor(); - }) + $('#template_recipient').change(function() { + updateCkEditor(); + }) - $(document).ready(function() { - updateCkEditor(); + $(document).ready(function() { + updateCkEditor(); + }); }); diff --git a/app/views/new/templates/index.html.erb b/app/views/new/templates/index.html.erb index ba61dd2f..faa83fd6 100644 --- a/app/views/new/templates/index.html.erb +++ b/app/views/new/templates/index.html.erb @@ -38,18 +38,20 @@ \ No newline at end of file diff --git a/app/views/shared/_nav_bar.html.erb b/app/views/shared/_nav_bar.html.erb index 75825e64..2d80c290 100644 --- a/app/views/shared/_nav_bar.html.erb +++ b/app/views/shared/_nav_bar.html.erb @@ -1,6 +1,6 @@