diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index ea91fbb0..557a4b1a 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -7,11 +7,12 @@ on: pull_request: env: - RUBY_VERSION: 2.7.6 + RUBY_VERSION: 3.0.5 + NODE_VERSION: 16.9.1 jobs: lint-report: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 with: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6619800a..5cd491e1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,11 +7,12 @@ on: pull_request: env: - RUBY_VERSION: 2.7.6 + RUBY_VERSION: 3.0.5 + NODE_VERSION: 16.9.1 jobs: test-report: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest services: postgres: @@ -39,6 +40,10 @@ jobs: ruby-version: ${{ env.RUBY_VERSION }} bundler-cache: true + - uses: actions/setup-node@master + with: + node-version: ${{ env.NODE_VERSION }} + - name: Setup Database run: bundle exec rake test_app diff --git a/.rubocop-disabled.yml b/.rubocop-disabled.yml new file mode 100644 index 00000000..de7949f8 --- /dev/null +++ b/.rubocop-disabled.yml @@ -0,0 +1,11 @@ +Style/OpenStructUse: + Enabled: false + +Gemspec/RequireMFA: + Enabled: false + +Naming/MemoizedInstanceVariableName: + Enabled: false + +RSpec/VerifiedDoubleReference: + Enabled: false diff --git a/.rubocop.yml b/.rubocop.yml index 870c0b9f..0975cd3a 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,3 +1,4 @@ inherit_from: - .rubocop_ruby.yml - .rubocop_rails.yml + - .rubocop-disabled.yml diff --git a/.rubocop_rails.yml b/.rubocop_rails.yml index 0cf3b441..3f9d1ccc 100644 --- a/.rubocop_rails.yml +++ b/.rubocop_rails.yml @@ -59,6 +59,7 @@ Rails/Output: - lib/**/*.rb Exclude: - db/seeds.rb + Rails/OutputSafety: Enabled: false @@ -85,3 +86,6 @@ Rails/SkipsModelValidations: Rails/Validation: Include: - app/models/**/*.rb + +Rails/CompactBlank: + Enabled: false diff --git a/.rubocop_ruby.yml b/.rubocop_ruby.yml index 59330388..657b0234 100644 --- a/.rubocop_ruby.yml +++ b/.rubocop_ruby.yml @@ -13,12 +13,13 @@ AllCops: - "**/Gemfile" - "**/Rakefile" Exclude: + - "**/node_modules/**/*" - "**/vendor/**/*" - "development_app/**/*" + - "decidim_app-design/node_modules/**/*" - "spec/decidim_dummy_app/**/*" - "node_modules/**/*" - - "db/migrate/*" - - "db/schema.rb" + - "decidim-initiatives/lib/gem_overrides/origami/date.rb" # Default formatter will be used if no -f/--format option is given. DefaultFormatter: progress # Cop names are not displayed in offense messages by default. Change behavior @@ -69,12 +70,12 @@ AllCops: # If a value is specified for TargetRubyVersion then it is used. # Else if .ruby-version exists and it contains an MRI version it is used. # Otherwise we fallback to the oldest officially supported Ruby version (2.0). - TargetRubyVersion: 2.7 + TargetRubyVersion: 3.0 - RSpec: - Patterns: - - "(?:^|/)spec/" - - "(?:^|/)test/" +# RSpec: +# Patterns: +# - "(?:^|/)spec/" +# - "(?:^|/)test/" # Indent private/protected/public as deep as method definitions Layout/AccessModifierIndentation: @@ -178,6 +179,15 @@ Layout/ParameterAlignment: # But it can be overridden by setting this parameter IndentationWidth: ~ +Style/ArrayCoercion: + Description: >- + Use Array() instead of explicit Array check or [*var], when dealing + with a variable you want to treat as an Array, but you're not certain it's an array. + StyleGuide: '#array-coercion' + Safe: false + Enabled: false + VersionAdded: '0.88' + Style/AndOr: # Whether `and` and `or` are banned only in conditionals (conditionals) # or completely (always). @@ -453,6 +463,7 @@ Naming/FileName: - "**/Gemfile" - "**/Rakefile" - "**/*.gemspec" + - "decidim-dev/lib/decidim-dev.rb" # When true, requires that each source file should define a class or module # with a name which matches the file name (converted to ... case). # It further expects it to be nested inside modules which match the names @@ -1220,7 +1231,7 @@ RSpec/ContextWording: RSpec/DescribeClass: Exclude: - spec/gemfiles_spec.rb - - spec/js_bundles_spec.rb + - spec/webpacker_spec.rb - spec/i18n_spec.rb - "**/*/spec/**/*_badge_spec.rb" - decidim-core/spec/lib/global_engines_spec.rb @@ -1250,6 +1261,8 @@ RSpec/MultipleExpectations: RSpec/MultipleMemoizedHelpers: Max: 35 + Exclude: + - decidim-assemblies/spec/forms/assembly_form_spec.rb RSpec/NestedGroups: Max: 7 @@ -1258,10 +1271,11 @@ RSpec/NamedSubject: Enabled: false RSpec/RepeatedExampleGroupDescription: - Enabled: false + Enabled: true RSpec/RepeatedExampleGroupBody: - Enabled: false + Enabled: true + RSpec/VerifiedDoubles: Enabled: false diff --git a/.ruby-version b/.ruby-version index 5b013b97..7da3c168 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.7.6 \ No newline at end of file +3.0.5 \ No newline at end of file diff --git a/.simplecov b/.simplecov index a58e5c4f..2e8bb475 100644 --- a/.simplecov +++ b/.simplecov @@ -1,13 +1,13 @@ # frozen_string_literal: true SimpleCov.start do - root ENV["ENGINE_ROOT"] + root ENV.fetch("ENGINE_ROOT", nil) add_filter "lib/decidim/participatory_documents/version.rb" add_filter "lib/decidim/participatory_documents/component.rb" add_filter "/spec" end -SimpleCov.command_name ENV["COMMAND_NAME"] || File.basename(Dir.pwd) +SimpleCov.command_name ENV.fetch("COMMAND_NAME", nil) || File.basename(Dir.pwd) SimpleCov.merge_timeout 1800 diff --git a/Gemfile.lock b/Gemfile.lock index ca4e2cf2..083b9cea 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,44 +1,46 @@ PATH remote: . specs: - decidim-participatory_documents (0.1.0) - decidim-core (>= 0.25.0, < 0.27) + decidim-participatory_documents (0.2.0) + decidim-core (>= 0.27.0, < 0.28) GEM remote: https://rubygems.org/ specs: - actioncable (6.0.5.1) - actionpack (= 6.0.5.1) + actioncable (6.1.7.4) + actionpack (= 6.1.7.4) + activesupport (= 6.1.7.4) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (6.0.5.1) - actionpack (= 6.0.5.1) - activejob (= 6.0.5.1) - activerecord (= 6.0.5.1) - activestorage (= 6.0.5.1) - activesupport (= 6.0.5.1) + actionmailbox (6.1.7.4) + actionpack (= 6.1.7.4) + activejob (= 6.1.7.4) + activerecord (= 6.1.7.4) + activestorage (= 6.1.7.4) + activesupport (= 6.1.7.4) mail (>= 2.7.1) - actionmailer (6.0.5.1) - actionpack (= 6.0.5.1) - actionview (= 6.0.5.1) - activejob (= 6.0.5.1) + actionmailer (6.1.7.4) + actionpack (= 6.1.7.4) + actionview (= 6.1.7.4) + activejob (= 6.1.7.4) + activesupport (= 6.1.7.4) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (6.0.5.1) - actionview (= 6.0.5.1) - activesupport (= 6.0.5.1) - rack (~> 2.0, >= 2.0.8) + actionpack (6.1.7.4) + actionview (= 6.1.7.4) + activesupport (= 6.1.7.4) + rack (~> 2.0, >= 2.0.9) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (6.0.5.1) - actionpack (= 6.0.5.1) - activerecord (= 6.0.5.1) - activestorage (= 6.0.5.1) - activesupport (= 6.0.5.1) + actiontext (6.1.7.4) + actionpack (= 6.1.7.4) + activerecord (= 6.1.7.4) + activestorage (= 6.1.7.4) + activesupport (= 6.1.7.4) nokogiri (>= 1.8.5) - actionview (6.0.5.1) - activesupport (= 6.0.5.1) + actionview (6.1.7.4) + activesupport (= 6.1.7.4) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) @@ -46,31 +48,33 @@ GEM active_link_to (1.0.5) actionpack addressable - activejob (6.0.5.1) - activesupport (= 6.0.5.1) + activejob (6.1.7.4) + activesupport (= 6.1.7.4) globalid (>= 0.3.6) - activemodel (6.0.5.1) - activesupport (= 6.0.5.1) - activerecord (6.0.5.1) - activemodel (= 6.0.5.1) - activesupport (= 6.0.5.1) - activestorage (6.0.5.1) - actionpack (= 6.0.5.1) - activejob (= 6.0.5.1) - activerecord (= 6.0.5.1) + activemodel (6.1.7.4) + activesupport (= 6.1.7.4) + activerecord (6.1.7.4) + activemodel (= 6.1.7.4) + activesupport (= 6.1.7.4) + activestorage (6.1.7.4) + actionpack (= 6.1.7.4) + activejob (= 6.1.7.4) + activerecord (= 6.1.7.4) + activesupport (= 6.1.7.4) marcel (~> 1.0) - activesupport (6.0.5.1) + mini_mime (>= 1.1.0) + activesupport (6.1.7.4) concurrent-ruby (~> 1.0, >= 1.0.2) - i18n (>= 0.7, < 2) - minitest (~> 5.1) - tzinfo (~> 1.1) - zeitwerk (~> 2.2, >= 2.2.2) + i18n (>= 1.6, < 2) + minitest (>= 5.1) + tzinfo (~> 2.0) + zeitwerk (~> 2.3) acts_as_list (0.9.19) activerecord (>= 3.0) - addressable (2.8.1) + addressable (2.8.4) public_suffix (>= 2.0.2, < 6.0) ast (2.4.2) - axe-core-api (4.4.1) + axe-core-api (4.7.0) dumb_delegator virtus axe-core-rspec (4.1.0) @@ -82,7 +86,7 @@ GEM ice_nine (~> 0.11.0) thread_safe (~> 0.3, >= 0.3.1) batch-loader (1.5.0) - bcrypt (3.1.18) + bcrypt (3.1.19) better_html (1.0.16) actionview (>= 4.0) activesupport (>= 4.0) @@ -92,12 +96,12 @@ GEM parser (>= 2.4) smart_properties bindex (0.8.1) - bootsnap (1.13.0) + bootsnap (1.16.0) msgpack (~> 1.2) browser (2.7.1) builder (3.2.4) byebug (11.1.3) - capybara (3.37.1) + capybara (3.39.2) addressable matrix mini_mime (>= 0.1.3) @@ -106,7 +110,7 @@ GEM rack-test (>= 0.6.3) regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) - carrierwave (2.2.2) + carrierwave (2.2.4) activemodel (>= 5.0.0) activesupport (>= 5.0.0) addressable (~> 2.6) @@ -126,9 +130,9 @@ GEM actionpack (>= 5.0) cells (>= 4.1.6, < 5.0.0) charlock_holmes (0.7.7) - chef-utils (17.10.0) + chef-utils (18.2.7) concurrent-ruby - childprocess (3.0.0) + childprocess (4.1.0) codecov (0.6.0) simplecov (>= 0.15, < 0.22) coercible (1.0.0) @@ -140,65 +144,67 @@ GEM coffee-script-source execjs coffee-script-source (1.12.2) - concurrent-ruby (1.1.10) + commonmarker (0.23.9) + concurrent-ruby (1.2.2) crack (0.4.5) rexml crass (1.0.6) - css_parser (1.11.0) + css_parser (1.14.0) addressable - date_validator (0.9.0) - activemodel - activesupport + date (3.3.3) + date_validator (0.12.0) + activemodel (>= 3) + activesupport (>= 3) db-query-matchers (0.10.0) activesupport (>= 4.0, < 7) rspec (~> 3.0) - decidim (0.26.2) - decidim-accountability (= 0.26.2) - decidim-admin (= 0.26.2) - decidim-api (= 0.26.2) - decidim-assemblies (= 0.26.2) - decidim-blogs (= 0.26.2) - decidim-budgets (= 0.26.2) - decidim-comments (= 0.26.2) - decidim-core (= 0.26.2) - decidim-debates (= 0.26.2) - decidim-forms (= 0.26.2) - decidim-generators (= 0.26.2) - decidim-meetings (= 0.26.2) - decidim-pages (= 0.26.2) - decidim-participatory_processes (= 0.26.2) - decidim-proposals (= 0.26.2) - decidim-sortitions (= 0.26.2) - decidim-surveys (= 0.26.2) - decidim-system (= 0.26.2) - decidim-templates (= 0.26.2) - decidim-verifications (= 0.26.2) - decidim-accountability (0.26.2) - decidim-comments (= 0.26.2) - decidim-core (= 0.26.2) - decidim-admin (0.26.2) + decidim (0.27.3) + decidim-accountability (= 0.27.3) + decidim-admin (= 0.27.3) + decidim-api (= 0.27.3) + decidim-assemblies (= 0.27.3) + decidim-blogs (= 0.27.3) + decidim-budgets (= 0.27.3) + decidim-comments (= 0.27.3) + decidim-core (= 0.27.3) + decidim-debates (= 0.27.3) + decidim-forms (= 0.27.3) + decidim-generators (= 0.27.3) + decidim-meetings (= 0.27.3) + decidim-pages (= 0.27.3) + decidim-participatory_processes (= 0.27.3) + decidim-proposals (= 0.27.3) + decidim-sortitions (= 0.27.3) + decidim-surveys (= 0.27.3) + decidim-system (= 0.27.3) + decidim-templates (= 0.27.3) + decidim-verifications (= 0.27.3) + decidim-accountability (0.27.3) + decidim-comments (= 0.27.3) + decidim-core (= 0.27.3) + decidim-admin (0.27.3) active_link_to (~> 1.0) - decidim-core (= 0.26.2) + decidim-core (= 0.27.3) devise (~> 4.7) devise-i18n (~> 1.2) devise_invitable (~> 2.0) - decidim-api (0.26.2) + decidim-api (0.27.3) graphql (~> 1.12, < 1.13) + graphql-docs (~> 2.1.0) rack-cors (~> 1.0) + decidim-assemblies (0.27.3) + decidim-core (= 0.27.3) + decidim-blogs (0.27.3) + decidim-admin (= 0.27.3) + decidim-comments (= 0.27.3) + decidim-core (= 0.27.3) + decidim-budgets (0.27.3) + decidim-comments (= 0.27.3) + decidim-core (= 0.27.3) + decidim-comments (0.27.3) + decidim-core (= 0.27.3) redcarpet (~> 3.5, >= 3.5.1) - decidim-assemblies (0.26.2) - decidim-core (= 0.26.2) - decidim-blogs (0.26.2) - decidim-admin (= 0.26.2) - decidim-comments (= 0.26.2) - decidim-core (= 0.26.2) - decidim-budgets (0.26.2) - decidim-comments (= 0.26.2) - decidim-core (= 0.26.2) - decidim-comments (0.26.2) - decidim-core (= 0.26.2) - redcarpet (~> 3.5, >= 3.5.1) - decidim-core (0.26.2) + decidim-core (0.27.3) active_link_to (~> 1.0) acts_as_list (~> 0.9) batch-loader (~> 1.2) @@ -207,17 +213,17 @@ GEM cells-erb (~> 0.1.0) cells-rails (~> 0.1.3) charlock_holmes (~> 0.7) - date_validator (~> 0.9.0) - decidim-api (= 0.26.2) + date_validator (~> 0.12.0) + decidim-api (= 0.27.3) devise (~> 4.7) devise-i18n (~> 1.2) diffy (~> 3.3) doorkeeper (~> 5.1) doorkeeper-i18n (~> 4.0) - file_validators (~> 2.1) + file_validators (~> 3.0) fog-local (~> 0.6) - foundation_rails_helper - geocoder (~> 1.7.5) + foundation_rails_helper (~> 4.0) + geocoder (~> 1.8) hashdiff (>= 0.4.0, < 2.0.0) invisible_captcha (~> 0.12) kaminari (~> 1.2, >= 1.2.1) @@ -236,117 +242,115 @@ GEM premailer-rails (~> 1.10) rack (~> 2.2, >= 2.2.3) rack-attack (~> 6.0) - rails (~> 6.0.4) + rails (~> 6.1.0) rails-i18n (~> 6.0) ransack (~> 2.4.1) - rectify (~> 0.13.0) redis (~> 4.1) request_store (~> 1.5.0) rubyXL (~> 3.4) rubyzip (~> 2.0) - searchlight (~> 4.1) seven_zip_ruby (~> 1.3) social-share-button (~> 1.2, >= 1.2.1) valid_email2 (~> 2.1) webpacker (= 6.0.0.rc.5) + webpush (~> 1.1) wisper (~> 2.0) - decidim-debates (0.26.2) - decidim-comments (= 0.26.2) - decidim-core (= 0.26.2) - decidim-dev (0.26.2) + decidim-debates (0.27.3) + decidim-comments (= 0.27.3) + decidim-core (= 0.27.3) + decidim-dev (0.27.3) axe-core-rspec (~> 4.1.0) byebug (~> 11.0) capybara (~> 3.24) db-query-matchers (~> 0.10.0) - decidim (= 0.26.2) + decidim (= 0.27.3) erb_lint (~> 0.0.35) factory_bot_rails (~> 4.8) i18n-tasks (~> 0.9.18) mdl (~> 0.5) - nokogiri (~> 1.12) + nokogiri (~> 1.13) + parallel_tests (~> 3.7) puma (~> 5.0) rails-controller-testing (~> 1.0) - rspec-cells (~> 0.3.4) + rspec-cells (~> 0.3.7) rspec-html-matchers (~> 0.9.1) rspec-rails (~> 4.0) rspec-retry (~> 0.6.2) rspec_junit_formatter (~> 0.3.0) - rubocop (~> 0.92.0) - rubocop-rails (~> 2.8) - rubocop-rspec (= 1.43.2) - selenium-webdriver (~> 3.142) - simplecov (~> 0.19.0) - simplecov-cobertura (~> 1.3.1) - system_test_html_screenshots (~> 0.2) + rubocop (~> 1.28.0) + rubocop-rails (~> 2.14) + rubocop-rspec (~> 2.10) + selenium-webdriver (~> 4.1.0) + simplecov (~> 0.21.0) + simplecov-cobertura (~> 2.1.0) w3c_rspec_validators (~> 0.3.0) webmock (~> 3.6) wisper-rspec (~> 1.0) - decidim-forms (0.26.2) - decidim-core (= 0.26.2) + decidim-forms (0.27.3) + decidim-core (= 0.27.3) wicked_pdf (~> 2.1) wkhtmltopdf-binary (~> 0.12) - decidim-generators (0.26.2) - decidim-core (= 0.26.2) - decidim-meetings (0.26.2) - decidim-core (= 0.26.2) - decidim-forms (= 0.26.2) + decidim-generators (0.27.3) + decidim-core (= 0.27.3) + decidim-meetings (0.27.3) + decidim-core (= 0.27.3) + decidim-forms (= 0.27.3) icalendar (~> 2.5) - decidim-pages (0.26.2) - decidim-core (= 0.26.2) - decidim-participatory_processes (0.26.2) - decidim-core (= 0.26.2) - decidim-proposals (0.26.2) - decidim-comments (= 0.26.2) - decidim-core (= 0.26.2) - doc2text (~> 0.4.4) + decidim-pages (0.27.3) + decidim-core (= 0.27.3) + decidim-participatory_processes (0.27.3) + decidim-core (= 0.27.3) + decidim-proposals (0.27.3) + decidim-comments (= 0.27.3) + decidim-core (= 0.27.3) + doc2text (~> 0.4.5) redcarpet (~> 3.5, >= 3.5.1) - decidim-sortitions (0.26.2) - decidim-admin (= 0.26.2) - decidim-comments (= 0.26.2) - decidim-core (= 0.26.2) - decidim-proposals (= 0.26.2) - decidim-surveys (0.26.2) - decidim-core (= 0.26.2) - decidim-forms (= 0.26.2) - decidim-templates (= 0.26.2) - decidim-system (0.26.2) + decidim-sortitions (0.27.3) + decidim-admin (= 0.27.3) + decidim-comments (= 0.27.3) + decidim-core (= 0.27.3) + decidim-proposals (= 0.27.3) + decidim-surveys (0.27.3) + decidim-core (= 0.27.3) + decidim-forms (= 0.27.3) + decidim-templates (= 0.27.3) + decidim-system (0.27.3) active_link_to (~> 1.0) - decidim-core (= 0.26.2) + decidim-core (= 0.27.3) devise (~> 4.7) devise-i18n (~> 1.2) devise_invitable (~> 2.0) - decidim-templates (0.26.2) - decidim-core (= 0.26.2) - decidim-forms (= 0.26.2) - decidim-verifications (0.26.2) - decidim-core (= 0.26.2) + decidim-templates (0.27.3) + decidim-core (= 0.27.3) + decidim-forms (= 0.27.3) + decidim-verifications (0.27.3) + decidim-core (= 0.27.3) declarative-builder (0.1.0) declarative-option (< 0.2.0) declarative-option (0.1.0) descendants_tracker (0.0.4) thread_safe (~> 0.3, >= 0.3.1) - devise (4.8.1) + devise (4.9.2) bcrypt (~> 3.0) orm_adapter (~> 0.1) railties (>= 4.1.0) responders warden (~> 1.2.3) - devise-i18n (1.10.2) - devise (>= 4.8.0) - devise_invitable (2.0.6) + devise-i18n (1.11.0) + devise (>= 4.9.0) + devise_invitable (2.0.8) actionmailer (>= 5.0) devise (>= 4.6) diff-lcs (1.5.0) diffy (3.4.2) - doc2text (0.4.5) - nokogiri (>= 1.13.2, < 1.14.0) + doc2text (0.4.6) + nokogiri (>= 1.13.2, < 1.15.0) rubyzip (~> 2.3.0) docile (1.4.0) - doorkeeper (5.5.4) + doorkeeper (5.6.6) railties (>= 5) doorkeeper-i18n (4.0.1) dumb_delegator (1.0.0) - equalizer (0.0.11) erb_lint (0.0.37) activesupport better_html (~> 1.0.7) @@ -357,9 +361,12 @@ GEM smart_properties erbse (0.1.4) temple - erubi (1.11.0) - excon (0.92.4) + erubi (1.12.0) + escape_utils (1.3.0) + excon (0.100.0) execjs (2.8.1) + extended-markdown-filter (0.7.0) + html-pipeline (~> 2.9) factory_bot (4.11.1) activesupport (>= 3.0.0) factory_bot_rails (4.11.1) @@ -367,12 +374,12 @@ GEM railties (>= 3.0.0) faker (2.23.0) i18n (>= 1.8.11, < 2) - faraday (2.5.2) + faraday (2.7.10) faraday-net_http (>= 2.0, < 3.1) ruby2_keywords (>= 0.0.4) - faraday-net_http (3.0.0) + faraday-net_http (3.0.2) ffi (1.15.5) - file_validators (2.3.0) + file_validators (3.0.0) activemodel (>= 3.2) mime-types (>= 1.0) fog-core (2.3.0) @@ -388,16 +395,29 @@ GEM activemodel (>= 4.1, < 7.1) activesupport (>= 4.1, < 7.1) railties (>= 4.1, < 7.1) - geocoder (1.7.5) - globalid (1.0.0) + gemoji (3.0.1) + geocoder (1.8.2) + globalid (1.1.0) activesupport (>= 5.0) graphql (1.12.24) + graphql-docs (2.1.0) + commonmarker (~> 0.16) + escape_utils (~> 1.2) + extended-markdown-filter (~> 0.4) + gemoji (~> 3.0) + graphql (~> 1.12) + html-pipeline (~> 2.9) + sass (~> 3.4) hashdiff (1.0.1) hashie (5.0.0) - highline (2.0.3) + highline (2.1.0) + hkdf (0.3.0) + html-pipeline (2.14.3) + activesupport (>= 2) + nokogiri (>= 1.4) html_tokenizer (0.0.7) htmlentities (4.3.4) - i18n (1.12.0) + i18n (1.14.1) concurrent-ruby (~> 1.0) i18n-tasks (0.9.37) activesupport (>= 4.0.2) @@ -418,8 +438,8 @@ GEM ruby-vips (>= 2.0.17, < 3) invisible_captcha (0.13.0) rails (>= 3.2.0) - json (2.6.2) - jwt (2.5.0) + json (2.6.3) + jwt (2.7.1) kaminari (1.2.2) activesupport (>= 4.1.0) kaminari-actionview (= 1.2.2) @@ -436,25 +456,28 @@ GEM rexml kramdown-parser-gfm (1.1.0) kramdown (~> 2.0) - launchy (2.5.0) - addressable (~> 2.7) + launchy (2.5.2) + addressable (~> 2.8) letter_opener (1.8.1) launchy (>= 2.2, < 3) letter_opener_web (1.4.1) actionmailer (>= 3.2) letter_opener (~> 1.0) railties (>= 3.2) - listen (3.7.1) + listen (3.8.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) loofah (2.3.1) crass (~> 1.0.2) nokogiri (>= 1.5.9) - mail (2.7.1) + mail (2.8.1) mini_mime (>= 0.1.1) + net-imap + net-pop + net-smtp marcel (1.0.2) matrix (0.4.2) - mdl (0.11.0) + mdl (0.12.0) kramdown (~> 2.3) kramdown-parser-gfm (~> 1.1) mixlib-cli (~> 2.1, >= 2.1.1) @@ -463,37 +486,44 @@ GEM method_source (1.0.0) mime-types (3.4.1) mime-types-data (~> 3.2015) - mime-types-data (3.2022.0105) - mini_magick (4.11.0) + mime-types-data (3.2023.0218.1) + mini_magick (4.12.0) mini_mime (1.1.2) - minitest (5.16.3) + minitest (5.18.1) mixlib-cli (2.1.8) mixlib-config (3.0.27) tomlrb mixlib-shellout (3.2.7) chef-utils - msgpack (1.5.6) + msgpack (1.7.1) multi_xml (0.6.0) mustache (1.1.1) - nio4r (2.5.8) - nokogiri (1.13.8-x86_64-darwin) - racc (~> 1.4) - nokogiri (1.13.8-x86_64-linux) + net-imap (0.3.6) + date + net-protocol + net-pop (0.1.2) + net-protocol + net-protocol (0.2.1) + timeout + net-smtp (0.3.3) + net-protocol + nio4r (2.5.9) + nokogiri (1.14.5-x86_64-linux) racc (~> 1.4) oauth (1.1.0) oauth-tty (~> 1.0, >= 1.0.1) snaky_hash (~> 2.0) version_gem (~> 1.1) - oauth-tty (1.0.3) - version_gem (~> 1.1) - oauth2 (2.0.8) + oauth-tty (1.0.5) + version_gem (~> 1.1, >= 1.1.1) + oauth2 (2.0.9) faraday (>= 0.17.3, < 3.0) jwt (>= 1.0, < 3.0) multi_xml (~> 0.5) - rack (>= 1.2, < 3) + rack (>= 1.2, < 4) snaky_hash (~> 2.0) version_gem (~> 1.1) - omniauth (2.1.0) + omniauth (2.1.1) hashie (>= 3.4.6) rack (>= 2.2.3) rack-protection @@ -520,68 +550,73 @@ GEM paper_trail (12.3.0) activerecord (>= 5.2) request_store (~> 1.1) - parallel (1.22.1) - parser (3.1.2.1) + parallel (1.23.0) + parallel_tests (3.13.0) + parallel + parser (3.2.2.3) ast (~> 2.4.1) + racc pg (1.1.4) pg_search (2.3.6) activerecord (>= 5.2) activesupport (>= 5.2) - premailer (1.16.0) + premailer (1.21.0) addressable - css_parser (>= 1.6.0) + css_parser (>= 1.12.0) htmlentities (>= 4.0.0) - premailer-rails (1.11.1) + premailer-rails (1.12.0) actionmailer (>= 3) + net-smtp premailer (~> 1.7, >= 1.7.9) - public_suffix (5.0.0) - puma (5.6.5) + public_suffix (5.0.1) + puma (5.6.6) nio4r (~> 2.0) - racc (1.6.0) - rack (2.2.4) + racc (1.7.1) + rack (2.2.7) rack-attack (6.6.1) rack (>= 1.0, < 3) rack-cors (1.1.1) rack (>= 2.0.0) - rack-protection (2.2.2) + rack-protection (3.0.6) rack - rack-proxy (0.7.2) + rack-proxy (0.7.6) rack - rack-test (2.0.2) + rack-test (2.1.0) rack (>= 1.3) - rails (6.0.5.1) - actioncable (= 6.0.5.1) - actionmailbox (= 6.0.5.1) - actionmailer (= 6.0.5.1) - actionpack (= 6.0.5.1) - actiontext (= 6.0.5.1) - actionview (= 6.0.5.1) - activejob (= 6.0.5.1) - activemodel (= 6.0.5.1) - activerecord (= 6.0.5.1) - activestorage (= 6.0.5.1) - activesupport (= 6.0.5.1) - bundler (>= 1.3.0) - railties (= 6.0.5.1) + rails (6.1.7.4) + actioncable (= 6.1.7.4) + actionmailbox (= 6.1.7.4) + actionmailer (= 6.1.7.4) + actionpack (= 6.1.7.4) + actiontext (= 6.1.7.4) + actionview (= 6.1.7.4) + activejob (= 6.1.7.4) + activemodel (= 6.1.7.4) + activerecord (= 6.1.7.4) + activestorage (= 6.1.7.4) + activesupport (= 6.1.7.4) + bundler (>= 1.15.0) + railties (= 6.1.7.4) sprockets-rails (>= 2.0.0) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) actionview (>= 5.0.1.rc1) activesupport (>= 5.0.1.rc1) - rails-dom-testing (2.0.3) - activesupport (>= 4.2.0) + rails-dom-testing (2.1.1) + activesupport (>= 5.0.0) + minitest nokogiri (>= 1.6) rails-html-sanitizer (1.4.3) loofah (~> 2.3) rails-i18n (6.0.0) i18n (>= 0.7, < 2) railties (>= 6.0.0, < 7) - railties (6.0.5.1) - actionpack (= 6.0.5.1) - activesupport (= 6.0.5.1) + railties (6.1.7.4) + actionpack (= 6.1.7.4) + activesupport (= 6.1.7.4) method_source - rake (>= 0.8.7) - thor (>= 0.20.3, < 2.0) + rake (>= 12.2) + thor (~> 1.0) rainbow (3.1.1) rake (13.0.6) ransack (2.4.2) @@ -591,39 +626,33 @@ GEM rb-fsevent (0.11.2) rb-inotify (0.10.1) ffi (~> 1.0) - rectify (0.13.0) - activemodel (>= 4.1.0) - activerecord (>= 4.1.0) - activesupport (>= 4.1.0) - virtus (~> 1.0.5) - wisper (>= 1.6.1) - redcarpet (3.5.1) - redis (4.8.0) - regexp_parser (2.5.0) + redcarpet (3.6.0) + redis (4.8.1) + regexp_parser (2.8.1) request_store (1.5.1) rack (>= 1.4) - responders (3.0.1) - actionpack (>= 5.0) - railties (>= 5.0) + responders (3.1.0) + actionpack (>= 5.2) + railties (>= 5.2) rexml (3.2.5) - rspec (3.11.0) - rspec-core (~> 3.11.0) - rspec-expectations (~> 3.11.0) - rspec-mocks (~> 3.11.0) - rspec-cells (0.3.7) + rspec (3.12.0) + rspec-core (~> 3.12.0) + rspec-expectations (~> 3.12.0) + rspec-mocks (~> 3.12.0) + rspec-cells (0.3.8) cells (>= 4.0.0, < 6.0.0) - rspec-rails (< 6.0) - rspec-core (3.11.0) - rspec-support (~> 3.11.0) - rspec-expectations (3.11.0) + rspec-rails (>= 3.0.0, < 6.1.0) + rspec-core (3.12.2) + rspec-support (~> 3.12.0) + rspec-expectations (3.12.3) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.11.0) + rspec-support (~> 3.12.0) rspec-html-matchers (0.9.4) nokogiri (~> 1) rspec (>= 3.0.0.a, < 4) - rspec-mocks (3.11.1) + rspec-mocks (3.12.5) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.11.0) + rspec-support (~> 3.12.0) rspec-rails (4.1.2) actionpack (>= 4.2) activesupport (>= 4.2) @@ -634,30 +663,30 @@ GEM rspec-support (~> 3.10) rspec-retry (0.6.2) rspec-core (> 3.3) - rspec-support (3.11.0) + rspec-support (3.12.1) rspec_junit_formatter (0.3.0) rspec-core (>= 2, < 4, != 2.12.0) - rubocop (0.92.0) + rubocop (1.28.2) parallel (~> 1.10) - parser (>= 2.7.1.5) + parser (>= 3.1.0.0) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 1.7) + regexp_parser (>= 1.8, < 3.0) rexml - rubocop-ast (>= 0.5.0) + rubocop-ast (>= 1.17.0, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 2.0) - rubocop-ast (1.21.0) - parser (>= 3.1.1.0) + unicode-display_width (>= 1.4.0, < 3.0) + rubocop-ast (1.29.0) + parser (>= 3.2.1.0) rubocop-faker (1.1.0) faker (>= 2.12.0) rubocop (>= 0.82.0) - rubocop-rails (2.9.1) + rubocop-rails (2.15.2) activesupport (>= 4.2.0) rack (>= 1.1) - rubocop (>= 0.90.0, < 2.0) - rubocop-rspec (1.43.2) - rubocop (~> 0.87) - ruby-progressbar (1.11.0) + rubocop (>= 1.7.0, < 2.0) + rubocop-rspec (2.11.1) + rubocop (~> 1.19) + ruby-progressbar (1.13.0) ruby-vips (2.1.4) ffi (~> 1.12) ruby2_keywords (0.0.5) @@ -665,58 +694,64 @@ GEM nokogiri (>= 1.10.8) rubyzip (>= 1.3.0) rubyzip (2.3.2) - searchlight (4.1.0) - selenium-webdriver (3.142.7) - childprocess (>= 0.5, < 4.0) + 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) + selenium-webdriver (4.1.0) + childprocess (>= 0.5, < 5.0) + rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2) semantic_range (3.0.0) seven_zip_ruby (1.3.0) - simplecov (0.19.1) + simplecov (0.21.2) docile (~> 1.1) simplecov-html (~> 0.11) - simplecov-cobertura (1.3.1) - simplecov (~> 0.8) + simplecov_json_formatter (~> 0.1) + simplecov-cobertura (2.1.0) + rexml + simplecov (~> 0.19) simplecov-html (0.12.3) + simplecov_json_formatter (0.1.4) smart_properties (1.17.0) - snaky_hash (2.0.0) + snaky_hash (2.0.1) hashie - version_gem (~> 1.1) + version_gem (~> 1.1, >= 1.1.1) social-share-button (1.2.4) coffee-rails spring (2.1.1) spring-watcher-listen (2.0.1) listen (>= 2.7, < 4.0) spring (>= 1.2, < 3.0) - sprockets (4.1.1) + sprockets (4.2.0) concurrent-ruby (~> 1.0) - rack (> 1, < 3) + rack (>= 2.2.4, < 4) sprockets-rails (3.4.2) actionpack (>= 5.2) activesupport (>= 5.2) sprockets (>= 3.0.0) ssrf_filter (1.1.1) - system_test_html_screenshots (0.2.0) - actionpack (>= 5.2, < 6.1.a) - temple (0.8.2) + temple (0.10.2) terminal-table (3.0.2) unicode-display_width (>= 1.1.1, < 3) - thor (1.2.1) + thor (1.2.2) thread_safe (0.3.6) - tilt (2.0.11) + tilt (2.2.0) + timeout (0.4.0) tomlrb (2.0.3) - tzinfo (1.2.10) - thread_safe (~> 0.1) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) uber (0.1.0) - unicode-display_width (1.8.0) + unicode-display_width (2.4.2) valid_email2 (2.3.1) activemodel (>= 3.2) mail (~> 2.5) - version_gem (1.1.0) - virtus (1.0.5) + version_gem (1.1.3) + virtus (2.0.0) axiom-types (~> 0.1) coercible (~> 1.0) descendants_tracker (~> 0.0, >= 0.0.3) - equalizer (~> 0.0, >= 0.0.9) w3c_rspec_validators (0.3.0) rails rspec @@ -741,6 +776,9 @@ GEM rack-proxy (>= 0.6.1) railties (>= 5.2) semantic_range (>= 2.3.0) + webpush (1.1.0) + hkdf (~> 0.2) + jwt (~> 2.0) websocket-driver (0.7.5) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) @@ -748,21 +786,20 @@ GEM activesupport wisper (2.0.1) wisper-rspec (1.1.0) - wkhtmltopdf-binary (0.12.6.5) + wkhtmltopdf-binary (0.12.6.6) xpath (3.2.0) nokogiri (~> 1.8) - zeitwerk (2.6.0) + zeitwerk (2.6.8) PLATFORMS - x86_64-darwin-21 x86_64-linux DEPENDENCIES bootsnap (~> 1.7) byebug (~> 11.0) codecov - decidim (= 0.26.2) - decidim-dev (= 0.26.2) + decidim (= 0.27.3) + decidim-dev (= 0.27.3) decidim-participatory_documents! faker (~> 2.14) letter_opener_web (~> 1.3) @@ -774,7 +811,7 @@ DEPENDENCIES web-console RUBY VERSION - ruby 2.7.6p219 + ruby 3.0.5p211 BUNDLED WITH - 2.3.23 + 2.3.20 diff --git a/Rakefile b/Rakefile index 36c5cc71..00b57b30 100644 --- a/Rakefile +++ b/Rakefile @@ -4,6 +4,8 @@ require "decidim/dev/common_rake" require "fileutils" def install_module(path) + # maintain until https://github.com/decidim/decidim/commit/51b81b37004708ab72e70993fef4634eef18ee6c is in the decidim version used + FileUtils.cp("babel.config.json", "#{path}/babel.config.json") Dir.chdir(path) do system("bundle exec rake decidim_participatory_documents:install:migrations") system("bundle exec rake db:migrate") diff --git a/app/commands/decidim/participatory_documents/admin/answer_suggestion.rb b/app/commands/decidim/participatory_documents/admin/answer_suggestion.rb index 1b3ee70f..2193f701 100644 --- a/app/commands/decidim/participatory_documents/admin/answer_suggestion.rb +++ b/app/commands/decidim/participatory_documents/admin/answer_suggestion.rb @@ -3,7 +3,7 @@ module Decidim module ParticipatoryDocuments module Admin - class AnswerSuggestion < Rectify::Command + class AnswerSuggestion < Decidim::Command # Public: Initializes the command. # # form - A form object with the params. diff --git a/app/commands/decidim/participatory_documents/admin/assign_suggestions_to_valuator.rb b/app/commands/decidim/participatory_documents/admin/assign_suggestions_to_valuator.rb index 8f3520bb..4f5e5bc5 100644 --- a/app/commands/decidim/participatory_documents/admin/assign_suggestions_to_valuator.rb +++ b/app/commands/decidim/participatory_documents/admin/assign_suggestions_to_valuator.rb @@ -3,7 +3,7 @@ module Decidim module ParticipatoryDocuments module Admin - class AssignSuggestionsToValuator < Rectify::Command + class AssignSuggestionsToValuator < Decidim::Command # Public: Initializes the command. # # form - A form object with the params. diff --git a/app/commands/decidim/participatory_documents/admin/create_document.rb b/app/commands/decidim/participatory_documents/admin/create_document.rb index 854a4a10..7de2d876 100644 --- a/app/commands/decidim/participatory_documents/admin/create_document.rb +++ b/app/commands/decidim/participatory_documents/admin/create_document.rb @@ -3,7 +3,7 @@ module Decidim module ParticipatoryDocuments module Admin - class CreateDocument < Rectify::Command + class CreateDocument < Decidim::Command include ::Decidim::AttachmentAttributesMethods # Public: Initializes the command. diff --git a/app/commands/decidim/participatory_documents/admin/create_suggestion_note.rb b/app/commands/decidim/participatory_documents/admin/create_suggestion_note.rb index 6deeacc1..6e52ed2b 100644 --- a/app/commands/decidim/participatory_documents/admin/create_suggestion_note.rb +++ b/app/commands/decidim/participatory_documents/admin/create_suggestion_note.rb @@ -3,7 +3,7 @@ module Decidim module ParticipatoryDocuments module Admin - class CreateSuggestionNote < Rectify::Command + class CreateSuggestionNote < Decidim::Command # Public: Initializes the command. # # form - A form object with the params. diff --git a/app/commands/decidim/participatory_documents/admin/destroy_annotation.rb b/app/commands/decidim/participatory_documents/admin/destroy_annotation.rb index a4ac1781..c3cacbd8 100644 --- a/app/commands/decidim/participatory_documents/admin/destroy_annotation.rb +++ b/app/commands/decidim/participatory_documents/admin/destroy_annotation.rb @@ -3,7 +3,7 @@ module Decidim module ParticipatoryDocuments module Admin - class DestroyAnnotation < Rectify::Command + class DestroyAnnotation < Decidim::Command # Public: Initializes the command. # # form - A form object with the params. diff --git a/app/commands/decidim/participatory_documents/admin/notify_suggestion_answer.rb b/app/commands/decidim/participatory_documents/admin/notify_suggestion_answer.rb index be8b7da0..fc713232 100644 --- a/app/commands/decidim/participatory_documents/admin/notify_suggestion_answer.rb +++ b/app/commands/decidim/participatory_documents/admin/notify_suggestion_answer.rb @@ -3,7 +3,7 @@ module Decidim module ParticipatoryDocuments module Admin - class NotifySuggestionAnswer < Rectify::Command + class NotifySuggestionAnswer < Decidim::Command # Public: Initializes the command. # # suggestion - The suggestion to write the answer for. diff --git a/app/commands/decidim/participatory_documents/admin/publish_answers.rb b/app/commands/decidim/participatory_documents/admin/publish_answers.rb index 9c5a24ea..be5fe5d5 100644 --- a/app/commands/decidim/participatory_documents/admin/publish_answers.rb +++ b/app/commands/decidim/participatory_documents/admin/publish_answers.rb @@ -3,7 +3,7 @@ module Decidim module ParticipatoryDocuments module Admin - class PublishAnswers < Rectify::Command + class PublishAnswers < Decidim::Command # Public: Initializes the command. # # component - The component that contains the answers. diff --git a/app/commands/decidim/participatory_documents/admin/publish_document.rb b/app/commands/decidim/participatory_documents/admin/publish_document.rb index f43073b2..8ae86a02 100644 --- a/app/commands/decidim/participatory_documents/admin/publish_document.rb +++ b/app/commands/decidim/participatory_documents/admin/publish_document.rb @@ -3,7 +3,7 @@ module Decidim module ParticipatoryDocuments module Admin - class PublishDocument < Rectify::Command + class PublishDocument < Decidim::Command # Public: Initializes the command. # # document - The document to publish. diff --git a/app/commands/decidim/participatory_documents/admin/unassign_suggestions_from_valuator.rb b/app/commands/decidim/participatory_documents/admin/unassign_suggestions_from_valuator.rb index 50925ee1..f2212f2f 100644 --- a/app/commands/decidim/participatory_documents/admin/unassign_suggestions_from_valuator.rb +++ b/app/commands/decidim/participatory_documents/admin/unassign_suggestions_from_valuator.rb @@ -3,7 +3,7 @@ module Decidim module ParticipatoryDocuments module Admin - class UnassignSuggestionsFromValuator < Rectify::Command + class UnassignSuggestionsFromValuator < Decidim::Command # Public: Initializes the command. # # form - A form object with the params. diff --git a/app/commands/decidim/participatory_documents/admin/update_document.rb b/app/commands/decidim/participatory_documents/admin/update_document.rb index 0225b1da..8c779404 100644 --- a/app/commands/decidim/participatory_documents/admin/update_document.rb +++ b/app/commands/decidim/participatory_documents/admin/update_document.rb @@ -3,7 +3,7 @@ module Decidim module ParticipatoryDocuments module Admin - class UpdateDocument < Rectify::Command + class UpdateDocument < Decidim::Command include ::Decidim::AttachmentAttributesMethods def initialize(form, document) diff --git a/app/commands/decidim/participatory_documents/admin/update_or_create_annotation.rb b/app/commands/decidim/participatory_documents/admin/update_or_create_annotation.rb index 6f0842d2..e0219b6a 100644 --- a/app/commands/decidim/participatory_documents/admin/update_or_create_annotation.rb +++ b/app/commands/decidim/participatory_documents/admin/update_or_create_annotation.rb @@ -3,7 +3,7 @@ module Decidim module ParticipatoryDocuments module Admin - class UpdateOrCreateAnnotation < Rectify::Command + class UpdateOrCreateAnnotation < Decidim::Command # Public: Initializes the command. # # form - A form object with the params. diff --git a/app/commands/decidim/participatory_documents/admin/update_section.rb b/app/commands/decidim/participatory_documents/admin/update_section.rb index 57154303..192e734e 100644 --- a/app/commands/decidim/participatory_documents/admin/update_section.rb +++ b/app/commands/decidim/participatory_documents/admin/update_section.rb @@ -3,7 +3,7 @@ module Decidim module ParticipatoryDocuments module Admin - class UpdateSection < Rectify::Command + class UpdateSection < Decidim::Command # Public: Initializes the command. # # form - A form object with the params. diff --git a/app/commands/decidim/participatory_documents/admin/update_suggestion_note.rb b/app/commands/decidim/participatory_documents/admin/update_suggestion_note.rb index f9e0f541..4da7114f 100644 --- a/app/commands/decidim/participatory_documents/admin/update_suggestion_note.rb +++ b/app/commands/decidim/participatory_documents/admin/update_suggestion_note.rb @@ -4,7 +4,7 @@ module Decidim module ParticipatoryDocuments module Admin # A command with all the business logic when a user updates a suggestion note. - class UpdateSuggestionNote < Rectify::Command + class UpdateSuggestionNote < Decidim::Command # Public: Initializes the command. # # form - A form object with the params. diff --git a/app/commands/decidim/participatory_documents/create_suggestion.rb b/app/commands/decidim/participatory_documents/create_suggestion.rb index ad275099..3478b869 100644 --- a/app/commands/decidim/participatory_documents/create_suggestion.rb +++ b/app/commands/decidim/participatory_documents/create_suggestion.rb @@ -2,7 +2,7 @@ module Decidim module ParticipatoryDocuments - class CreateSuggestion < Rectify::Command + class CreateSuggestion < Decidim::Command include ::Decidim::AttachmentMethods def initialize(form, suggestable) diff --git a/app/controllers/concerns/decidim/participatory_documents/admin/needs_admin_snippets.rb b/app/controllers/concerns/decidim/participatory_documents/admin/needs_admin_snippets.rb index 3d6e83c9..6cc7fafc 100644 --- a/app/controllers/concerns/decidim/participatory_documents/admin/needs_admin_snippets.rb +++ b/app/controllers/concerns/decidim/participatory_documents/admin/needs_admin_snippets.rb @@ -16,7 +16,7 @@ def add_snippets return unless respond_to?(:snippets) snippets.add(:head, helpers.stylesheet_pack_tag("decidim_participatory_documents_admin")) - snippets.add(:head, helpers.javascript_pack_tag("decidim_participatory_documents_admin")) + snippets.add(:foot, helpers.javascript_pack_tag("decidim_participatory_documents_admin")) end end end diff --git a/app/controllers/concerns/decidim/participatory_documents/needs_pdf_document.rb b/app/controllers/concerns/decidim/participatory_documents/needs_pdf_document.rb index 09785746..efc82bd0 100644 --- a/app/controllers/concerns/decidim/participatory_documents/needs_pdf_document.rb +++ b/app/controllers/concerns/decidim/participatory_documents/needs_pdf_document.rb @@ -11,6 +11,13 @@ module NeedsPdfDocument protected + def add_iframe_snippets + return unless respond_to?(:snippets) + + snippets.add(:head, helpers.stylesheet_pack_tag("decidim_participatory_documents")) + snippets.add(:foot, helpers.javascript_pack_tag("decidim_participatory_documents")) + end + def document @document ||= Decidim::ParticipatoryDocuments::Document.find_by(component: current_component) end @@ -78,12 +85,12 @@ def rgb_to_hsl(red, green, blue) if c_max == red ((green - blue) / delta) % 6 elsif c_max == green - (blue - red) / delta + 2 + ((blue - red) / delta) + 2 else - (red - green) / delta + 4 + ((red - green) / delta) + 4 end - s = delta / (1 - (2 * l - 1).abs) + s = delta / (1 - ((2 * l) - 1).abs) end h = (h * 60).round diff --git a/app/controllers/decidim/participatory_documents/documents_controller.rb b/app/controllers/decidim/participatory_documents/documents_controller.rb index 0fec0abf..ab4274c4 100644 --- a/app/controllers/decidim/participatory_documents/documents_controller.rb +++ b/app/controllers/decidim/participatory_documents/documents_controller.rb @@ -6,7 +6,9 @@ class DocumentsController < Decidim::ParticipatoryDocuments::ApplicationControll include NeedsPdfDocument helper Decidim::LayoutHelper - def index; end + def index + add_iframe_snippets + end def pdf_viewer render layout: false diff --git a/app/helpers/decidim/participatory_documents/admin/documents_helper.rb b/app/helpers/decidim/participatory_documents/admin/documents_helper.rb index b9d9a97a..2cb3d10b 100644 --- a/app/helpers/decidim/participatory_documents/admin/documents_helper.rb +++ b/app/helpers/decidim/participatory_documents/admin/documents_helper.rb @@ -6,7 +6,7 @@ module Admin module DocumentsHelper include ButtonHelper - def pdf_manage_button(document) + def pdf_manage_buttons(document) content_tag(:div, class: "flex--cc flex-gap--1") do if document.blank? && allowed_to?(:create, :participatory_document) new_pdf_btn diff --git a/app/packs/entrypoints/decidim_participatory_documents.js b/app/packs/entrypoints/decidim_participatory_documents.js index 09343ca1..71e96ea0 100644 --- a/app/packs/entrypoints/decidim_participatory_documents.js +++ b/app/packs/entrypoints/decidim_participatory_documents.js @@ -2,3 +2,5 @@ require.context("../images", true) import "entrypoints/decidim_participatory_documents.scss"; + +import "../src/decidim/participatory_documents/skip_cookie_warning.js" diff --git a/app/packs/src/decidim/participatory_documents/skip_cookie_warning.js b/app/packs/src/decidim/participatory_documents/skip_cookie_warning.js new file mode 100644 index 00000000..8486b8a3 --- /dev/null +++ b/app/packs/src/decidim/participatory_documents/skip_cookie_warning.js @@ -0,0 +1,10 @@ +/* eslint-disable no-plusplus */ + +document.addEventListener("DOMContentLoaded", () => { + const original = document.getElementById("pdf-iframe"); + + if (original) { + original.outerHTML = original.outerHTML.replace(/^$/, "iframe>"); + } +}); diff --git a/app/views/decidim/participatory_documents/admin/documents/_title.html.erb b/app/views/decidim/participatory_documents/admin/documents/_title.html.erb index 99d0d548..6fdfc79e 100644 --- a/app/views/decidim/participatory_documents/admin/documents/_title.html.erb +++ b/app/views/decidim/participatory_documents/admin/documents/_title.html.erb @@ -2,6 +2,6 @@ <% if defined?(button) && button == :back %> <%= back_btn %> <% else %> - <%= pdf_manage_button(document) %> + <%= pdf_manage_buttons(document) %> <% end %> diff --git a/app/views/decidim/participatory_documents/admin/documents/edit_pdf.html.erb b/app/views/decidim/participatory_documents/admin/documents/edit_pdf.html.erb index ef0d784d..a9b4b7ec 100644 --- a/app/views/decidim/participatory_documents/admin/documents/edit_pdf.html.erb +++ b/app/views/decidim/participatory_documents/admin/documents/edit_pdf.html.erb @@ -6,8 +6,8 @@
-
diff --git a/app/views/decidim/participatory_documents/admin/suggestions/index.html.erb b/app/views/decidim/participatory_documents/admin/suggestions/index.html.erb index e40a5163..fabb0190 100644 --- a/app/views/decidim/participatory_documents/admin/suggestions/index.html.erb +++ b/app/views/decidim/participatory_documents/admin/suggestions/index.html.erb @@ -10,7 +10,7 @@ <% if defined?(button) && button == :back %> <%= back_btn %> <% else %> - <%= pdf_manage_button(document) %> + <%= pdf_manage_buttons(document) %> <% end %> diff --git a/app/views/decidim/participatory_documents/documents/index.html.erb b/app/views/decidim/participatory_documents/documents/index.html.erb index a41d7d33..f54afab2 100644 --- a/app/views/decidim/participatory_documents/documents/index.html.erb +++ b/app/views/decidim/participatory_documents/documents/index.html.erb @@ -14,11 +14,10 @@ <% end %>
- + +

<%= t("decidim.participatory_documents.documents.not_supported") %>

+
- <%= stylesheet_pack_tag "decidim_participatory_documents" %> <% else %>

<%= t("decidim.participatory_documents.documents.missing") %>

diff --git a/babel.config.json b/babel.config.json index a66039fb..86a38f89 100644 --- a/babel.config.json +++ b/babel.config.json @@ -20,9 +20,6 @@ "corejs": false } ], - [ "@babel/plugin-transform-regenerator", { "async": false }], - [ "@babel/plugin-proposal-private-property-in-object", { "loose": true }], - ["@babel/plugin-proposal-private-methods", { "loose": true }], - ["@babel/plugin-proposal-class-properties", { "loose": true }] + ["@babel/plugin-transform-regenerator", { "async": false }] ] -} \ No newline at end of file +} diff --git a/config/locales/en.yml b/config/locales/en.yml index 3891b21b..20e0de80 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -6,6 +6,7 @@ en: box_color: Color of the boxes box_opacity: Opacity applied at the color of the boxes (%) description: Helper description + file: PDF Document title: Helper title errors: models: @@ -100,7 +101,7 @@ en: edit_document: Edit/upload document finish_publishing: Publish participatory sections new: Upload PDF document - preview_publishing_sections: Preview and publishing sections + preview_publishing_sections: Preview and publish sections title: Actions admin: documents: @@ -212,6 +213,7 @@ en: upload_file: Attach a document documents: missing: There is no document uploaded yet + not_supported: This page requires JavaScript to be enabled! preview_title: Preview publish_description: 'Admin options: you are previewing the participatory sections of the document' diff --git a/db/migrate/20221115233023_create_decidim_participatory_documents_suggestions.rb b/db/migrate/20221115233023_create_decidim_participatory_documents_suggestions.rb index 1a292404..6b17af01 100644 --- a/db/migrate/20221115233023_create_decidim_participatory_documents_suggestions.rb +++ b/db/migrate/20221115233023_create_decidim_participatory_documents_suggestions.rb @@ -14,4 +14,4 @@ def change t.timestamps end end -end \ No newline at end of file +end diff --git a/db/migrate/20221115233024_create_decidim_participatory_documents_suggestion_notes.rb b/db/migrate/20221115233024_create_decidim_participatory_documents_suggestion_notes.rb index a6c06e9f..b0e1ef1e 100644 --- a/db/migrate/20221115233024_create_decidim_participatory_documents_suggestion_notes.rb +++ b/db/migrate/20221115233024_create_decidim_participatory_documents_suggestion_notes.rb @@ -12,4 +12,4 @@ def change add_column :decidim_participatory_documents_suggestions, :suggestion_notes_count, :integer, null: false, default: 0 add_index :decidim_participatory_documents_suggestion_notes, :created_at, name: :index_decidim_pd_suggestion_notes_on_created_at end -end \ No newline at end of file +end diff --git a/db/migrate/20221115233024_create_decidim_participatory_documents_valuation_assignments.rb b/db/migrate/20221115233024_create_decidim_participatory_documents_valuation_assignments.rb index 1d64a25a..0dc7666c 100644 --- a/db/migrate/20221115233024_create_decidim_participatory_documents_valuation_assignments.rb +++ b/db/migrate/20221115233024_create_decidim_participatory_documents_valuation_assignments.rb @@ -9,4 +9,4 @@ def change t.timestamps end end -end \ No newline at end of file +end diff --git a/db/migrate/20230616100340_add_published_at_to_decidim_participatory_documents_documents.rb b/db/migrate/20230616100340_add_published_at_to_decidim_participatory_documents_documents.rb index 4404063e..8e20f73c 100644 --- a/db/migrate/20230616100340_add_published_at_to_decidim_participatory_documents_documents.rb +++ b/db/migrate/20230616100340_add_published_at_to_decidim_participatory_documents_documents.rb @@ -2,6 +2,7 @@ class AddPublishedAtToDecidimParticipatoryDocumentsDocuments < ActiveRecord::Migration[6.0] def change - add_column :decidim_participatory_documents_documents, :published_at, :datetime, index: true + add_column :decidim_participatory_documents_documents, :published_at, :datetime + add_index :decidim_participatory_documents_documents, :published_at end end diff --git a/db/migrate/20230622081831_add_decidim_participatory_documents_box_positions.rb b/db/migrate/20230622081831_add_decidim_participatory_documents_box_positions.rb index 48577425..0efe2641 100644 --- a/db/migrate/20230622081831_add_decidim_participatory_documents_box_positions.rb +++ b/db/migrate/20230622081831_add_decidim_participatory_documents_box_positions.rb @@ -18,6 +18,7 @@ class Annotation < ApplicationRecord belongs_to :section end + # rubocop:disable Rails/SkipsModelValidations: def change add_column :decidim_participatory_documents_annotations, :position, :integer, null: false, default: 0 add_index :decidim_participatory_documents_annotations, :position @@ -32,4 +33,5 @@ def change annotation.update_column(:position, annotation.section.document.annotations.where("decidim_participatory_documents_annotations.id < ?", annotation.id).count + 1) end end + # rubocop:enable Rails/SkipsModelValidations: end diff --git a/decidim-participatory_documents.gemspec b/decidim-participatory_documents.gemspec index fda3aaa6..bbde2803 100644 --- a/decidim-participatory_documents.gemspec +++ b/decidim-participatory_documents.gemspec @@ -14,7 +14,7 @@ Gem::Specification.new do |spec| spec.description = "A module for Decidim that facilitates the creation of proposals related to geolocated issues in a city" spec.license = "AGPL-3.0" spec.homepage = "https://github.com/openpoke/decidim-module-participatory_documents" - spec.required_ruby_version = ">= 2.7" + spec.required_ruby_version = ">= 3.0" spec.files = `git ls-files -z`.split("\x0").reject do |f| f.match(%r{^(test|spec|features)/}) @@ -26,4 +26,5 @@ Gem::Specification.new do |spec| spec.add_dependency "decidim-core", Decidim::ParticipatoryDocuments::COMPAT_DECIDIM_VERSION spec.add_development_dependency "decidim-dev", Decidim::ParticipatoryDocuments::COMPAT_DECIDIM_VERSION + spec.metadata["rubygems_mfa_required"] = "true" end diff --git a/lib/decidim/participatory_documents/component.rb b/lib/decidim/participatory_documents/component.rb index 3030828e..a91f4494 100644 --- a/lib/decidim/participatory_documents/component.rb +++ b/lib/decidim/participatory_documents/component.rb @@ -27,8 +27,8 @@ settings.attribute :min_suggestion_length, type: :integer, default: Decidim::ParticipatoryDocuments.min_suggestion_length end - component.settings(:step) do |settings| - end + # component.settings(:step) do |settings| + # end component.exports :suggestions do |exports| exports.collection do |component_instance| @@ -132,50 +132,50 @@ page_number: 1, section: group1, rect: { - "left": 25.5, - "top": 22.123, - "width": 30.1, - "height": 10.2 + left: 25.5, + top: 22.123, + width: 30.1, + height: 10.2 } }, { page_number: 1, section: group2, rect: { - "left": 5.5, - "top": 2.123, - "width": 10.1, - "height": 10.2 + left: 5.5, + top: 2.123, + width: 10.1, + height: 10.2 } }, { page_number: 1, section: group2, rect: { - "left": 15.5, - "top": 12.123, - "width": 10.1, - "height": 10.2 + left: 15.5, + top: 12.123, + width: 10.1, + height: 10.2 } }, { page_number: 1, section: group3, rect: { - "left": 75.5, - "top": 82.123, - "width": 10.1, - "height": 10.2 + left: 75.5, + top: 82.123, + width: 10.1, + height: 10.2 } }, { page_number: 2, section: group3, rect: { - "left": 15.5, - "top": 12.123, - "width": 10.1, - "height": 10.2 + left: 15.5, + top: 12.123, + width: 10.1, + height: 10.2 } } ] diff --git a/lib/decidim/participatory_documents/version.rb b/lib/decidim/participatory_documents/version.rb index 75234140..05e7fa9e 100644 --- a/lib/decidim/participatory_documents/version.rb +++ b/lib/decidim/participatory_documents/version.rb @@ -2,8 +2,8 @@ module Decidim module ParticipatoryDocuments - VERSION = "0.1.0" - DECIDIM_VERSION = "0.26.2" - COMPAT_DECIDIM_VERSION = [">= 0.25.0", "< 0.27"].freeze + VERSION = "0.2.0" + DECIDIM_VERSION = "0.27.3" + COMPAT_DECIDIM_VERSION = [">= 0.27.0", "< 0.28"].freeze end end diff --git a/package-lock.json b/package-lock.json index fb6e21cf..c0cbb228 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,9 +18,9 @@ "@babel/plugin-transform-runtime": "^7.19.6", "@babel/preset-env": "^7.20.2", "@babel/preset-react": "^7.18.6", - "@decidim/dev": "0.27.1", - "@decidim/eslint-config": "0.27.1", - "@decidim/stylelint-config": "0.27.1", + "@decidim/dev": "0.27.3", + "@decidim/eslint-config": "0.27.3", + "@decidim/stylelint-config": "0.27.3", "eslint-config-prettier": "^8.2.0", "eslint-config-standard": "^11.0.0", "eslint-plugin-import": "^2.22.0", @@ -1971,18 +1971,18 @@ } }, "node_modules/@decidim/dev": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/@decidim/dev/-/dev-0.27.1.tgz", - "integrity": "sha512-zHgwSUuvCWqav5QO6Bzr0LuhieJBE9fCep196I21q9+Rj7/1FRwRQqcdtvh+w+ldjJLnU0NTW7Jeb1eem2o+mQ==", + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@decidim/dev/-/dev-0.27.3.tgz", + "integrity": "sha512-8g1IrhycJ4Ldc8Fy1foKMMlGWn4SdM0z2Ij+N7a08ELJTY0LOzapIMyU3W4SUpqSPoKxhirXWgulEZocyISd5Q==", "dev": true, "dependencies": { "axe-core": "^4.1.4" } }, "node_modules/@decidim/eslint-config": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/@decidim/eslint-config/-/eslint-config-0.27.1.tgz", - "integrity": "sha512-NqWjOF2Se0/klVejagAZQl1hPwKwBYem255lbTdUJ/CkrgqyBzgHET5HX+9IZrN7DJg436ofJQTFgFJ0itzuYA==", + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@decidim/eslint-config/-/eslint-config-0.27.3.tgz", + "integrity": "sha512-bHaTzjgBgJKhRRZoLj9voIQjVB5qOwFMjdngoG4/nkBapzyqBbqZKlzDTJhavrJusKJQuNUFQA+/Hr+0I9IXeA==", "dev": true, "peerDependencies": { "eslint": "^7.25.0", @@ -1997,9 +1997,9 @@ } }, "node_modules/@decidim/stylelint-config": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/@decidim/stylelint-config/-/stylelint-config-0.27.1.tgz", - "integrity": "sha512-gSFa9lJGsRRwG3WXfcl/Dbx9Wvz2MdssjowS1adT8ysWIssGAPnIMHV82HQZD0LYRG/kXqTXa4EF8lufLJdWKg==", + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@decidim/stylelint-config/-/stylelint-config-0.27.3.tgz", + "integrity": "sha512-bhtpi/ysOfvN2Vl1n+sUaYFxz4QscSfqca7f415tHH12DQvm808DH59mQmTiqDBtsI33f5T1UVfuBlTKkf2hiQ==", "dev": true, "peerDependencies": { "stylelint": "13.11.0" @@ -8676,25 +8676,25 @@ } }, "@decidim/dev": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/@decidim/dev/-/dev-0.27.1.tgz", - "integrity": "sha512-zHgwSUuvCWqav5QO6Bzr0LuhieJBE9fCep196I21q9+Rj7/1FRwRQqcdtvh+w+ldjJLnU0NTW7Jeb1eem2o+mQ==", + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@decidim/dev/-/dev-0.27.3.tgz", + "integrity": "sha512-8g1IrhycJ4Ldc8Fy1foKMMlGWn4SdM0z2Ij+N7a08ELJTY0LOzapIMyU3W4SUpqSPoKxhirXWgulEZocyISd5Q==", "dev": true, "requires": { "axe-core": "^4.1.4" } }, "@decidim/eslint-config": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/@decidim/eslint-config/-/eslint-config-0.27.1.tgz", - "integrity": "sha512-NqWjOF2Se0/klVejagAZQl1hPwKwBYem255lbTdUJ/CkrgqyBzgHET5HX+9IZrN7DJg436ofJQTFgFJ0itzuYA==", + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@decidim/eslint-config/-/eslint-config-0.27.3.tgz", + "integrity": "sha512-bHaTzjgBgJKhRRZoLj9voIQjVB5qOwFMjdngoG4/nkBapzyqBbqZKlzDTJhavrJusKJQuNUFQA+/Hr+0I9IXeA==", "dev": true, "requires": {} }, "@decidim/stylelint-config": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/@decidim/stylelint-config/-/stylelint-config-0.27.1.tgz", - "integrity": "sha512-gSFa9lJGsRRwG3WXfcl/Dbx9Wvz2MdssjowS1adT8ysWIssGAPnIMHV82HQZD0LYRG/kXqTXa4EF8lufLJdWKg==", + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@decidim/stylelint-config/-/stylelint-config-0.27.3.tgz", + "integrity": "sha512-bhtpi/ysOfvN2Vl1n+sUaYFxz4QscSfqca7f415tHH12DQvm808DH59mQmTiqDBtsI33f5T1UVfuBlTKkf2hiQ==", "dev": true, "requires": {} }, diff --git a/package.json b/package.json index 78c5d72f..f37c2795 100644 --- a/package.json +++ b/package.json @@ -38,9 +38,9 @@ "@babel/plugin-transform-runtime": "^7.19.6", "@babel/preset-env": "^7.20.2", "@babel/preset-react": "^7.18.6", - "@decidim/dev": "0.27.1", - "@decidim/eslint-config": "0.27.1", - "@decidim/stylelint-config": "0.27.1", + "@decidim/dev": "0.27.3", + "@decidim/eslint-config": "0.27.3", + "@decidim/stylelint-config": "0.27.3", "eslint-config-prettier": "^8.2.0", "eslint-config-standard": "^11.0.0", "eslint-plugin-import": "^2.22.0", diff --git a/spec/commands/decidim/participatory_documents/admin/assign_suggestion_to_valuator_spec.rb b/spec/commands/decidim/participatory_documents/admin/assign_suggestion_to_valuator_spec.rb index 52d0d8a3..9a9a66d2 100644 --- a/spec/commands/decidim/participatory_documents/admin/assign_suggestion_to_valuator_spec.rb +++ b/spec/commands/decidim/participatory_documents/admin/assign_suggestion_to_valuator_spec.rb @@ -33,7 +33,7 @@ module Admin context "when the form is valid" do it "successfuly ignore the existing records" do create :suggestion_valuation_assignment, suggestion: suggestion, valuator_role: valuator_role - expect { subject.call }.to change(Decidim::ParticipatoryDocuments::ValuationAssignment, :count).by(0) + expect { subject.call }.not_to change(Decidim::ParticipatoryDocuments::ValuationAssignment, :count) expect { subject.call }.to broadcast(:ok) end diff --git a/spec/controllers/decidim/participatory_documents/admin/annotations_controller_spec.rb b/spec/controllers/decidim/participatory_documents/admin/annotations_controller_spec.rb index b30d6fc4..689bc2b8 100644 --- a/spec/controllers/decidim/participatory_documents/admin/annotations_controller_spec.rb +++ b/spec/controllers/decidim/participatory_documents/admin/annotations_controller_spec.rb @@ -43,7 +43,7 @@ module Admin let!(:annotation) { create(:participatory_documents_annotation) } let!(:section) { create(:participatory_documents_section, document: document, annotations: [annotation]) } - let(:params) { { document_id: document.id, id: annotation.id, page_number: 1, rect: { left: 50, top: 50, width: 100, height: 100 } } } + let(:params) { { document_id: document.id, id: annotation.id } } it "deletes the annotation and section" do expect { delete(:destroy, params: params) }.to change(model, :count).by(-1).and change(sections, :count).by(-1) diff --git a/spec/controllers/decidim/participatory_documents/admin/section_suggestions_controller_spec.rb b/spec/controllers/decidim/participatory_documents/admin/section_suggestions_controller_spec.rb index 07f9c9db..bc3cfdd5 100644 --- a/spec/controllers/decidim/participatory_documents/admin/section_suggestions_controller_spec.rb +++ b/spec/controllers/decidim/participatory_documents/admin/section_suggestions_controller_spec.rb @@ -27,8 +27,8 @@ module Admin let(:params) do { - "document_id": document.id, - "id": section.id, + document_id: document.id, + id: section.id, "title_en" => "Title" } end diff --git a/spec/forms/decidim/participatory_documents/suggestion_form_spec.rb b/spec/forms/decidim/participatory_documents/suggestion_form_spec.rb index 7d991c28..4d8d6087 100644 --- a/spec/forms/decidim/participatory_documents/suggestion_form_spec.rb +++ b/spec/forms/decidim/participatory_documents/suggestion_form_spec.rb @@ -28,13 +28,11 @@ module ParticipatoryDocuments shared_examples "validate error message" do |error_key, params| it "shows the correct error message" do form.validate - expect(form.errors[:body]).to include(I18n.t("activemodel.errors.models.suggestion.attributes.#{error_key}", params)) + expect(form.errors[:body]).to include(I18n.t("activemodel.errors.models.suggestion.attributes.#{error_key}", **params)) end end - it "is valid with valid attributes" do - expect(form).to be_valid - end + it { is_expected.to be_valid } context "when no body" do let(:body) { nil } @@ -113,7 +111,7 @@ module ParticipatoryDocuments end end - context "when :min_suggestion_length is modified in the component settings" do + context "when min length is enough" do let(:body) { "Hi" } let(:component) { double(:participatory_documents_component, settings: settings) } let(:settings) { double(:settings, min_suggestion_length: 3, max_suggestion_length: 100) } diff --git a/spec/helpers/decidim/participatory_documents/admin/documents_helper_spec.rb b/spec/helpers/decidim/participatory_documents/admin/documents_helper_spec.rb index fbd41591..c0584a08 100644 --- a/spec/helpers/decidim/participatory_documents/admin/documents_helper_spec.rb +++ b/spec/helpers/decidim/participatory_documents/admin/documents_helper_spec.rb @@ -4,7 +4,7 @@ let(:component) { create :participatory_documents_component } let(:document) { create(:participatory_documents_document, component: component) } - describe "#pdf_manage_button" do + describe "#pdf_manage_buttons" do before do allow(document.file).to receive(:attached?).and_return(document_attached) end @@ -18,7 +18,7 @@ end it "returns the new_pdf_btn" do - result = helper.pdf_manage_button(nil) + result = helper.pdf_manage_buttons(nil) expect(result).to include("New PDF Button") end end @@ -34,7 +34,7 @@ end it "returns the combination of edit_boxes_btn, edit_document_btn and preview_sections_btn" do - result = helper.pdf_manage_button(document) + result = helper.pdf_manage_buttons(document) expect(result).to include("Edit participatory areas", "Edit/upload document", "Preview and publishing sections") end end @@ -48,7 +48,7 @@ end it "returns the edit_document_btn" do - result = helper.pdf_manage_button(document) + result = helper.pdf_manage_buttons(document) expect(result).to include("Edit/upload document") end end diff --git a/spec/i18n_spec.rb b/spec/i18n_spec.rb index 1e67a27e..c74b8ce0 100644 --- a/spec/i18n_spec.rb +++ b/spec/i18n_spec.rb @@ -7,7 +7,7 @@ ENV["ENFORCED_LOCALES"].presence || "en" end - let(:i18n) { I18n::Tasks::BaseTask.new({ locales: locales.split(",") }) } + let(:i18n) { I18n::Tasks::BaseTask.new(locales: locales.split(",")) } let(:missing_keys) { i18n.missing_keys } let(:unused_keys) { i18n.unused_keys } let(:non_normalized_paths) { i18n.non_normalized_paths } diff --git a/spec/models/decidim/participatory_documents/valuation_assignment_spec.rb b/spec/models/decidim/participatory_documents/valuation_assignment_spec.rb index 88c638fd..9f2ad967 100644 --- a/spec/models/decidim/participatory_documents/valuation_assignment_spec.rb +++ b/spec/models/decidim/participatory_documents/valuation_assignment_spec.rb @@ -21,7 +21,7 @@ module ParticipatoryDocuments it "destroys valuation assignments when participatory_process_user_role is destroyed" do expect(Decidim::ParticipatoryDocuments::ValuationAssignment.count).to eq(1) - expect { valuator_role.destroy }.to change { Decidim::ParticipatoryDocuments::ValuationAssignment.count }.by(-1) + expect { valuator_role.destroy }.to change(Decidim::ParticipatoryDocuments::ValuationAssignment, :count).by(-1) end end end diff --git a/spec/serializers/suggestion_serialiser_spec.rb b/spec/serializers/suggestion_serialiser_spec.rb index 7608ff77..2ff5eb52 100644 --- a/spec/serializers/suggestion_serialiser_spec.rb +++ b/spec/serializers/suggestion_serialiser_spec.rb @@ -8,7 +8,7 @@ module Decidim include Decidim::ParticipatoryDocuments::Admin::SuggestionHelper include ActionView::Helpers::TextHelper - let(:subject) { described_class.new(suggestion) } + subject { described_class.new(suggestion) } let(:suggestion) { create(:participatory_documents_suggestion, :with_answer) } let(:serialized) { subject.serialize } @@ -27,7 +27,7 @@ module Decidim Decidim::ParticipatoryDocuments.max_export_text_length = 10 end - it "returns an answer that is 10 characters long " do + it "returns an answer that is 10 characters long" do expect(serialized).to include(answer: truncate(translated_attribute(suggestion.answer), length: 10)) expect(serialized).to include(body: truncate(translated_attribute(suggestion.body), length: 10)) end diff --git a/spec/system/admin/admin_filters_suggestions_spec.rb b/spec/system/admin/admin_filters_suggestions_spec.rb index bdf5aff5..e85ec0ff 100644 --- a/spec/system/admin/admin_filters_suggestions_spec.rb +++ b/spec/system/admin/admin_filters_suggestions_spec.rb @@ -60,7 +60,7 @@ def suggestion_without_state(state) before { visit router.document_suggestions_path(document) } it "can be searched by title" do - search_by_text(suggestion2_body.split(" ").first(2).join(" ")) + search_by_text(suggestion2_body.split.first(2).join(" ")) expect(page).to have_content(suggestion2.id) end diff --git a/spec/system/admin/admin_manages_participatory_documents_spec.rb b/spec/system/admin/admin_manages_participatory_documents_spec.rb index 7b9617ed..5511d0f2 100644 --- a/spec/system/admin/admin_manages_participatory_documents_spec.rb +++ b/spec/system/admin/admin_manages_participatory_documents_spec.rb @@ -44,17 +44,18 @@ def upload_file ) fill_in :document_box_opacity, with: "50" fill_in :document_box_color, with: "#f00f00" - attach_file :document_file, Decidim::Dev.asset("Exampledocument.pdf") + end + dynamically_attach_file :document_file, Decidim::Dev.asset("Exampledocument.pdf"), remove_before: create.blank? - expect(page.execute_script("return window.getComputedStyle(document.querySelector('.box-preview .box')).backgroundColor")).to eq("rgba(240, 15, 0, 0.498)") - expect(page.execute_script("return window.getComputedStyle(document.querySelector('.box-preview .box')).borderColor")).to eq("rgb(240, 15, 0)") + expect(page.execute_script("return window.getComputedStyle(document.querySelector('.box-preview .box')).backgroundColor")).to eq("rgba(240, 15, 0, 0.498)") + expect(page.execute_script("return window.getComputedStyle(document.querySelector('.box-preview .box')).borderColor")).to eq("rgb(240, 15, 0)") - if create - click_button "Create participatory document" - else - click_button "Update" - end + if create + click_button "Create participatory document" + else + click_button "Update" end + if create expect(page).to have_content("Document has been successfully created") # redirect to edit page @@ -110,7 +111,7 @@ def upload_file it "has sections delete warning" do expect(page).to have_content("all the participatory areas will be deleted!") expect(document.sections.count).to eq(2) - attach_file :document_file, Decidim::Dev.asset("Exampledocument.pdf") + dynamically_attach_file :document_file, Decidim::Dev.asset("Exampledocument.pdf"), remove_before: true click_button "Update" expect(document.sections.reload.count).to eq(0) end @@ -121,7 +122,7 @@ def upload_file expect(page).not_to have_content("all the participatory areas will be deleted!") expect(page).to have_content("This document cannot be changed or removed because it already has suggestions attached") expect(document.sections.count).to eq(2) if with_sections - attach_file :document_file, Decidim::Dev.asset("Exampledocument.pdf") + dynamically_attach_file :document_file, Decidim::Dev.asset("Exampledocument.pdf"), remove_before: true click_button "Update" expect(document.sections.reload.count).to eq(2) if with_sections expect(page).to have_content("This document cannot be changed or removed because it has suggestions") @@ -165,11 +166,7 @@ def upload_file end context "when a file is uploaded" do - let!(:document) { create :participatory_documents_document, component: component } - - before do - upload_file - end + let!(:document) { create :participatory_documents_document, :with_file, component: component } it "shows the edit buttons" do visit_component_admin @@ -191,22 +188,22 @@ def upload_file end it "shows the preview button" do - expect(page).to have_link("Preview and publishing sections") + expect(page).to have_link("Preview and publish sections") end it "goes to the preview page" do - click_link "Preview and publishing sections" + click_link "Preview and publish sections" expect(page).to have_content("you are previewing the participatory sections of the document") end it "can edit sections after previewing" do - click_link "Preview and publishing sections" + click_link "Preview and publish sections" click_link "Go back to edit participatory sections" expect(page).to have_selector("a[href='#{manage_component_path(component)}'][title='Back']") end it "can publish sections after previewing" do - click_link "Preview and publishing sections" + click_link "Preview and publish sections" click_link "Publish participatory sections" expect(page).to have_content("are you sure?") @@ -215,13 +212,13 @@ def upload_file end it "can't edit sections after publishing" do - click_link "Preview and publishing sections" + click_link "Preview and publish sections" click_link "Publish participatory sections" click_link "OK" expect(page).not_to have_content("Edit/upload document") expect(page).not_to have_content("Edit participatory areas") - expect(page).not_to have_content("Preview and publishing sections") + expect(page).not_to have_content("Preview and publish sections") end end end diff --git a/spec/system/admin/index_suggestion_notes_spec.rb b/spec/system/admin/index_suggestion_notes_spec.rb index e700954c..2c13ddb8 100644 --- a/spec/system/admin/index_suggestion_notes_spec.rb +++ b/spec/system/admin/index_suggestion_notes_spec.rb @@ -38,7 +38,7 @@ end context "when the form has a text inside body" do - it "creates a suggestion note ", :slow do + it "creates a suggestion note", :slow do within ".new_suggestion_note" do fill_in :suggestion_note_body, with: body diff --git a/spec/system/user_interacts_with_pdf_viewer_spec.rb b/spec/system/user_interacts_with_pdf_viewer_spec.rb index 057bb0cc..4910d1d3 100644 --- a/spec/system/user_interacts_with_pdf_viewer_spec.rb +++ b/spec/system/user_interacts_with_pdf_viewer_spec.rb @@ -46,7 +46,7 @@ end end - context "when the answer is published " do + context "when the answer is published" do let(:published) { true } it "does not render admin note" do @@ -68,7 +68,7 @@ end end - context "when the answer is published " do + context "when the answer is published" do let(:published) { true } it "renders admin note" do @@ -112,7 +112,7 @@ end end - context "when the answer is NOT draft " do + context "when the answer is NOT draft" do let(:published) { true } it "renders admin note" do @@ -134,7 +134,7 @@ end end - context "when the answer is NOT draft " do + context "when the answer is NOT draft" do let(:published) { true } it "renders admin note" do