diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000000..3606776e3b --- /dev/null +++ b/.editorconfig @@ -0,0 +1,17 @@ +# EditorConfig is awesome: https://EditorConfig.org + +# top-most EditorConfig file +root = true + +# Unix-style newlines with a newline ending every file +[*] +end_of_line = lf +insert_final_newline = true + + +# Matches multiple files with brace expansion notation +# Set default charset +[*.{js,rb,erb}] +charset = utf-8 +indent_style = space +indent_size = 2 \ No newline at end of file diff --git a/.env.mysql2 b/.env.mysql2 new file mode 100644 index 0000000000..78e7d04490 --- /dev/null +++ b/.env.mysql2 @@ -0,0 +1,48 @@ +# DMPRoadmap dotenv file + +# Rails log level +RAILS_LOG_LEVEL=debug +# Whether or not Rails should log to STDOUT. If false it will log to `./logs/[env].log` +RAILS_LOG_TO_STDOUT=true +# Whether or not Rails will be serving your static assets +RAILS_SERVE_STATIC_FILES=false +# Maximum number of Puma threads +RAILS_MAX_THREADS=5 +# Maximum number of Puma workers +WEB_CONCURRENCY=2 +# The port puma will use to host the Rails app +PORT=3000 + +# Rails 6.1+ has a white-list of valid domains. You must set this for your production env! +DMPROADMAP_HOST=localhost + +# The location of the wkhtmltopdf app. Once bundler has installed it, you can find it with +# `which wkhtmltopdf` on linux/osx systems. +WICKED_PDF_PATH=/usr/local/bin/wkhtmltopdf + +# Database settings. +DB_ADAPTER=mysql2 +DB_HOST=localhost +DB_PORT=3306 +DB_POOL_SIZE=16 +DB_NAME=roadmap + +# Whether or not the Dragonfly gem should use AWS S3 to store logos. If 'false' the logos will +# be stored on the local disk. If true, you must provide the `AWS_` prefixed values. +DRAGONFLY_AWS=false +AWS_REGION= +AWS_BUCKET_NAME= + +# If you have a Rollbar account and want to redcord errors there, add your token here +ROLLBAR_ACCESS_TOKEN= +ROLLBAR_ENV= + +# Translation IO variables. The Domain can be either `app` or `client` and is typically defined +# when running `bin/rails translations:sync DOMAIN=app`. `client` will use any of your +# customized content in ./app/views/branded and `app` is for the core roadmap translations. +# Include your Translation.io API key for the appropriate domains: +# app => TRANSLATION_API_ROADMAP +# client => TRANSLATION_API_CLIENT +# DOMAIN=app +# TRANSLATION_API_ROADMAP= +# TRANSLATION_API_CLIENT= diff --git a/.env.postgresql b/.env.postgresql new file mode 100644 index 0000000000..d6570a81ce --- /dev/null +++ b/.env.postgresql @@ -0,0 +1,48 @@ +# DMPRoadmap dotenv file + +# Rails log level +RAILS_LOG_LEVEL=debug +# Whether or not Rails should log to STDOUT. If false it will log to `./logs/[env].log` +RAILS_LOG_TO_STDOUT=true +# Whether or not Rails will be serving your static assets +RAILS_SERVE_STATIC_FILES=false +# Maximum number of Puma threads +RAILS_MAX_THREADS=5 +# Maximum number of Puma workers +WEB_CONCURRENCY=2 +# The port puma will use to host the Rails app +PORT=3000 + +# Rails 6.1+ has a white-list of valid domains. You must set this for your production env! +DMPROADMAP_HOST=localhost + +# The location of the wkhtmltopdf app. Once bundler has installed it, you can find it with +# `which wkhtmltopdf` on linux/osx systems. +WICKED_PDF_PATH=/usr/local/bin/wkhtmltopdf + +# Database settings. +DB_ADAPTER=postgresql +DB_HOST=localhost +DB_PORT=5432 +DB_POOL_SIZE=16 +DB_NAME=roadmap + +# Whether or not the Dragonfly gem should use AWS S3 to store logos. If 'false' the logos will +# be stored on the local disk. If true, you must provide the `AWS_` prefixed values. +DRAGONFLY_AWS=false +AWS_REGION= +AWS_BUCKET_NAME= + +# If you have a Rollbar account and want to redcord errors there, add your token here +ROLLBAR_ACCESS_TOKEN= +ROLLBAR_ENV= + +# Translation IO variables. The Domain can be either `app` or `client` and is typically defined +# when running `bin/rails translations:sync DOMAIN=app`. `client` will use any of your +# customized content in ./app/views/branded and `app` is for the core roadmap translations. +# Include your Translation.io API key for the appropriate domains: +# app => TRANSLATION_API_ROADMAP +# client => TRANSLATION_API_CLIENT +DOMAIN=app +TRANSLATION_API_ROADMAP= +TRANSLATION_API_CLIENT= diff --git a/.github/workflows/brakeman.yml b/.github/workflows/brakeman.yml index 3ec6812cdd..a9e037de4a 100644 --- a/.github/workflows/brakeman.yml +++ b/.github/workflows/brakeman.yml @@ -8,7 +8,7 @@ on: jobs: brakeman: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/eslint.yml b/.github/workflows/eslint.yml index 0a9756355d..ac13cdc40a 100644 --- a/.github/workflows/eslint.yml +++ b/.github/workflows/eslint.yml @@ -5,7 +5,7 @@ on: [push, pull_request] jobs: eslint: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: # Checkout the repo diff --git a/.github/workflows/mysql.yml b/.github/workflows/mysql.yml index 6cc54855ec..722690cc6c 100644 --- a/.github/workflows/mysql.yml +++ b/.github/workflows/mysql.yml @@ -4,7 +4,7 @@ on: [pull_request] jobs: mysql: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 # Define environment variables for MySQL and Rails env: @@ -28,15 +28,16 @@ jobs: cache: 'yarn' # Copy all of the example configs over - - name: 'Setup Default Configuration' + - name: 'Setup the application' run: | cp config/database.yml.sample config/database.yml cp config/initializers/contact_us.rb.example config/initializers/contact_us.rb cp config/initializers/wicked_pdf.rb.example config/initializers/wicked_pdf.rb + cp .env.mysql2 .env # Stub out the Rails credentials file so that we can start the Rails app - name: 'Setup Credentials' - run: EDITOR='echo "$(cat config/credentials.yml.example)" >' bundle exec rails credentials:edit + run: EDITOR='echo "$(cat config/credentials.yml.mysql2)" >' bundle exec rails credentials:edit # Set the path to the wkhtmltopdf executable - name: 'Determine wkhtmltopdf location' diff --git a/.github/workflows/postgres.yml b/.github/workflows/postgres.yml index 7d5c3978a1..1a866315b3 100644 --- a/.github/workflows/postgres.yml +++ b/.github/workflows/postgres.yml @@ -4,7 +4,7 @@ on: [pull_request] jobs: postgresql: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 services: # Postgres installation @@ -55,12 +55,13 @@ jobs: cp config/database.yml.sample config/database.yml cp config/initializers/contact_us.rb.example config/initializers/contact_us.rb cp config/initializers/wicked_pdf.rb.example config/initializers/wicked_pdf.rb + cp .env.postgresql .env # Stub out the Rails credentials file so that we can start the Rails app - name: 'Setup Credentials' run: | # generate a default credential file and key - EDITOR='echo "$(cat config/credentials.yml.example)" >' bundle exec rails credentials:edit + EDITOR='echo "$(cat config/credentials.yml.postgresql)" >' bundle exec rails credentials:edit # Set the path to the wkhtmltopdf executable - name: 'Determine wkhtmltopdf location' diff --git a/.github/workflows/rubocop.yml b/.github/workflows/rubocop.yml index 57e84481cc..e88e953abe 100644 --- a/.github/workflows/rubocop.yml +++ b/.github/workflows/rubocop.yml @@ -4,7 +4,7 @@ on: [push, pull_request] jobs: rubocop: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: # Checkout the repo diff --git a/Gemfile b/Gemfile index 4406242641..b66c3e792d 100644 --- a/Gemfile +++ b/Gemfile @@ -272,7 +272,7 @@ group :test do gem 'capybara' gem 'selenium-webdriver' # Easy installation and use of web drivers to run system tests with browsers - gem 'webdrivers' + gem 'webdrivers', '~> 5.2' # Automatically create snapshots when Cucumber steps fail with Capybara # and Rails (http://github.com/mattheworiordan/capybara-screenshot) diff --git a/Gemfile.lock b/Gemfile.lock index 575e507936..9c48ed2690 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -47,7 +47,7 @@ GEM activerecord (6.1.7) activemodel (= 6.1.7) activesupport (= 6.1.7) - activerecord_json_validator (2.1.1) + activerecord_json_validator (2.1.3) activerecord (>= 4.2.0, < 8) json_schemer (~> 0.2.18) activestorage (6.1.7) @@ -82,11 +82,11 @@ GEM bindex (0.8.1) binding_of_caller (1.0.0) debug_inspector (>= 0.0.1) - bootsnap (1.13.0) + bootsnap (1.15.0) msgpack (~> 1.2) - brakeman (5.3.1) + brakeman (5.4.0) builder (3.2.4) - bullet (7.0.3) + bullet (7.0.4) activesupport (>= 3.0.0) uniform_notifier (~> 1.11) bundle-audit (0.1.0) @@ -95,7 +95,7 @@ GEM bundler (>= 1.2.0, < 3) thor (~> 1.0) byebug (11.1.3) - capybara (3.37.1) + capybara (3.38.0) addressable matrix mini_mime (>= 0.1.3) @@ -104,14 +104,8 @@ GEM rack-test (>= 0.6.3) regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) - capybara-webmock (0.6.0) - capybara (>= 2.4, < 4) - rack (>= 1.4) - rack-proxy (>= 0.6.0) - rexml (>= 3.2) - selenium-webdriver (~> 3.0) - webrick (>= 1.7) - childprocess (3.0.0) + capybara-webmock (0.1.0) + childprocess (4.1.0) coderay (1.1.3) concurrent-ruby (1.1.10) contact_us (1.2.0) @@ -150,19 +144,19 @@ GEM ecma-re-validator (0.4.0) regexp_parser (~> 2.2) erubi (1.11.0) - excon (0.93.1) + excon (0.94.0) execjs (2.8.1) factory_bot (6.2.1) activesupport (>= 5.0.0) factory_bot_rails (6.2.0) factory_bot (~> 6.2.0) railties (>= 5.0.0) - faker (2.23.0) + faker (3.0.0) i18n (>= 1.8.11, < 2) - faraday (2.6.0) + faraday (2.7.1) faraday-net_http (>= 2.0, < 3.1) ruby2_keywords (>= 0.0.4) - faraday-net_http (3.0.1) + faraday-net_http (3.0.2) ffi (1.15.5) flag_shih_tzu (0.3.23) fog-aws (3.15.0) @@ -220,7 +214,7 @@ GEM actionview (>= 5.0.0) activesupport (>= 5.0.0) json (2.6.2) - json_schemer (0.2.21) + json_schemer (0.2.23) ecma-re-validator (~> 0.3) hana (~> 1.3) regexp_parser (~> 2.0) @@ -261,13 +255,16 @@ GEM rake mini_mime (1.1.2) minitest (5.16.3) - mocha (1.16.0) + mocha (2.0.2) + ruby2_keywords (>= 0.0.5) msgpack (1.6.0) multi_json (1.15.0) multi_xml (0.6.0) mysql2 (0.5.4) nenv (0.3.0) nio4r (2.5.8) + nokogiri (1.13.9-arm64-darwin) + racc (~> 1.4) nokogiri (1.13.9-x86_64-linux) racc (~> 1.4) notiffany (0.1.3) @@ -298,9 +295,9 @@ GEM options (2.3.2) orm_adapter (0.5.0) parallel (1.22.1) - parser (3.1.2.1) + parser (3.1.3.0) ast (~> 2.4.1) - pg (1.4.4) + pg (1.4.5) prime (0.1.2) forwardable singleton @@ -315,13 +312,13 @@ GEM nio4r (~> 2.0) pundit (2.2.0) activesupport (>= 3.0.0) - pundit-matchers (1.7.0) + pundit-matchers (1.8.4) rspec-rails (>= 3.0.0) racc (1.6.0) rack (2.2.4) rack-mini-profiler (3.0.0) rack (>= 1.2.0) - rack-protection (3.0.2) + rack-protection (3.0.4) rack rack-proxy (0.7.4) rack @@ -364,7 +361,7 @@ GEM ffi (~> 1.0) recaptcha (5.12.3) json - regexp_parser (2.6.0) + regexp_parser (2.6.1) responders (3.0.1) actionpack (>= 5.0) railties (>= 5.0) @@ -372,14 +369,14 @@ GEM rollbar (3.3.2) rspec-collection_matchers (1.2.0) rspec-expectations (>= 2.99.0.beta1) - rspec-core (3.11.0) - rspec-support (~> 3.11.0) - rspec-expectations (3.11.1) + rspec-core (3.12.0) + rspec-support (~> 3.12.0) + rspec-expectations (3.12.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.11.0) - rspec-mocks (3.11.1) + rspec-support (~> 3.12.0) + rspec-mocks (3.12.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.11.0) + rspec-support (~> 3.12.0) rspec-rails (6.0.1) actionpack (>= 6.1) activesupport (>= 6.1) @@ -388,8 +385,8 @@ GEM rspec-expectations (~> 3.11) rspec-mocks (~> 3.11) rspec-support (~> 3.11) - rspec-support (3.11.1) - rubocop (1.37.1) + rspec-support (3.12.0) + rubocop (1.39.0) json (~> 2.3) parallel (~> 1.10) parser (>= 3.1.2.1) @@ -417,9 +414,11 @@ GEM sprockets (> 3.0) sprockets-rails tilt - selenium-webdriver (3.142.7) - childprocess (>= 0.5, < 4.0) - rubyzip (>= 1.2.2) + selenium-webdriver (4.6.1) + childprocess (>= 0.5, < 5.0) + rexml (~> 3.2, >= 3.2.5) + rubyzip (>= 1.2.2, < 3.0) + websocket (~> 1.0) semantic_range (3.0.0) shellany (0.0.1) shoulda (4.0.0) @@ -449,7 +448,7 @@ GEM thor (1.2.1) tilt (2.0.11) tomparse (0.4.2) - translation (1.32) + translation (1.34) gettext (~> 3.2, >= 3.2.5, <= 3.4.3) turbo-rails (1.3.2) actionpack (>= 6.0.0) @@ -468,10 +467,10 @@ GEM activemodel (>= 6.0.0) bindex (>= 0.4.0) railties (>= 6.0.0) - webdrivers (4.7.0) + webdrivers (5.2.0) nokogiri (~> 1.6) rubyzip (>= 1.3.0) - selenium-webdriver (> 3.141, < 5.0) + selenium-webdriver (~> 4.0) webmock (3.18.1) addressable (>= 2.8.0) crack (>= 0.3.2) @@ -482,6 +481,7 @@ GEM railties (>= 5.2) semantic_range (>= 2.3.0) webrick (1.7.0) + websocket (1.2.9) websocket-driver (0.7.5) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) @@ -495,9 +495,10 @@ GEM yard-tomdoc (0.7.1) tomparse (>= 0.4.0) yard - zeitwerk (2.6.1) + zeitwerk (2.6.6) PLATFORMS + arm64-darwin-22 x86_64-linux DEPENDENCIES @@ -568,7 +569,7 @@ DEPENDENCIES translation turbo-rails web-console - webdrivers + webdrivers (~> 5.2) webmock webpacker wicked_pdf @@ -580,4 +581,4 @@ RUBY VERSION ruby 2.7.6p219 BUNDLED WITH - 2.3.15 + 2.3.25 diff --git a/app/models/concerns/exportable_plan.rb b/app/models/concerns/exportable_plan.rb index 7936eaffd3..f754802a8d 100644 --- a/app/models/concerns/exportable_plan.rb +++ b/app/models/concerns/exportable_plan.rb @@ -161,7 +161,6 @@ def prepare_coversheet_for_csv(csv, _headings, hash) csv << [_('Contributor: '), format(_('%{other}'), other: hash[:other].map(&:name).join(', '))] end csv << [_('Affiliation: '), format(_('%{affiliation}'), affiliation: hash[:affiliation])] - csv << ['Affiliation: ', format(_('%{affiliation}'), affiliation: hash[:affiliation])] csv << if hash[:funder].present? [_('Template: '), format(_('%{funder}'), funder: hash[:funder])] else diff --git a/app/models/user/at_csv.rb b/app/models/user/at_csv.rb index 81d79bc1c2..8cddb0f74e 100644 --- a/app/models/user/at_csv.rb +++ b/app/models/user/at_csv.rb @@ -4,8 +4,8 @@ class User # Helper to export a list of Users as CSV class AtCsv - HEADERS = ['Name', 'E-Mail', 'Created Date', 'Last Activity', 'Plans', - 'Current Privileges', 'Active', 'Department'].freeze + HEADERS = [_('Name'), _('E-Mail'), _('Created Date'), _('Last Activity'), _('Plans'), + _('Current Privileges'), _('Active'), _('Department')].freeze def initialize(users) @users = users diff --git a/app/presenters/guidance_presenter.rb b/app/presenters/guidance_presenter.rb index d015be1b46..b268d34935 100644 --- a/app/presenters/guidance_presenter.rb +++ b/app/presenters/guidance_presenter.rb @@ -121,8 +121,8 @@ def guidance_groups_by_theme(org: nil, question: nil) return {} unless hashified_guidance_groups.key?(org) - hashified_guidance_groups[org].each_key.each_with_object({}) do |gg, acc| - filtered_gg = hashified_guidance_groups[org][gg].each_key.each_with_object({}) do |theme, ac| + hashified_guidance_groups[org].each_key.with_object({}) do |gg, acc| + filtered_gg = hashified_guidance_groups[org][gg].each_key.with_object({}) do |theme, ac| next unless question.themes.include?(theme) ac[theme] = hashified_guidance_groups[org][gg][theme] diff --git a/app/views/contributors/_form.html.erb b/app/views/contributors/_form.html.erb index e848cc8cd6..4c9ef30562 100644 --- a/app/views/contributors/_form.html.erb +++ b/app/views/contributors/_form.html.erb @@ -80,7 +80,8 @@ roles_tooltip = _("Select each role that applies to the contributor.") <%= form.check_box hash.keys.first.to_sym, value: hash.values.first, data: { toggle: "tooltip" }, - title: ContributorPresenter.role_tooltip(symbol: hash.keys.first) %> + title: ContributorPresenter.role_tooltip(symbol: hash.keys.first), + aria: { label: ContributorPresenter.role_symbol_to_string(symbol: hash.keys.first) } %> <%= ContributorPresenter.role_symbol_to_string(symbol: hash.keys.first) %> diff --git a/app/views/guidance_groups/_guidance_group_form.html.erb b/app/views/guidance_groups/_guidance_group_form.html.erb index a0384f0095..b5bd06bd25 100644 --- a/app/views/guidance_groups/_guidance_group_form.html.erb +++ b/app/views/guidance_groups/_guidance_group_form.html.erb @@ -5,20 +5,20 @@ published_tip = _("Check this box when you are ready for guidance associated wit subset_tip = _("If the guidance is only meant for a subset of users e.g. those in a specific college or institute, check this box. Users will be able to select to display this subset guidance when answering questions in the 'create plan' wizard.") %>
<%= _('To help you write your plan, %{application_name} can show you guidance from a variety of organisations.') % { application_name: app_name } %>
<%= _("Click below to give data management staff at #{plan.owner.org.name}, the Plan Owner's org, access to read and comment on your plan.") %>
++ <%= + _("Click below to give data management staff at %{owner_org}, the Plan Owner's org, access to read and comment on your plan.") % { + owner_org: plan.owner.org.name, + } + %> +
<%= _('Public or organisational visibility is intended for finished plans. You must answer at least %{percentage}%% of the questions to enable these options. Note: test plans are set to private visibility by default.') % { :percentage => Rails.configuration.x.plans.default_percentage_answered } %>
<% allow_visibility = @plan.visibility_allowed? %> <%= form_with model: @plan, id: "set_visibility" do |f| %>