diff --git a/.github/workflows/ci_emitter.yml b/.github/workflows/ci_emitter.yml index be16411..d903449 100644 --- a/.github/workflows/ci_emitter.yml +++ b/.github/workflows/ci_emitter.yml @@ -3,7 +3,7 @@ on: ["push"] env: CI: "true" - RUBY_VERSION: 3.0.6 + RUBY_VERSION: 3.2.2 NODE_VERSION: 18.17.1 concurrency: @@ -54,6 +54,8 @@ jobs: - uses: ruby/setup-ruby@v1 with: bundler-cache: true + - run: sudo apt install imagemagick + name: Install imagemagick - uses: actions/setup-node@v3 with: node-version: ${{ env.NODE_VERSION }} @@ -78,7 +80,7 @@ jobs: - run: bundle exec rspec name: RSpec - uses: codecov/codecov-action@v3 - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 if: always() with: name: screenshots diff --git a/.rubocop_ruby.yml b/.rubocop_ruby.yml index fe783a5..286804c 100644 --- a/.rubocop_ruby.yml +++ b/.rubocop_ruby.yml @@ -69,12 +69,7 @@ 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: 3.0 - - RSpec: - Patterns: - - "(?:^|/)spec/" - - "(?:^|/)test/" + TargetRubyVersion: 3.2 # Indent private/protected/public as deep as method definitions Layout/AccessModifierIndentation: @@ -210,7 +205,7 @@ Style/BlockDelimiters: # This looks at the usage of a block's method to determine its type (e.g. is # the result of a `map` assigned to a variable or passed to another # method) but exceptions are permitted in the `ProceduralMethods`, - # `FunctionalMethods` and `IgnoredMethods` sections below. + # `FunctionalMethods` and `AllowedMethods` sections below. - semantic # The `braces_for_chaining` style enforces braces around single line blocks # and do..end around multi-line blocks, except for multi-line blocks whose @@ -249,20 +244,9 @@ Style/BlockDelimiters: - let! - subject - watch - IgnoredMethods: - # Methods that can be either procedural or functional and cannot be - # categorised from their usage alone, e.g. - # - # foo = lambda do |x| - # puts "Hello, #{x}" - # end - # - # foo = lambda do |x| - # x * 100 - # end - # - # Here, it is impossible to tell from the return value of `lambda` whether - # the inner block's return value is significant. + AllowedMethods: + Enabled: true + Exclude: - lambda - proc - it @@ -969,7 +953,9 @@ Style/SymbolArray: Style/SymbolProc: # A list of method names to be ignored by the check. # The names should be fairly unique, otherwise you'll end up ignoring lots of code. - IgnoredMethods: + AllowedMethods: + Enabled: true + Exclude: - respond_to - define_method diff --git a/.ruby-version b/.ruby-version index 818bd47..be94e6f 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -3.0.6 +3.2.2 diff --git a/Gemfile b/Gemfile index c6bb024..ce110bd 100644 --- a/Gemfile +++ b/Gemfile @@ -12,25 +12,25 @@ require_relative "#{base_path}lib/decidim/emitter/version" DECIDIM_VERSION = Decidim::Emitter::DECIDIM_VERSION -gem "decidim", "~> #{DECIDIM_VERSION}" +gem "decidim", DECIDIM_VERSION.to_s gem "decidim-emitter", path: "." gem "bootsnap", "~> 1.4" -gem "puma", ">= 5.5.1" +gem "puma", ">= 6.3.1" group :development, :test do - gem "brakeman", "~> 5.1" + gem "brakeman", "~> 6.1" gem "byebug", "~> 11.0", platform: :mri gem "climate_control", "~> 1.2" - gem "decidim-dev", "~> #{DECIDIM_VERSION}" - gem "parallel_tests" + gem "decidim-dev", DECIDIM_VERSION.to_s + gem "parallel_tests", "~> 4.2" end group :development do - gem "letter_opener_web", "~> 1.3" + gem "letter_opener_web", "~> 2.0" gem "listen", "~> 3.1" gem "rubocop-faker" - gem "spring", "~> 2.0" + gem "spring", "~> 4.0" gem "spring-watcher-listen", "~> 2.0" - gem "web-console", "4.0.4" + gem "web-console", "~> 4.2" end diff --git a/Gemfile.lock b/Gemfile.lock index 814429d..243249a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,47 +1,54 @@ PATH remote: . specs: - decidim-emitter (0.1.0) - decidim-core (~> 0.27.0) - decidim-participatory_processes (~> 0.27.0) + decidim-emitter (1.0.0) + decidim-core (~> 0.29.0) + decidim-participatory_processes (~> 0.29.0) GEM remote: https://rubygems.org/ specs: - actioncable (6.1.7.7) - actionpack (= 6.1.7.7) - activesupport (= 6.1.7.7) + actioncable (7.0.8.7) + actionpack (= 7.0.8.7) + activesupport (= 7.0.8.7) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (6.1.7.7) - actionpack (= 6.1.7.7) - activejob (= 6.1.7.7) - activerecord (= 6.1.7.7) - activestorage (= 6.1.7.7) - activesupport (= 6.1.7.7) + actionmailbox (7.0.8.7) + actionpack (= 7.0.8.7) + activejob (= 7.0.8.7) + activerecord (= 7.0.8.7) + activestorage (= 7.0.8.7) + activesupport (= 7.0.8.7) mail (>= 2.7.1) - actionmailer (6.1.7.7) - actionpack (= 6.1.7.7) - actionview (= 6.1.7.7) - activejob (= 6.1.7.7) - activesupport (= 6.1.7.7) + net-imap + net-pop + net-smtp + actionmailer (7.0.8.7) + actionpack (= 7.0.8.7) + actionview (= 7.0.8.7) + activejob (= 7.0.8.7) + activesupport (= 7.0.8.7) mail (~> 2.5, >= 2.5.4) + net-imap + net-pop + net-smtp rails-dom-testing (~> 2.0) - actionpack (6.1.7.7) - actionview (= 6.1.7.7) - activesupport (= 6.1.7.7) - rack (~> 2.0, >= 2.0.9) + actionpack (7.0.8.7) + actionview (= 7.0.8.7) + activesupport (= 7.0.8.7) + rack (~> 2.0, >= 2.2.4) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (6.1.7.7) - actionpack (= 6.1.7.7) - activerecord (= 6.1.7.7) - activestorage (= 6.1.7.7) - activesupport (= 6.1.7.7) + actiontext (7.0.8.7) + actionpack (= 7.0.8.7) + activerecord (= 7.0.8.7) + activestorage (= 7.0.8.7) + activesupport (= 7.0.8.7) + globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (6.1.7.7) - activesupport (= 6.1.7.7) + actionview (7.0.8.7) + activesupport (= 7.0.8.7) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) @@ -49,61 +56,53 @@ GEM active_link_to (1.0.5) actionpack addressable - activejob (6.1.7.7) - activesupport (= 6.1.7.7) + activejob (7.0.8.7) + activesupport (= 7.0.8.7) globalid (>= 0.3.6) - activemodel (6.1.7.7) - activesupport (= 6.1.7.7) - activerecord (6.1.7.7) - activemodel (= 6.1.7.7) - activesupport (= 6.1.7.7) - activestorage (6.1.7.7) - actionpack (= 6.1.7.7) - activejob (= 6.1.7.7) - activerecord (= 6.1.7.7) - activesupport (= 6.1.7.7) + activemodel (7.0.8.7) + activesupport (= 7.0.8.7) + activerecord (7.0.8.7) + activemodel (= 7.0.8.7) + activesupport (= 7.0.8.7) + activestorage (7.0.8.7) + actionpack (= 7.0.8.7) + activejob (= 7.0.8.7) + activerecord (= 7.0.8.7) + activesupport (= 7.0.8.7) marcel (~> 1.0) mini_mime (>= 1.1.0) - activesupport (6.1.7.7) + activesupport (7.0.8.7) concurrent-ruby (~> 1.0, >= 1.0.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.6) - public_suffix (>= 2.0.2, < 6.0) + acts_as_list (1.2.4) + activerecord (>= 6.1) + activesupport (>= 6.1) + addressable (2.8.7) + public_suffix (>= 2.0.2, < 7.0) ast (2.4.2) - axe-core-api (4.9.0) - dumb_delegator - virtus - axe-core-rspec (4.1.0) - axe-core-api - dumb_delegator - virtus - axiom-types (0.1.1) - descendants_tracker (~> 0.0.4) - ice_nine (~> 0.11.0) - thread_safe (~> 0.3, >= 0.3.1) base64 (0.2.0) batch-loader (1.5.0) bcrypt (3.1.20) - better_html (1.0.16) - actionview (>= 4.0) - activesupport (>= 4.0) + better_html (2.1.1) + actionview (>= 6.0) + activesupport (>= 6.0) ast (~> 2.0) erubi (~> 1.4) - html_tokenizer (~> 0.0.6) parser (>= 2.4) smart_properties - bigdecimal (3.1.7) + bigdecimal (3.1.9) bindex (0.8.1) - bootsnap (1.18.3) + bootsnap (1.18.4) msgpack (~> 1.2) - brakeman (5.4.1) + brakeman (6.2.2) + racc browser (2.7.1) - builder (3.2.4) + builder (3.3.0) + bullet (7.1.6) + activesupport (>= 3.0.0) + uniform_notifier (~> 1.11) byebug (11.1.3) capybara (3.40.0) addressable @@ -114,281 +113,263 @@ GEM rack-test (>= 0.6.3) regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) - carrierwave (2.2.6) - activemodel (>= 5.0.0) - activesupport (>= 5.0.0) - addressable (~> 2.6) - image_processing (~> 1.1) - marcel (~> 1.0.0) - mini_mime (>= 0.1.3) - ssrf_filter (~> 1.0) - cells (4.1.7) - declarative-builder (< 0.2.0) + cells (4.1.8) + declarative-builder (~> 0.2.0) declarative-option (< 0.2.0) tilt (>= 1.4, < 3) uber (< 0.2.0) cells-erb (0.1.0) cells (~> 4.0) erbse (>= 0.1.1) - cells-rails (0.1.5) + cells-rails (0.1.6) actionpack (>= 5.0) cells (>= 4.1.6, < 5.0.0) - charlock_holmes (0.7.7) - chef-utils (18.4.12) - concurrent-ruby - childprocess (4.1.0) + charlock_holmes (0.7.9) + childprocess (5.1.0) + logger (~> 1.5) climate_control (1.2.0) - coercible (1.0.0) - descendants_tracker (~> 0.0.1) - coffee-rails (5.0.0) - coffee-script (>= 2.2.0) - railties (>= 5.2.0) - coffee-script (2.4.1) - coffee-script-source - execjs - coffee-script-source (1.12.2) - commonmarker (0.23.10) - concurrent-ruby (1.2.3) + commonmarker (0.23.11) + concurrent-ruby (1.3.4) crack (1.0.0) bigdecimal rexml crass (1.0.6) - css_parser (1.17.1) + css_parser (1.21.0) addressable - date (3.3.4) + csv (3.3.2) + dartsass (1.49.8) + date (3.4.1) date_validator (0.12.0) activemodel (>= 3) activesupport (>= 3) - db-query-matchers (0.10.0) - activesupport (>= 4.0, < 7) - rspec (~> 3.0) - decidim (0.27.5) - decidim-accountability (= 0.27.5) - decidim-admin (= 0.27.5) - decidim-api (= 0.27.5) - decidim-assemblies (= 0.27.5) - decidim-blogs (= 0.27.5) - decidim-budgets (= 0.27.5) - decidim-comments (= 0.27.5) - decidim-core (= 0.27.5) - decidim-debates (= 0.27.5) - decidim-forms (= 0.27.5) - decidim-generators (= 0.27.5) - decidim-meetings (= 0.27.5) - decidim-pages (= 0.27.5) - decidim-participatory_processes (= 0.27.5) - decidim-proposals (= 0.27.5) - decidim-sortitions (= 0.27.5) - decidim-surveys (= 0.27.5) - decidim-system (= 0.27.5) - decidim-templates (= 0.27.5) - decidim-verifications (= 0.27.5) - decidim-accountability (0.27.5) - decidim-comments (= 0.27.5) - decidim-core (= 0.27.5) - decidim-admin (0.27.5) + decidim (0.29.1) + decidim-accountability (= 0.29.1) + decidim-admin (= 0.29.1) + decidim-api (= 0.29.1) + decidim-assemblies (= 0.29.1) + decidim-blogs (= 0.29.1) + decidim-budgets (= 0.29.1) + decidim-comments (= 0.29.1) + decidim-core (= 0.29.1) + decidim-debates (= 0.29.1) + decidim-forms (= 0.29.1) + decidim-generators (= 0.29.1) + decidim-meetings (= 0.29.1) + decidim-pages (= 0.29.1) + decidim-participatory_processes (= 0.29.1) + decidim-proposals (= 0.29.1) + decidim-sortitions (= 0.29.1) + decidim-surveys (= 0.29.1) + decidim-system (= 0.29.1) + decidim-verifications (= 0.29.1) + decidim-accountability (0.29.1) + decidim-comments (= 0.29.1) + decidim-core (= 0.29.1) + decidim-admin (0.29.1) active_link_to (~> 1.0) - decidim-core (= 0.27.5) + decidim-core (= 0.29.1) devise (~> 4.7) devise-i18n (~> 1.2) devise_invitable (~> 2.0, >= 2.0.9) - decidim-api (0.27.5) - graphql (~> 1.12, < 1.13) - graphql-docs (~> 2.1.0) + decidim-api (0.29.1) + decidim-core (= 0.29.1) + graphql (~> 2.2.6) + graphql-docs (~> 4.0) rack-cors (~> 1.0) - decidim-assemblies (0.27.5) - decidim-core (= 0.27.5) - decidim-blogs (0.27.5) - decidim-admin (= 0.27.5) - decidim-comments (= 0.27.5) - decidim-core (= 0.27.5) - decidim-budgets (0.27.5) - decidim-comments (= 0.27.5) - decidim-core (= 0.27.5) - decidim-comments (0.27.5) - decidim-core (= 0.27.5) + decidim-assemblies (0.29.1) + decidim-core (= 0.29.1) + decidim-blogs (0.29.1) + decidim-admin (= 0.29.1) + decidim-comments (= 0.29.1) + decidim-core (= 0.29.1) + decidim-budgets (0.29.1) + decidim-comments (= 0.29.1) + decidim-core (= 0.29.1) + decidim-comments (0.29.1) + decidim-core (= 0.29.1) redcarpet (~> 3.5, >= 3.5.1) - decidim-core (0.27.5) + decidim-core (0.29.1) active_link_to (~> 1.0) - acts_as_list (~> 0.9) + acts_as_list (~> 1.0) batch-loader (~> 1.2) browser (~> 2.7) - carrierwave (~> 2.2.1) cells-erb (~> 0.1.0) cells-rails (~> 0.1.3) charlock_holmes (~> 0.7) date_validator (~> 0.12.0) - decidim-api (= 0.27.5) devise (~> 4.7) - devise-i18n (~> 1.2) + devise-i18n (~> 1.2, < 1.11.1) diffy (~> 3.3) - doorkeeper (~> 5.1) + doorkeeper (~> 5.6, >= 5.6.6) doorkeeper-i18n (~> 4.0) file_validators (~> 3.0) fog-local (~> 0.6) foundation_rails_helper (~> 4.0) geocoder (~> 1.8) hashdiff (>= 0.4.0, < 2.0.0) + image_processing (~> 1.2) invisible_captcha (~> 0.12) kaminari (~> 1.2, >= 1.2.1) - loofah (~> 2.19.0) + loofah (~> 2.19, >= 2.19.1) mime-types (>= 1.16, < 4.0) mini_magick (~> 4.9) - mustache (~> 1.1.0) + net-smtp (~> 0.3.1) + nokogiri (~> 1.16, >= 1.16.2) omniauth (~> 2.0) omniauth-facebook (~> 5.0) omniauth-google-oauth2 (~> 1.0) omniauth-rails_csrf_protection (~> 1.0) omniauth-twitter (~> 1.4) paper_trail (~> 12.0) - pg (~> 1.1.4, < 2) + pg (~> 1.4.0, < 2) pg_search (~> 2.2) premailer-rails (~> 1.10) - rack (~> 2.2, >= 2.2.3) + psych (~> 4.0) + rack (~> 2.2, >= 2.2.8.1) rack-attack (~> 6.0) - rails (~> 6.1.0) - rails-i18n (~> 6.0) - ransack (~> 2.4.1) + rails (~> 7.0.8) + rails-i18n (~> 7.0) + ransack (~> 3.2.1) redis (~> 4.1) request_store (~> 1.5.0) rubyXL (~> 3.4) rubyzip (~> 2.0) - 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) + shakapacker (~> 7.1.0) + valid_email2 (~> 4.0) + web-push (~> 3.0) wisper (~> 2.0) - decidim-debates (0.27.5) - decidim-comments (= 0.27.5) - decidim-core (= 0.27.5) - decidim-dev (0.27.5) - axe-core-rspec (~> 4.1.0) + decidim-debates (0.29.1) + decidim-comments (= 0.29.1) + decidim-core (= 0.29.1) + decidim-dev (0.29.1) + bullet (~> 7.1.6) byebug (~> 11.0) - capybara (~> 3.24) - db-query-matchers (~> 0.10.0) - decidim (= 0.27.5) - erb_lint (~> 0.0.35) - factory_bot_rails (~> 4.8) - i18n-tasks (~> 0.9.18) - mdl (~> 0.5) - nokogiri (~> 1.13) - parallel_tests (~> 3.7) - puma (~> 5.0) + capybara (~> 3.39) + decidim (= 0.29.1) + erb_lint (~> 0.4.0) + factory_bot_rails (~> 6.2) + faker (~> 3.2) + i18n-tasks (~> 1.0) + nokogiri (~> 1.16, >= 1.16.2) + parallel_tests (~> 4.2) + puma (~> 6.2, >= 6.3.1) rails-controller-testing (~> 1.0) + rspec (~> 3.12) rspec-cells (~> 0.3.7) - rspec-html-matchers (~> 0.9.1) - rspec-rails (~> 4.0) + rspec-html-matchers (~> 0.10) + rspec-rails (~> 6.0) rspec-retry (~> 0.6.2) - rspec_junit_formatter (~> 0.3.0) - rubocop (~> 1.28.0) - rubocop-rails (~> 2.14) - rubocop-rspec (~> 2.10) - selenium-webdriver (~> 4.1.0) - simplecov (~> 0.21.0) + rspec_junit_formatter (~> 0.6.0) + rubocop (~> 1.65.0) + rubocop-capybara (~> 2.21) + rubocop-factory_bot (~> 2.26) + rubocop-faker (~> 1.1) + rubocop-performance (~> 1.21) + rubocop-rails (~> 2.25) + rubocop-rspec (~> 3.0) + rubocop-rspec_rails (~> 2.30) + rubocop-rubycw (~> 0.1) + selenium-webdriver (~> 4.9) + simplecov (~> 0.22.0) simplecov-cobertura (~> 2.1.0) + spring (~> 4.0) + spring-watcher-listen (~> 2.0) w3c_rspec_validators (~> 0.3.0) - webmock (~> 3.6) + webmock (~> 3.18) wisper-rspec (~> 1.0) - decidim-forms (0.27.5) - decidim-core (= 0.27.5) + decidim-forms (0.29.1) + decidim-core (= 0.29.1) wicked_pdf (~> 2.1) - wkhtmltopdf-binary (~> 0.12) - decidim-generators (0.27.5) - decidim-core (= 0.27.5) - decidim-meetings (0.27.5) - decidim-core (= 0.27.5) - decidim-forms (= 0.27.5) + wkhtmltopdf-binary (= 0.12.6.6) + decidim-generators (0.29.1) + decidim-core (= 0.29.1) + decidim-meetings (0.29.1) + decidim-core (= 0.29.1) + decidim-forms (= 0.29.1) icalendar (~> 2.5) - decidim-pages (0.27.5) - decidim-core (= 0.27.5) - decidim-participatory_processes (0.27.5) - decidim-core (= 0.27.5) - decidim-proposals (0.27.5) - decidim-comments (= 0.27.5) - decidim-core (= 0.27.5) - doc2text (~> 0.4.5) + decidim-pages (0.29.1) + decidim-core (= 0.29.1) + decidim-participatory_processes (0.29.1) + decidim-core (= 0.29.1) + decidim-proposals (0.29.1) + decidim-comments (= 0.29.1) + decidim-core (= 0.29.1) + doc2text (~> 0.4.7) redcarpet (~> 3.5, >= 3.5.1) - decidim-sortitions (0.27.5) - decidim-admin (= 0.27.5) - decidim-comments (= 0.27.5) - decidim-core (= 0.27.5) - decidim-proposals (= 0.27.5) - decidim-surveys (0.27.5) - decidim-core (= 0.27.5) - decidim-forms (= 0.27.5) - decidim-templates (= 0.27.5) - decidim-system (0.27.5) + decidim-sortitions (0.29.1) + decidim-admin (= 0.29.1) + decidim-comments (= 0.29.1) + decidim-core (= 0.29.1) + decidim-proposals (= 0.29.1) + decidim-surveys (0.29.1) + decidim-core (= 0.29.1) + decidim-forms (= 0.29.1) + decidim-system (0.29.1) active_link_to (~> 1.0) - decidim-core (= 0.27.5) + decidim-core (= 0.29.1) devise (~> 4.7) devise-i18n (~> 1.2) devise_invitable (~> 2.0, >= 2.0.9) - decidim-templates (0.27.5) - decidim-core (= 0.27.5) - decidim-forms (= 0.27.5) - decidim-verifications (0.27.5) - decidim-core (= 0.27.5) - declarative-builder (0.1.0) - declarative-option (< 0.2.0) + decidim-verifications (0.29.1) + decidim-core (= 0.29.1) + declarative-builder (0.2.0) + trailblazer-option (~> 0.1.0) declarative-option (0.1.0) - descendants_tracker (0.0.4) - thread_safe (~> 0.3, >= 0.3.1) devise (4.9.4) bcrypt (~> 3.0) orm_adapter (~> 0.1) railties (>= 4.1.0) responders warden (~> 1.2.3) - devise-i18n (1.12.0) + devise-i18n (1.11.0) devise (>= 4.9.0) devise_invitable (2.0.9) actionmailer (>= 5.0) devise (>= 4.6) diff-lcs (1.5.1) - diffy (3.4.2) + diffy (3.4.3) doc2text (0.4.7) nokogiri (>= 1.13.2, < 1.17.0) rubyzip (~> 2.3.0) - docile (1.4.0) - doorkeeper (5.6.9) + docile (1.4.1) + doorkeeper (5.8.1) railties (>= 5) doorkeeper-i18n (4.0.1) - dumb_delegator (1.0.0) - erb_lint (0.0.37) + erb_lint (0.4.0) activesupport - better_html (~> 1.0.7) - html_tokenizer + better_html (>= 2.0.1) parser (>= 2.7.1.4) rainbow rubocop smart_properties erbse (0.1.4) temple - erubi (1.12.0) + erubi (1.13.1) escape_utils (1.3.0) - excon (0.110.0) - execjs (2.9.1) + excon (1.2.3) 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) - factory_bot (~> 4.11.1) - railties (>= 3.0.0) - faker (3.3.1) + factory_bot (6.5.0) + activesupport (>= 5.0.0) + factory_bot_rails (6.4.4) + factory_bot (~> 6.5) + railties (>= 5.0.0) + faker (3.5.1) i18n (>= 1.8.11, < 2) - faraday (2.9.0) - faraday-net_http (>= 2.0, < 3.2) - faraday-net_http (3.1.0) - net-http - ffi (1.16.3) + faraday (2.12.2) + faraday-net_http (>= 2.0, < 3.5) + json + logger + faraday-net_http (3.4.0) + net-http (>= 0.5.0) + ffi (1.17.1-x86_64-darwin) + ffi (1.17.1-x86_64-linux-gnu) file_validators (3.0.0) activemodel (>= 3.2) mime-types (>= 1.0) - fog-core (2.4.0) + fog-core (2.6.0) builder - excon (~> 0.71) + excon (~> 1.0) formatador (>= 0.2, < 2.0) mime-types fog-local (0.8.0) @@ -400,50 +381,53 @@ GEM activesupport (>= 4.1, < 7.1) railties (>= 4.1, < 7.1) gemoji (3.0.1) - geocoder (1.8.2) + geocoder (1.8.5) + base64 (>= 0.1.0) + csv (>= 3.0.0) globalid (1.2.1) activesupport (>= 6.1) - graphql (1.12.24) - graphql-docs (2.1.0) - commonmarker (~> 0.16) + graphql (2.2.16) + base64 + graphql-docs (4.0.0) + commonmarker (~> 0.23, >= 0.23.6) + dartsass (~> 1.49) escape_utils (~> 1.2) extended-markdown-filter (~> 0.4) gemoji (~> 3.0) - graphql (~> 1.12) - html-pipeline (~> 2.9) - sass (~> 3.4) - hashdiff (1.1.0) + graphql (~> 2.0) + html-pipeline (~> 2.14, >= 2.14.3) + hashdiff (1.1.2) hashie (5.0.0) - highline (3.0.1) - hkdf (0.3.0) + highline (3.1.2) + reline html-pipeline (2.14.3) activesupport (>= 2) nokogiri (>= 1.4) - html_tokenizer (0.0.8) htmlentities (4.3.4) - i18n (1.14.4) + i18n (1.14.6) concurrent-ruby (~> 1.0) - i18n-tasks (0.9.37) + i18n-tasks (1.0.14) activesupport (>= 4.0.2) ast (>= 2.1.0) erubi highline (>= 2.0.0) i18n - parser (>= 2.2.3.0) + parser (>= 3.2.2.1) rails-i18n rainbow (>= 2.2.2, < 4.0) terminal-table (>= 1.5.1) - icalendar (2.10.1) + icalendar (2.10.3) ice_cube (~> 0.16) - ice_cube (0.16.4) - ice_nine (0.11.2) - image_processing (1.12.2) + ostruct + ice_cube (0.17.0) + image_processing (1.13.0) mini_magick (>= 4.9.5, < 5) ruby-vips (>= 2.0.17, < 3) invisible_captcha (0.13.0) rails (>= 3.2.0) - json (2.7.2) - jwt (2.8.1) + io-console (0.8.0) + json (2.9.1) + jwt (2.10.1) base64 kaminari (1.2.2) activesupport (>= 4.1.0) @@ -457,24 +441,24 @@ GEM activerecord kaminari-core (= 1.2.2) kaminari-core (1.2.2) - kramdown (2.4.0) - rexml - kramdown-parser-gfm (1.1.0) - kramdown (~> 2.0) - launchy (2.5.2) + language_server-protocol (3.17.0.3) + launchy (3.0.1) addressable (~> 2.8) + childprocess (~> 5.0) letter_opener (1.10.0) launchy (>= 2.2, < 4) - letter_opener_web (1.4.1) - actionmailer (>= 3.2) - letter_opener (~> 1.0) - railties (>= 3.2) + letter_opener_web (2.0.0) + actionmailer (>= 5.2) + letter_opener (~> 1.7) + railties (>= 5.2) + rexml listen (3.9.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) - loofah (2.19.1) + logger (1.6.4) + loofah (2.24.0) crass (~> 1.0.2) - nokogiri (>= 1.5.9) + nokogiri (>= 1.12.0) mail (2.8.1) mini_mime (>= 0.1.1) net-imap @@ -482,42 +466,32 @@ GEM net-smtp marcel (1.0.4) matrix (0.4.2) - mdl (0.13.0) - kramdown (~> 2.3) - kramdown-parser-gfm (~> 1.1) - mixlib-cli (~> 2.1, >= 2.1.1) - mixlib-config (>= 2.2.1, < 4) - mixlib-shellout - method_source (1.0.0) - mime-types (3.5.2) + method_source (1.1.0) + mime-types (3.6.0) + logger mime-types-data (~> 3.2015) - mime-types-data (3.2024.0305) - mini_magick (4.12.0) + mime-types-data (3.2025.0107) + mini_magick (4.13.2) mini_mime (1.1.5) - minitest (5.22.3) - mixlib-cli (2.1.8) - mixlib-config (3.0.27) - tomlrb - mixlib-shellout (3.2.7) - chef-utils - msgpack (1.7.2) - multi_xml (0.6.0) - mustache (1.1.1) - net-http (0.4.1) + minitest (5.25.4) + msgpack (1.7.5) + multi_xml (0.7.1) + bigdecimal (~> 3.1) + net-http (0.6.0) uri - net-imap (0.4.10) + net-imap (0.5.5) date net-protocol net-pop (0.1.2) net-protocol net-protocol (0.2.2) timeout - net-smtp (0.5.0) + net-smtp (0.3.4) net-protocol - nio4r (2.7.1) - nokogiri (1.16.4-arm64-darwin) + nio4r (2.7.4) + nokogiri (1.16.8-x86_64-darwin) racc (~> 1.4) - nokogiri (1.16.4-x86_64-linux) + nokogiri (1.16.8-x86_64-linux) racc (~> 1.4) oauth (1.1.0) oauth-tty (~> 1.0, >= 1.0.1) @@ -538,50 +512,55 @@ GEM rack-protection omniauth-facebook (5.0.0) omniauth-oauth2 (~> 1.2) - omniauth-google-oauth2 (1.1.2) - jwt (>= 2.0) + omniauth-google-oauth2 (1.2.0) + jwt (>= 2.9) oauth2 (~> 2.0) omniauth (~> 2.0) omniauth-oauth2 (~> 1.8) - omniauth-oauth (1.2.0) + omniauth-oauth (1.2.1) oauth omniauth (>= 1.0, < 3) + rack (>= 1.6.2, < 4) omniauth-oauth2 (1.8.0) oauth2 (>= 1.4, < 3) omniauth (~> 2.0) - omniauth-rails_csrf_protection (1.0.1) + omniauth-rails_csrf_protection (1.0.2) actionpack (>= 4.2) omniauth (~> 2.0) omniauth-twitter (1.4.0) omniauth-oauth (~> 1.1) rack + openssl (3.2.0) orm_adapter (0.5.0) + ostruct (0.6.1) paper_trail (12.3.0) activerecord (>= 5.2) request_store (~> 1.1) - parallel (1.24.0) - parallel_tests (3.13.0) + parallel (1.26.3) + parallel_tests (4.8.0) parallel - parser (3.3.0.5) + parser (3.3.6.0) ast (~> 2.4.1) racc - pg (1.1.4) - pg_search (2.3.6) - activerecord (>= 5.2) - activesupport (>= 5.2) - premailer (1.23.0) + pg (1.4.6) + pg_search (2.3.7) + activerecord (>= 6.1) + activesupport (>= 6.1) + premailer (1.27.0) addressable - css_parser (>= 1.12.0) + css_parser (>= 1.19.0) htmlentities (>= 4.0.0) premailer-rails (1.12.0) actionmailer (>= 3) net-smtp premailer (~> 1.7, >= 1.7.9) - public_suffix (5.0.5) - puma (5.6.8) + psych (4.0.6) + stringio + public_suffix (6.0.1) + puma (6.5.0) nio4r (~> 2.0) - racc (1.7.3) - rack (2.2.9) + racc (1.8.1) + rack (2.2.10) rack-attack (6.7.0) rack (>= 1.0, < 4) rack-cors (1.1.1) @@ -591,23 +570,22 @@ GEM rack (~> 2.2, >= 2.2.4) rack-proxy (0.7.7) rack - rack-test (2.1.0) + rack-test (2.2.0) rack (>= 1.3) - rails (6.1.7.7) - actioncable (= 6.1.7.7) - actionmailbox (= 6.1.7.7) - actionmailer (= 6.1.7.7) - actionpack (= 6.1.7.7) - actiontext (= 6.1.7.7) - actionview (= 6.1.7.7) - activejob (= 6.1.7.7) - activemodel (= 6.1.7.7) - activerecord (= 6.1.7.7) - activestorage (= 6.1.7.7) - activesupport (= 6.1.7.7) + rails (7.0.8.7) + actioncable (= 7.0.8.7) + actionmailbox (= 7.0.8.7) + actionmailer (= 7.0.8.7) + actionpack (= 7.0.8.7) + actiontext (= 7.0.8.7) + actionview (= 7.0.8.7) + activejob (= 7.0.8.7) + activemodel (= 7.0.8.7) + activerecord (= 7.0.8.7) + activestorage (= 7.0.8.7) + activesupport (= 7.0.8.7) bundler (>= 1.15.0) - railties (= 6.1.7.7) - sprockets-rails (>= 2.0.0) + railties (= 7.0.8.7) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) actionview (>= 5.0.1.rc1) @@ -616,152 +594,160 @@ GEM activesupport (>= 5.0.0) minitest nokogiri (>= 1.6) - rails-html-sanitizer (1.5.0) - loofah (~> 2.19, >= 2.19.1) - rails-i18n (6.0.0) + 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) + rails-i18n (7.0.10) i18n (>= 0.7, < 2) - railties (>= 6.0.0, < 7) - railties (6.1.7.7) - actionpack (= 6.1.7.7) - activesupport (= 6.1.7.7) + railties (>= 6.0.0, < 8) + railties (7.0.8.7) + actionpack (= 7.0.8.7) + activesupport (= 7.0.8.7) method_source rake (>= 12.2) thor (~> 1.0) + zeitwerk (~> 2.5) rainbow (3.1.1) rake (13.2.1) - ransack (2.4.2) - activerecord (>= 5.2.4) - activesupport (>= 5.2.4) + ransack (3.2.1) + activerecord (>= 6.1.5) + activesupport (>= 6.1.5) i18n rb-fsevent (0.11.2) - rb-inotify (0.10.1) + rb-inotify (0.11.1) ffi (~> 1.0) redcarpet (3.6.0) redis (4.8.1) - regexp_parser (2.9.0) + regexp_parser (2.10.0) + reline (0.6.0) + io-console (~> 0.5) request_store (1.5.1) rack (>= 1.4) responders (3.1.1) actionpack (>= 5.2) railties (>= 5.2) - rexml (3.2.6) + rexml (3.4.0) rspec (3.13.0) rspec-core (~> 3.13.0) rspec-expectations (~> 3.13.0) rspec-mocks (~> 3.13.0) - rspec-cells (0.3.9) + rspec-cells (0.3.10) cells (>= 4.0.0, < 6.0.0) - rspec-rails (>= 3.0.0, < 6.2.0) - rspec-core (3.13.0) + rspec-rails (>= 3.0.0) + rspec-core (3.13.2) rspec-support (~> 3.13.0) - rspec-expectations (3.13.0) + rspec-expectations (3.13.3) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - rspec-html-matchers (0.9.4) + rspec-html-matchers (0.10.0) nokogiri (~> 1) - rspec (>= 3.0.0.a, < 4) - rspec-mocks (3.13.0) + rspec (>= 3.0.0.a) + rspec-mocks (3.13.2) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - rspec-rails (4.1.2) - actionpack (>= 4.2) - activesupport (>= 4.2) - railties (>= 4.2) - rspec-core (~> 3.10) - rspec-expectations (~> 3.10) - rspec-mocks (~> 3.10) - rspec-support (~> 3.10) + rspec-rails (6.1.5) + actionpack (>= 6.1) + activesupport (>= 6.1) + railties (>= 6.1) + rspec-core (~> 3.13) + rspec-expectations (~> 3.13) + rspec-mocks (~> 3.13) + rspec-support (~> 3.13) rspec-retry (0.6.2) rspec-core (> 3.3) - rspec-support (3.13.1) - rspec_junit_formatter (0.3.0) + rspec-support (3.13.2) + rspec_junit_formatter (0.6.0) rspec-core (>= 2, < 4, != 2.12.0) - rubocop (1.28.2) + rubocop (1.65.1) + json (~> 2.3) + language_server-protocol (>= 3.17.0) parallel (~> 1.10) - parser (>= 3.1.0.0) + parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 1.8, < 3.0) - rexml - rubocop-ast (>= 1.17.0, < 2.0) + regexp_parser (>= 2.4, < 3.0) + rexml (>= 3.2.5, < 4.0) + rubocop-ast (>= 1.31.1, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 3.0) - rubocop-ast (1.31.2) - parser (>= 3.3.0.4) - rubocop-faker (1.1.0) + unicode-display_width (>= 2.4.0, < 3.0) + rubocop-ast (1.37.0) + parser (>= 3.3.1.0) + rubocop-capybara (2.21.0) + rubocop (~> 1.41) + rubocop-factory_bot (2.26.1) + rubocop (~> 1.61) + rubocop-faker (1.2.0) faker (>= 2.12.0) - rubocop (>= 0.82.0) - rubocop-rails (2.15.2) + rubocop (>= 1.13.0) + rubocop-performance (1.23.1) + rubocop (>= 1.48.1, < 2.0) + rubocop-ast (>= 1.31.1, < 2.0) + rubocop-rails (2.28.0) activesupport (>= 4.2.0) rack (>= 1.1) - rubocop (>= 1.7.0, < 2.0) - rubocop-rspec (2.11.1) - rubocop (~> 1.19) + rubocop (>= 1.52.0, < 2.0) + rubocop-ast (>= 1.31.1, < 2.0) + rubocop-rspec (3.3.0) + rubocop (~> 1.61) + rubocop-rspec_rails (2.30.0) + rubocop (~> 1.61) + rubocop-rspec (~> 3, >= 3.0.1) + rubocop-rubycw (0.1.6) + rubocop (~> 1.0) ruby-progressbar (1.13.0) - ruby-vips (2.2.1) + ruby-vips (2.2.2) ffi (~> 1.12) - rubyXL (3.4.27) + logger + rubyXL (3.4.33) nokogiri (>= 1.10.8) rubyzip (>= 1.3.0) rubyzip (2.3.2) - 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) + selenium-webdriver (4.27.0) + base64 (~> 0.2) + logger (~> 1.4) rexml (~> 3.2, >= 3.2.5) - rubyzip (>= 1.2.2) - semantic_range (3.0.0) - seven_zip_ruby (1.3.0) - simplecov (0.21.2) + rubyzip (>= 1.2.2, < 3.0) + websocket (~> 1.0) + semantic_range (3.1.0) + shakapacker (7.1.0) + activesupport (>= 5.2) + rack-proxy (>= 0.6.1) + railties (>= 5.2) + semantic_range (>= 2.3.0) + simplecov (0.22.0) docile (~> 1.1) simplecov-html (~> 0.11) simplecov_json_formatter (~> 0.1) simplecov-cobertura (2.1.0) rexml simplecov (~> 0.19) - simplecov-html (0.12.3) + simplecov-html (0.13.1) simplecov_json_formatter (0.1.4) smart_properties (1.17.0) snaky_hash (2.0.1) hashie 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) + spring (4.2.1) + spring-watcher-listen (2.1.0) listen (>= 2.7, < 4.0) - spring (>= 1.2, < 3.0) - sprockets (4.2.1) - concurrent-ruby (~> 1.0) - rack (>= 2.2.4, < 4) - sprockets-rails (3.4.2) - actionpack (>= 5.2) - activesupport (>= 5.2) - sprockets (>= 3.0.0) - ssrf_filter (1.1.2) + spring (>= 4) + stringio (3.1.2) temple (0.10.3) terminal-table (3.0.2) unicode-display_width (>= 1.1.1, < 3) - thor (1.3.1) - thread_safe (0.3.6) - tilt (2.3.0) - timeout (0.4.1) - tomlrb (2.0.3) + thor (1.3.2) + tilt (2.5.0) + timeout (0.4.3) + trailblazer-option (0.1.2) tzinfo (2.0.6) concurrent-ruby (~> 1.0) uber (0.1.0) - unicode-display_width (2.5.0) - uri (0.13.0) - valid_email2 (2.3.1) + unicode-display_width (2.6.0) + uniform_notifier (1.16.0) + uri (1.0.2) + valid_email2 (4.0.6) activemodel (>= 3.2) mail (~> 2.5) version_gem (1.1.4) - virtus (2.0.0) - axiom-types (~> 0.1) - coercible (~> 1.0) - descendants_tracker (~> 0.0, >= 0.0.3) w3c_rspec_validators (0.3.0) rails rspec @@ -772,58 +758,56 @@ GEM rexml (~> 3.2) warden (1.2.9) rack (>= 2.0.9) - web-console (4.0.4) + web-console (4.2.1) actionview (>= 6.0.0) activemodel (>= 6.0.0) bindex (>= 0.4.0) railties (>= 6.0.0) - webmock (3.23.0) + web-push (3.0.1) + jwt (~> 2.0) + openssl (~> 3.0) + webmock (3.24.0) addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) - webpacker (6.0.0.rc.5) - activesupport (>= 5.2) - 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.6) + websocket (1.2.11) + websocket-driver (0.7.7) + base64 websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) - wicked_pdf (2.8.0) + wicked_pdf (2.8.2) activesupport + ostruct wisper (2.0.1) wisper-rspec (1.1.0) wkhtmltopdf-binary (0.12.6.6) xpath (3.2.0) nokogiri (~> 1.8) - zeitwerk (2.6.13) + zeitwerk (2.7.1) PLATFORMS - arm64-darwin-22 + x86_64-darwin x86_64-linux DEPENDENCIES bootsnap (~> 1.4) - brakeman (~> 5.1) + brakeman (~> 6.1) byebug (~> 11.0) climate_control (~> 1.2) - decidim (~> 0.27.0) - decidim-dev (~> 0.27.0) + decidim (~> 0.29.0) + decidim-dev (~> 0.29.0) decidim-emitter! - letter_opener_web (~> 1.3) + letter_opener_web (~> 2.0) listen (~> 3.1) - parallel_tests - puma (>= 5.5.1) + parallel_tests (~> 4.2) + puma (>= 6.3.1) rubocop-faker - spring (~> 2.0) + spring (~> 4.0) spring-watcher-listen (~> 2.0) - web-console (= 4.0.4) + web-console (~> 4.2) RUBY VERSION - ruby 3.0.6p216 + ruby 3.2.2p53 BUNDLED WITH - 2.4.9 + 2.5.22 diff --git a/app/cells/decidim/card_g/show.erb b/app/cells/decidim/card_g/show.erb new file mode 100644 index 0000000..6a75969 --- /dev/null +++ b/app/cells/decidim/card_g/show.erb @@ -0,0 +1,43 @@ +<%= link_to resource_path, class: classes[:default], id: resource_id do %> +
+ <% if has_image? %> + <%= image_tag resource_image_url, alt: alt_title %> + <% else %> + <%= external_icon "media/images/placeholder-card-g.svg", class: "card__placeholder-g" %> + <% end %> +
+ + <% if display_emitter(model) %> +
+
+
+ <%= display_emitter(model).try(:[], :picture) %> +
+
+ <%= display_emitter(model).try(:[], :text) %> +
+
+
+ <%= content_tag title_tag, title, class: title_class %> + <%= description if show_description? %> + + <% if metadata_cell.present? %> +
+ <%= cell metadata_cell, resource, links: false, **options %> +
+ <% end %> +
+
+ <% else %> +
+ <%= content_tag title_tag, title, class: title_class %> + <%= description if show_description? %> + + <% if metadata_cell.present? %> +
+ <%= cell metadata_cell, resource, links: false, **options %> +
+ <% end %> +
+ <% end %> +<% end %> diff --git a/app/cells/decidim/card_m/emitter.erb b/app/cells/decidim/card_m/emitter.erb deleted file mode 100644 index e69de29..0000000 diff --git a/app/cells/decidim/card_m/show.erb b/app/cells/decidim/card_m/show.erb deleted file mode 100644 index f7869ef..0000000 --- a/app/cells/decidim/card_m/show.erb +++ /dev/null @@ -1,24 +0,0 @@ -
-
- <%= render :label if has_label? %> - <%= render :top if render_top? %> - <%= render :image if has_image? %> - <%= render :emitter %> -
- <%= render :header if has_header? %> - -
-
- <%= render :badge if has_badge? %> - <%= description %> -
-
- - <%= render :tags %> -
- - <%= render :data %> - <%= render :status %> - <%= render :footer %> -
-
\ No newline at end of file diff --git a/app/cells/decidim/participatory_processes/content_blocks/highlighted_processes/emitter.erb b/app/cells/decidim/participatory_processes/content_blocks/highlighted_processes/emitter.erb deleted file mode 100644 index d07cb20..0000000 --- a/app/cells/decidim/participatory_processes/content_blocks/highlighted_processes/emitter.erb +++ /dev/null @@ -1 +0,0 @@ -

ZMIRREZ

\ No newline at end of file diff --git a/app/cells/decidim/participatory_processes/content_blocks/highlighted_processes/single_process.erb b/app/cells/decidim/participatory_processes/content_blocks/highlighted_processes/single_process.erb deleted file mode 100644 index 2ffb3e4..0000000 --- a/app/cells/decidim/participatory_processes/content_blocks/highlighted_processes/single_process.erb +++ /dev/null @@ -1,48 +0,0 @@ -<% process = highlighted_items.first %> -<% title_id = "process_title" %> -
-
-

<%= t("active_processes", scope: i18n_scope) %>

-
- <% if process.is_a? Decidim::ParticipatoryProcessGroup %> - <%= render partial: "decidim/participatory_processes/participatory_processes/promoted_process_group.html", locals: { promoted_process_group: process } %> - <% else %> -
-
-
-
- <%= link_to decidim_participatory_processes.participatory_process_path(process), class: "card__link" do %> -

<%= decidim_html_escape(translated_attribute(process.title)) %>

- <% end %> - <%= decidim_sanitize_editor translated_attribute(process.short_description) %> - <%= link_to decidim_participatory_processes.participatory_process_path(process), class: "button small hollow" do %> - <%= decidim_html_escape(translated_attribute(process.title)) %> - <%= t("more_information", scope: i18n_scope) %> - <% end %> -
-
-
-
-
-
- <%= link_to decidim_participatory_processes.participatory_process_path(process), class: "button expanded button--sc" do %> - <%= t("participate_in", resource_name: translated_attribute(process.title), scope: i18n_scope) %> - - <% if process.active_step %> - - <%= t("active_step", scope: i18n_scope) %> - <%= translated_attribute process.active_step.title %> - - <% end %> - <% end %> -
-
-
-
-
-
- <% end %> -
-
- <%= render "_all_processes" %> -
\ No newline at end of file diff --git a/app/cells/decidim/participatory_processes/process_m/emitter.erb b/app/cells/decidim/participatory_processes/process_m/emitter.erb deleted file mode 100644 index 75d4862..0000000 --- a/app/cells/decidim/participatory_processes/process_m/emitter.erb +++ /dev/null @@ -1,10 +0,0 @@ -<% if display_emitter(model) %> -
-
- <%= display_emitter(model).try(:[], :picture) %> -
-
- <%= display_emitter(model).try(:[], :text) %> -
-
-<% end %> \ No newline at end of file diff --git a/app/cells/decidim/participatory_processes/process_s/emitter.erb b/app/cells/decidim/participatory_processes/process_s/emitter.erb deleted file mode 100644 index 06d2174..0000000 --- a/app/cells/decidim/participatory_processes/process_s/emitter.erb +++ /dev/null @@ -1,10 +0,0 @@ -<% if display_emitter(model) %> -
-
- <%= display_emitter(model).try(:[], :picture) %> -
-
- <%= display_emitter(model).try(:[], :text) %> -
-
-<% end %> \ No newline at end of file diff --git a/app/cells/decidim/participatory_processes/process_s/show.erb b/app/cells/decidim/participatory_processes/process_s/show.erb deleted file mode 100644 index fc33b11..0000000 --- a/app/cells/decidim/participatory_processes/process_s/show.erb +++ /dev/null @@ -1,16 +0,0 @@ -
- <%= link_to resource_path, class: "card card--process card--mini" do %> - <%= render :image if has_image? %> - <%= render :emitter %> - -
- <%= title %> - <% if has_step? %> - - <%= t("active_step", scope: i18n_scope) %> - <%= step_title %> - - <% end %> -
- <% end %> -
diff --git a/app/commands/concerns/decidim/emitter/participatory_processes/admin/copy_participatory_process_override.rb b/app/commands/concerns/decidim/emitter/participatory_processes/admin/copy_participatory_process_override.rb index 290632a..62000db 100644 --- a/app/commands/concerns/decidim/emitter/participatory_processes/admin/copy_participatory_process_override.rb +++ b/app/commands/concerns/decidim/emitter/participatory_processes/admin/copy_participatory_process_override.rb @@ -35,7 +35,7 @@ def copy_participatory_process end def copy_participatory_process_attachments - [:hero_image, :banner_image, :emitter].each do |attribute| + [:hero_image, :emitter].each do |attribute| next unless @participatory_process.attached_uploader(attribute).attached? @copied_process.send(attribute).attach(@participatory_process.send(attribute).blob) diff --git a/app/commands/concerns/decidim/emitter/participatory_processes/admin/create_participatory_process_override.rb b/app/commands/concerns/decidim/emitter/participatory_processes/admin/create_participatory_process_override.rb index c2eefee..f0481be 100644 --- a/app/commands/concerns/decidim/emitter/participatory_processes/admin/create_participatory_process_override.rb +++ b/app/commands/concerns/decidim/emitter/participatory_processes/admin/create_participatory_process_override.rb @@ -10,41 +10,13 @@ module CreateParticipatoryProcessOverride included do include ::Decidim::AttachmentAttributesMethods - def attributes - { - organization: form.current_organization, - title: form.title, - subtitle: form.subtitle, - weight: form.weight, - slug: form.slug, - hashtag: form.hashtag, - description: form.description, - short_description: form.short_description, - hero_image: form.hero_image, - banner_image: form.banner_image, - promoted: form.promoted, - scopes_enabled: form.scopes_enabled, - scope: form.scope, - scope_type_max_depth: form.scope_type_max_depth, - private_space: form.private_space, - developer_group: form.developer_group, - local_area: form.local_area, - area: form.area, - target: form.target, - emitter: form.emitter, - emitter_name: form.emitter_name, - participatory_scope: form.participatory_scope, - participatory_structure: form.participatory_structure, - meta_scope: form.meta_scope, - start_date: form.start_date, - end_date: form.end_date, - participatory_process_group: form.participatory_process_group, - participatory_process_type: form.participatory_process_type, - show_metrics: form.show_metrics, - show_statistics: form.show_statistics, - announcement: form.announcement - } - end + fetch_file_attributes :hero_image, :emitter + + fetch_form_attributes :organization, :title, :subtitle, :weight, :slug, :hashtag, :description, + :short_description, :promoted, :scopes_enabled, :scope, :announcement, + :scope_type_max_depth, :private_space, :developer_group, :local_area, :area, :target, + :participatory_scope, :participatory_structure, :meta_scope, :start_date, :end_date, + :participatory_process_group, :participatory_process_type, :emitter_name end end end diff --git a/app/commands/concerns/decidim/emitter/participatory_processes/admin/update_participatory_process_override.rb b/app/commands/concerns/decidim/emitter/participatory_processes/admin/update_participatory_process_override.rb index 8759b78..16723f4 100644 --- a/app/commands/concerns/decidim/emitter/participatory_processes/admin/update_participatory_process_override.rb +++ b/app/commands/concerns/decidim/emitter/participatory_processes/admin/update_participatory_process_override.rb @@ -8,39 +8,13 @@ module UpdateParticipatoryProcessOverride extend ActiveSupport::Concern included do - def attributes - { - title: form.title, - subtitle: form.subtitle, - weight: form.weight, - slug: form.slug, - hashtag: form.hashtag, - promoted: form.promoted, - description: form.description, - short_description: form.short_description, - scopes_enabled: form.scopes_enabled, - scope: form.scope, - scope_type_max_depth: form.scope_type_max_depth, - private_space: form.private_space, - developer_group: form.developer_group, - local_area: form.local_area, - area: form.area, - target: form.target, - participatory_scope: form.participatory_scope, - participatory_structure: form.participatory_structure, - meta_scope: form.meta_scope, - start_date: form.start_date, - end_date: form.end_date, - participatory_process_group: form.participatory_process_group, - participatory_process_type: form.participatory_process_type, - show_metrics: form.show_metrics, - show_statistics: form.show_statistics, - announcement: form.announcement, - emitter_name: form.emitter_name - }.merge( - attachment_attributes(:hero_image, :banner_image, :emitter) - ) - end + fetch_file_attributes :hero_image, :emitter + + fetch_form_attributes :title, :subtitle, :weight, :slug, :hashtag, :promoted, :description, + :short_description, :scopes_enabled, :scope, :scope_type_max_depth, + :private_space, :developer_group, :local_area, :area, :target, :participatory_scope, + :participatory_structure, :meta_scope, :start_date, :end_date, :participatory_process_group, + :participatory_process_type, :announcement, :emitter_name end end end diff --git a/app/forms/concerns/decidim/emitter/admin/participatory_process_form_override.rb b/app/forms/concerns/decidim/emitter/admin/participatory_process_form_override.rb index 6003ade..40bf129 100644 --- a/app/forms/concerns/decidim/emitter/admin/participatory_process_form_override.rb +++ b/app/forms/concerns/decidim/emitter/admin/participatory_process_form_override.rb @@ -81,8 +81,8 @@ def emitter_read_name=(value) def prepare_emitter_name! self.emitter_name = emitter_read_name self.emitter_name = emitter_name_select if emitter_name_select.present? - self.emitter_name = emitter_name_image if emitter_name_image.present? self.emitter_name = nil if remove_emitter + self.emitter_name = emitter_name_image if emitter_name_image.present? end def prepare_emitter! diff --git a/app/helpers/decidim/emitter/emitter_helper.rb b/app/helpers/decidim/emitter/emitter_helper.rb index 894ec96..899e8aa 100644 --- a/app/helpers/decidim/emitter/emitter_helper.rb +++ b/app/helpers/decidim/emitter/emitter_helper.rb @@ -8,7 +8,8 @@ def display_emitter(process) return if process.attached_uploader(:emitter).path.nil? { - picture: image_tag(process.attached_uploader(:emitter).path), + picture: image_tag(process.attached_uploader(:emitter).path, + { alt: t("emitter_img_alt_test", developer_group: translated_attribute(process.developer_group), scope: "decidim.participatory_processes.emitter") }), text: t("emitter_text", developer_group: translated_attribute(process.developer_group), scope: "decidim.participatory_processes.emitter") diff --git a/app/packs/stylesheets/decidim/emitter/emitter.scss b/app/packs/stylesheets/decidim/emitter/emitter.scss index 8912ba3..547a89e 100644 --- a/app/packs/stylesheets/decidim/emitter/emitter.scss +++ b/app/packs/stylesheets/decidim/emitter/emitter.scss @@ -1,6 +1,10 @@ /* css for decidim_emitter */ -.emitter-header .card-data__item{ +.card-data-highlight { + display: flex; + flex-direction: column; +} +.card-data-header .card-data__item{ border-bottom: 1px solid #e8e8e8; margin-bottom: 0px; @@ -8,3 +12,38 @@ max-width: 60%; } } +.card-data-header { + display: flex; + flex-wrap: wrap; + list-style: none; + margin: 0; +} +.card-data__item { + display: inline-flex; + flex-direction: column; + align-items: center; + justify-content: center; + flex-basis: 33.33%; + flex-grow: 1; + text-align: center; + font-size: 0.9375rem; + line-height: 1; + color: #726a70; + padding: 0.5em; + border-right: 1px solid #e8e8e8; + margin-right: -1px; + border-top: 1px solid #e8e8e8; + margin-top: -1px; +} + +/* responsive */ +@media (min-width: 640px) { + .card-data-highlight { + width: 100%; + } +} +@media (min-width: 768px) { + .card-data-highlight { + width: 50%; + } +} diff --git a/app/views/decidim/participatory_processes/admin/participatory_processes/_form.html.erb b/app/views/decidim/participatory_processes/admin/participatory_processes/_form.html.erb index 091001b..b2518a0 100644 --- a/app/views/decidim/participatory_processes/admin/participatory_processes/_form.html.erb +++ b/app/views/decidim/participatory_processes/admin/participatory_processes/_form.html.erb @@ -1,227 +1,274 @@ -
-
-

<%= t(".title") %>

-
- -
-
- <%= form.translated :text_field, :title, autofocus: true %> -
- -
- <%= form.translated :text_field, :subtitle %> -
- -
- <%= form.number_field :weight %> +
+
+
+
- -
-
- <%= form.text_field :slug %> -

- <%== t(".slug_help", url: decidim_form_slug_url(:processes, form.object.slug)) %> -

+
+
+ <%= form.translated :text_field, :title, autofocus: true, aria: { label: :title } %>
-
- <%= form.text_field :hashtag %> +
+ <%= form.translated :text_field, :subtitle, aria: { label: :subtitle } %>
-
-
- <%= form.translated :editor, :short_description %> -
+
+ <%= form.number_field :weight %> +
-
- <%= form.translated :editor, :description %> -
+
+
+ <%= form.text_field :slug, help_text: t(".slug_help_html", url: decidim_form_slug_url(:processes, form.object.slug)) %> +
-
- <%= form.translated :editor, :announcement %> -

<%== t(".announcement_help") %>

-
-
+
+ <%= form.text_field :hashtag %> +
+
-
-

<%= t(".duration") %>

-
+
+ <%= form.translated :editor, :short_description, aria: { label: :short_description } %> +
-
-
-
- <%= form.date_field :start_date %> +
+ <%= form.translated :editor, :description, aria: { label: :description } %>
-
- <%= form.date_field :end_date %> +
+ <%= form.translated :editor, :announcement, help_text: t(".announcement_help") %>
-
-

<%= t(".images") %>

-
+
+
+ +
-
-
-
- <%= form.upload :hero_image %> -
+
+
+
+ <%= form.date_field :start_date %> +
-
- <%= form.upload :banner_image %> +
+ <%= form.date_field :end_date %> +
-
-

<%= t(".metadata") %>

-
- -
-
-
- <%= form.translated :text_field, :developer_group %> -
+
+
+ +
-
- <%= form.translated :text_field, :local_area %> +
+
+
+ <%= form.upload :hero_image, button_class: "button button__sm button__transparent-secondary" %> +
+
-
- <%= form.translated :text_field, :meta_scope %> +
+
+
+
+
+
+ <%= form.translated :text_field, :developer_group, aria: { label: :developer_group } %> +
+ +
+ <%= form.translated :text_field, :local_area, aria: { label: :local_area } %> +
+
-
- <%= form.translated :text_field, :target %> -
+
+ <%= form.translated :text_field, :meta_scope, aria: { label: :meta_scope } %> +
-
- <%= form.translated :text_field, :participatory_scope %> -
+
+ <%= form.translated :text_field, :target, aria: { label: :target } %> +
-
- <%= form.translated :text_field, :participatory_structure %> -
-
+
+ <%= form.translated :text_field, :participatory_scope, aria: { label: :participatory_scope } %> +
-
-

<%= t(".filters") %>

+
+ <%= form.translated :text_field, :participatory_structure, aria: { label: :participatory_structure } %> +
+
-
-
- <%= form.check_box :scopes_enabled %> +
+
+
+
+
+ <%= form.check_box :scopes_enabled %> +
-
- <%= scopes_picker_field form, :scope_id, root: nil %> +
+ <%= scopes_select_field form, :scope_id, root: nil %> +
-
+
<%= form.collection_select :scope_type_max_depth_id, organization_scope_depths, :id, :name, scope_type_depth_select_options, scope_type_depth_select_html_options %> -

- <%== t(".scope_type_max_depth_help") %> -

-
-
- <%= form.areas_select :area_id, - areas_for_select(current_organization), - selected: current_participatory_process.try(:decidim_area_id), - include_blank: t(".select_an_area") %> +
+ <%= form.areas_select :area_id, + areas_for_select(current_organization), + selected: current_participatory_process.try(:decidim_area_id), + include_blank: t(".select_an_area") %> +
-
-

<%= t(".visbility") %>

-
- -
-
- <% if process_groups_for_select %> - <%= form.select :participatory_process_group_id, - process_groups_for_select, - include_blank: t(".select_process_group") %> - <% end %> +
+
+
+
+
+ <% if process_groups_for_select %> + <%= form.select :participatory_process_group_id, + process_groups_for_select, + include_blank: t(".select_process_group") %> + <% end %> +
-
- <%= form.check_box :private_space %> -
-
- <%= form.check_box :promoted %> +
+ <%= form.check_box :private_space %> +
+
+ <%= form.check_box :promoted %> +
-
-

<%= t(".emitter") %>

-
- -
-
- <%= form.select :emitter_select, options_for_select(emitter_options), { :include_blank => true, label: t(".emitter_logo_select") }, class: "select-emitter" %> -
-
- -
- <%= form.text_field :emitter_name_image, label: t(".emitter_name") %> -
-
- <%= form.upload :emitter_image, label: t(".emitter_logo"), help_i18n_scope: "decidim.admin.forms.file_help.emitter" %> +
+
+
- <% if form.object.emitter_name.present? %> + +
- <%= form.text_field :emitter_read_name, { :readonly => true, :label => t(".emitter_now") } %> + <%= form.select :emitter_select, options_for_select(emitter_options), { :include_blank => true, label: t(".emitter_logo_select") }, class: "select-emitter" %>
- <% end %> -
- -
-

<%= t(".related_processes") %>

-
- -
-
- <%= form.select( - :related_process_ids, - @form.processes.order(title: :asc).map{|process| [translated_attribute(process.title), process.id]}, - { include_blank: true }, - { multiple: true, class: "chosen-select" } - ) %> +
+ +
+
+ <%= form.text_field :emitter_name_image, label: t(".emitter_name") %> +
+
+
+
+ <%= form.upload :emitter_image, label: t(".emitter_logo"), help_i18n_scope: "decidim.admin.forms.file_help.emitter", button_class: "button button__sm button__transparent-secondary" %> +
+
+ <% if form.object.emitter_name.present? %> +
+ <%= form.text_field :emitter_read_name, { :readonly => true, :label => t(".emitter_now") } %> +
+ <% end %>
-
-

<%= t(".other") %>

-
- -
-
- <%= form.check_box :show_statistics %> + + +
+
+ +
+ +
+ <% if @form.participatory_process_types_for_select.present? %> +
+ <%= form.select( + :participatory_process_type_id, + @form.participatory_process_types_for_select, + include_blank: t(".select_participatory_process_type") + ) %> +
+ <% end %> +
+
+<%= append_javascript_pack_tag "decidim_participatory_processes_admin" %> -<%= javascript_pack_tag "decidim_participatory_processes_admin" %> \ No newline at end of file diff --git a/app/views/decidim/participatory_processes/participatory_processes/_promoted_process.html.erb b/app/views/decidim/participatory_processes/participatory_processes/_promoted_process.html.erb deleted file mode 100644 index ddd94e2..0000000 --- a/app/views/decidim/participatory_processes/participatory_processes/_promoted_process.html.erb +++ /dev/null @@ -1,49 +0,0 @@ -
-
-
- <% if display_emitter(promoted_process) %> -
-
- <%= display_emitter(promoted_process).try(:[], :picture) %> -
-
- <%= display_emitter(promoted_process).try(:[], :text) %> -
-
- <% end %> -
- <%= link_to participatory_process_path(promoted_process), class: "card__link" do %> -

<%= decidim_html_escape(translated_attribute(promoted_process.title)).html_safe %>

- <% end %> - <%= decidim_sanitize_editor html_truncate(translated_attribute(promoted_process.short_description), length: 630, separator: "...") %> - <%= link_to participatory_process_path(promoted_process), class: "button small hollow card__button" do %> - <%= decidim_html_escape(translated_attribute(promoted_process.title)) %> - <%= t("participatory_processes.promoted_process.more_info", scope: "layouts.decidim") %> - <% end %> -
-
-
-
-
-
- <%= link_to participatory_process_cta_path(promoted_process), class: "button expanded button--sc" do %> - <% if translated_in_current_locale?(promoted_process.active_step&.cta_text) %> - <%= translated_attribute(promoted_process.active_step.cta_text) %> - - <% else %> - <%= t(promoted_process.cta_button_text_key_accessible, resource_name: translated_attribute(promoted_process.title), scope: "layouts.decidim.participatory_processes.promoted_process") %> - - <% end %> - <% if promoted_process.active_step %> - - <%= t("participatory_processes.promoted_process.active_step", scope: "layouts.decidim") %> <%= translated_attribute promoted_process.active_step.title %> - - <% end %> - <% end %> -
-
-
-
-
-
\ No newline at end of file diff --git a/config/i18n-tasks.yml b/config/i18n-tasks.yml index 517d727..7c7f902 100644 --- a/config/i18n-tasks.yml +++ b/config/i18n-tasks.yml @@ -4,7 +4,9 @@ base_locale: en locales: [en] ignore_unused: - - "decidim.components.emitter.name" + - decidim.components.emitter.name + - decidim.admin.forms.file_help.emitter.* ignore_missing: - decidim.participatory_processes.scopes.global + - decidim.participatory_processes.admin.participatory_processes.form.* diff --git a/config/locales/en.yml b/config/locales/en.yml index dcaa1e2..e0bcaae 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -23,3 +23,4 @@ en: emitter_now: Emitter now emitter: emitter_text: Consultation published by %{developer_group} + emitter_img_alt_test: Logo of %{developer_group} diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 34b60bb..993be55 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -23,3 +23,4 @@ fr: emitter_now: Émetteur actuel emitter: emitter_text: Publié par %{developer_group} + emitter_img_alt_test: Logo de %{developer_group} diff --git a/decidim-emitter.gemspec b/decidim-emitter.gemspec index 0ddb966..95ff6d7 100644 --- a/decidim-emitter.gemspec +++ b/decidim-emitter.gemspec @@ -18,7 +18,7 @@ Gem::Specification.new do |s| "source_code_uri" => "https://github.com/OpenSourcePolitics/decidim-module-emitter", "rubygems_mfa_required" => "true" } - s.required_ruby_version = "~> 3.0" + s.required_ruby_version = "~> 3.2" s.name = "decidim-emitter" s.summary = "Decidim module for adding new emitters to participatory processes" @@ -31,8 +31,8 @@ Gem::Specification.new do |s| end end - s.add_dependency "decidim-core", "~> #{Decidim::Emitter::DECIDIM_VERSION}" - s.add_dependency "decidim-participatory_processes", "~> #{Decidim::Emitter::DECIDIM_VERSION}" + s.add_dependency "decidim-core", Decidim::Emitter::DECIDIM_VERSION.to_s + s.add_dependency "decidim-participatory_processes", Decidim::Emitter::DECIDIM_VERSION.to_s - s.add_development_dependency "decidim-dev", "~> #{Decidim::Emitter::DECIDIM_VERSION}" + # s.add_development_dependency "decidim-dev", Decidim::Emitter::DECIDIM_VERSION.to_s end diff --git a/lib/decidim/emitter.rb b/lib/decidim/emitter.rb index 6d612a1..ff6e711 100644 --- a/lib/decidim/emitter.rb +++ b/lib/decidim/emitter.rb @@ -3,7 +3,6 @@ require "decidim/emitter/admin" require "decidim/emitter/engine" require "decidim/emitter/admin_engine" -require "decidim/emitter/component" module Decidim # This namespace holds the logic of the `Emitter` component. This component diff --git a/lib/decidim/emitter/component.rb b/lib/decidim/emitter/component.rb deleted file mode 100644 index fba3477..0000000 --- a/lib/decidim/emitter/component.rb +++ /dev/null @@ -1,40 +0,0 @@ -# frozen_string_literal: true - -require "decidim/components/namer" - -Decidim.register_component(:emitter) do |component| - component.engine = Decidim::Emitter::Engine - component.admin_engine = Decidim::Emitter::AdminEngine - component.icon = "decidim/emitter/icon.svg" - - # component.on(:before_destroy) do |instance| - # # Code executed before removing the component - # end - - # These actions permissions can be configured in the admin panel - # component.actions = %w() - - # component.settings(:global) do |settings| - # # Add your global settings - # # Available types: :integer, :boolean - # # settings.attribute :vote_limit, type: :integer, default: 0 - # end - - # component.settings(:step) do |settings| - # # Add your settings per step - # end - - # component.register_resource(:some_resource) do |resource| - # # Register a optional resource that can be references from other resources. - # resource.model_class_name = "Decidim::Emitter::SomeResource" - # resource.template = "decidim/emitter/some_resources/linked_some_resources" - # end - - # component.register_stat :some_stat do |context, start_at, end_at| - # # Register some stat number to the application - # end - - # component.seeds do |participatory_space| - # # Add some seeds for this component - # end -end diff --git a/lib/decidim/emitter/engine.rb b/lib/decidim/emitter/engine.rb index 6ff57d5..480c038 100644 --- a/lib/decidim/emitter/engine.rb +++ b/lib/decidim/emitter/engine.rb @@ -16,7 +16,7 @@ class Engine < ::Rails::Engine end config.to_prepare do - ActionView::Base.include(Decidim::Emitter::EmitterHelper) + ActiveSupport.on_load(:action_view) { include Decidim::Emitter::EmitterHelper } Decidim::ViewModel.include(Decidim::Emitter::EmitterHelper) end diff --git a/lib/decidim/emitter/test/factories.rb b/lib/decidim/emitter/test/factories.rb index b50559c..0686693 100644 --- a/lib/decidim/emitter/test/factories.rb +++ b/lib/decidim/emitter/test/factories.rb @@ -6,7 +6,7 @@ FactoryBot.define do factory :emitter_component, parent: :component do name { Decidim::Components::Namer.new(participatory_space.organization.available_locales, :emitter).i18n_name } - manifest_name :emitter + manifest_name { :emitter } participatory_space { create(:participatory_process, :with_steps) } end end @@ -21,7 +21,7 @@ description { Decidim::Faker::Localized.wrapped("

", "

") { generate_localized_title } } organization hero_image { Decidim::Dev.test_file("city.jpeg", "image/jpeg") } # Keep after organization - banner_image { Decidim::Dev.test_file("city2.jpeg", "image/jpeg") } # Keep after organization + # banner_image { Decidim::Dev.test_file("city2.jpeg", "image/jpeg") } # Keep after organization published_at { Time.current } meta_scope { Decidim::Faker::Localized.word } developer_group { generate_localized_title } @@ -65,7 +65,7 @@ create(:participatory_process_step, active: true, end_date: evaluator.current_step_ends, - participatory_process: participatory_process) + participatory_process:) participatory_process.reload participatory_process.steps.reload end @@ -88,7 +88,7 @@ trait :with_scope do scopes_enabled { true } - scope { create :scope, organization: organization } + scope { create :scope, organization: } end end end diff --git a/lib/decidim/emitter/version.rb b/lib/decidim/emitter/version.rb index 8777336..442864c 100644 --- a/lib/decidim/emitter/version.rb +++ b/lib/decidim/emitter/version.rb @@ -3,7 +3,7 @@ module Decidim # This holds the decidim-meetings version. module Emitter - VERSION = "0.1.0" - DECIDIM_VERSION = "0.27.0" + VERSION = "1.0.0" + DECIDIM_VERSION = "~> 0.29.0" end end diff --git a/spec/cells/decidim/card_g_cell_spec.rb b/spec/cells/decidim/card_g_cell_spec.rb new file mode 100644 index 0000000..e57abbb --- /dev/null +++ b/spec/cells/decidim/card_g_cell_spec.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +require "spec_helper" + +describe Decidim::CardGCell, type: :cell do + subject { cell_html } + + controller Decidim::PagesController + + let!(:model) { create(:dummy_resource) } + let(:my_cell) { cell("decidim/card_g", model) } + let(:cell_html) { my_cell.call } + + before do + allow(model).to receive(:description).and_return(model.body) + end + + it_behaves_like "m-cell", :model +end diff --git a/spec/cells/decidim/participatory_processes/content_blocks/highlighted_processes_cell_spec.rb b/spec/cells/decidim/participatory_processes/content_blocks/highlighted_processes_cell_spec.rb deleted file mode 100644 index 468916d..0000000 --- a/spec/cells/decidim/participatory_processes/content_blocks/highlighted_processes_cell_spec.rb +++ /dev/null @@ -1,38 +0,0 @@ -# frozen_string_literal: true - -require "spec_helper" - -describe Decidim::ParticipatoryProcesses::ContentBlocks::HighlightedProcessesCell, type: :cell do - subject { cell(content_block.cell, content_block).call } - - let(:organization) { create(:organization) } - let(:content_block) { create :content_block, organization: organization, manifest_name: :highlighted_processes, scope_name: :homepage, settings: settings } - let!(:processes) { create_list :participatory_process, 5, organization: organization } - let(:settings) { {} } - - let(:highlighted_processes) { subject.find("#highlighted-processes") } - - controller Decidim::PagesController - - before do - allow(controller).to receive(:current_organization).and_return(organization) - end - - context "when the content block has no settings" do - it "shows 4 processes" do - expect(highlighted_processes).to have_selector("a.card--process", count: 4) - end - end - - context "when the content block has customized the welcome text setting value" do - let(:settings) do - { - "max_results" => "8" - } - end - - it "shows up to 8 processes" do - expect(highlighted_processes).to have_selector("a.card--process", count: 5) - end - end -end diff --git a/spec/commands/copy_participatory_process_spec.rb b/spec/commands/copy_participatory_process_spec.rb index 93b1c7e..0187e7e 100644 --- a/spec/commands/copy_participatory_process_spec.rb +++ b/spec/commands/copy_participatory_process_spec.rb @@ -4,15 +4,15 @@ module Decidim::ParticipatoryProcesses describe Admin::CopyParticipatoryProcess do - subject { described_class.new(form, participatory_process, user) } + subject { described_class.new(form, participatory_process) } - let(:organization) { create :organization } - let(:user) { create :user, organization: organization } - let(:participatory_process_group) { create :participatory_process_group, organization: organization } - let(:scope) { create :scope, organization: organization } + let(:organization) { create(:organization) } + let(:current_user) { create(:user, organization:) } + let(:participatory_process_group) { create(:participatory_process_group, organization:) } + let(:scope) { create(:scope, organization:) } let(:errors) { double.as_null_object } - let!(:participatory_process) { create :participatory_process, :with_steps } - let!(:component) { create :component, manifest_name: :dummy, participatory_space: participatory_process } + let!(:participatory_process) { create(:participatory_process, :with_steps) } + let!(:component) { create(:component, manifest_name: :dummy, participatory_space: participatory_process) } let(:form) do instance_double( Admin::ParticipatoryProcessCopyForm, @@ -21,7 +21,8 @@ module Decidim::ParticipatoryProcesses slug: "copied-slug", copy_steps?: copy_steps, copy_categories?: copy_categories, - copy_components?: copy_components + copy_components?: copy_components, + current_user: ) end let!(:category) do @@ -75,10 +76,10 @@ module Decidim::ParticipatoryProcesses expect { subject.call }.to broadcast(:ok) end - it "traces the action", versioning: true do + it "traces the action", :versioning do expect(Decidim.traceability) .to receive(:perform_action!) - .with("duplicate", Decidim::ParticipatoryProcess, user) + .with("duplicate", Decidim::ParticipatoryProcess, current_user) .and_call_original expect { subject.call }.to change(Decidim::ActionLog, :count) @@ -144,7 +145,7 @@ module Decidim::ParticipatoryProcesses expect { subject.call }.to change(Decidim::Component, :count).by(1) last_participatory_process = Decidim::ParticipatoryProcess.last - last_component = Decidim::Component.all.reorder(:id).last + last_component = Decidim::Component.reorder(:id).last expect(last_component.participatory_space).to eq(last_participatory_process) expect(last_component.name).to eq(component.name) diff --git a/spec/commands/create_participatory_process_spec.rb b/spec/commands/create_participatory_process_spec.rb index 1d58afc..0177912 100644 --- a/spec/commands/create_participatory_process_spec.rb +++ b/spec/commands/create_participatory_process_spec.rb @@ -3,32 +3,32 @@ require "spec_helper" module Decidim::ParticipatoryProcesses - describe Admin::CreateParticipatoryProcess, versioning: true do + describe Admin::CreateParticipatoryProcess, :versioning do subject { described_class.new(form) } - let(:organization) { create :organization } - let(:participatory_process_group) { create :participatory_process_group, organization: organization } - let(:participatory_process_type) { create :participatory_process_type, organization: organization } - let(:scope) { create :scope, organization: organization } - let(:area) { create :area, organization: organization } - let(:current_user) { create :user, :admin, organization: organization } + let(:organization) { create(:organization) } + let(:participatory_process_group) { create(:participatory_process_group, organization:) } + let(:participatory_process_type) { create(:participatory_process_type, organization:) } + let(:scope) { create(:scope, organization:) } + let(:area) { create(:area, organization:) } + let(:current_user) { create(:user, :admin, organization:) } let(:errors) { double.as_null_object } let(:related_process_ids) { [] } + let(:weight) { 1 } + let(:hero_image) { nil } let(:emitter) { upload_test_file(Decidim::Dev.test_file("city.jpeg", "image/jpeg")) } let(:emitter_name) { "Berlin" } - let(:weight) { 1 } let(:form) do instance_double( Admin::ParticipatoryProcessForm, invalid?: invalid, title: { en: "title" }, subtitle: { en: "subtitle" }, - weight: weight, + weight:, slug: "slug", hashtag: "hashtag", meta_scope: { en: "meta scope" }, - hero_image: nil, - banner_image: nil, + hero_image:, promoted: nil, developer_group: { en: "developer group" }, local_area: { en: "local" }, @@ -39,22 +39,21 @@ module Decidim::ParticipatoryProcesses end_date: nil, description: { en: "description" }, short_description: { en: "short_description" }, - current_user: current_user, + current_user:, current_organization: organization, + organization:, scopes_enabled: true, private_space: false, - scope: scope, + scope:, scope_type_max_depth: nil, - area: area, - errors: errors, - related_process_ids: related_process_ids, - participatory_process_group: participatory_process_group, - participatory_process_type: participatory_process_type, - show_statistics: false, - show_metrics: false, + area:, + errors:, + related_process_ids:, + participatory_process_group:, + participatory_process_type:, announcement: { en: "message" }, - emitter: emitter, - emitter_name: emitter_name + emitter:, + emitter_name: ) end let(:invalid) { false } @@ -68,20 +67,16 @@ module Decidim::ParticipatoryProcesses end context "when the process is not persisted" do - let(:invalid_process) do - instance_double( - Decidim::ParticipatoryProcess, - persisted?: false, - valid?: false, - errors: { - hero_image: "File resolution is too large", - banner_image: "File resolution is too large" - } - ).as_null_object + let(:hero_image) do + ActiveStorage::Blob.create_and_upload!( + io: File.open(Decidim::Dev.asset("invalid.jpeg")), + filename: "avatar.jpeg", + content_type: "image/jpeg" + ) end before do - allow(Decidim::ParticipatoryProcess).to receive(:new).and_return(invalid_process) + allow(Decidim::ActionLogger).to receive(:log).and_return(true) end it "broadcasts invalid" do @@ -90,7 +85,6 @@ module Decidim::ParticipatoryProcesses it "adds errors to the form" do expect(errors).to receive(:add).with(:hero_image, "File resolution is too large") - expect(errors).to receive(:add).with(:banner_image, "File resolution is too large") subject.call end end @@ -102,17 +96,15 @@ module Decidim::ParticipatoryProcesses expect { subject.call }.to change(Decidim::ParticipatoryProcess, :count).by(1) end - it "traces the creation", versioning: true do - expect(Decidim::ActionLogger) - .to receive(:log) - .with("create", current_user, a_kind_of(Decidim::ParticipatoryProcess), a_kind_of(Integer)) + it "traces the action", :versioning do + expect(Decidim.traceability) + .to receive(:create) + .with(Decidim::ParticipatoryProcess, current_user, kind_of(Hash)) .and_call_original expect { subject.call }.to change(Decidim::ActionLog, :count) - action_log = Decidim::ActionLog.last expect(action_log.version).to be_present - expect(action_log.version.event).to eq "create" end it "broadcasts ok" do @@ -125,31 +117,25 @@ module Decidim::ParticipatoryProcesses expect(process.steps.first).to be_active end - it "doesn't enable by default stats and metrics" do - subject.call - expect(process.show_statistics).to be(false) - expect(process.show_metrics).to be(false) - end - it "adds the admins as followers" do subject.call expect(current_user.follows?(process)).to be true end context "with related processes" do - let!(:another_process) { create :participatory_process, organization: organization } + let!(:another_process) { create(:participatory_process, organization:) } let(:related_process_ids) { [another_process.id] } it "links related processes" do subject.call linked_processes = process.linked_participatory_space_resources(:participatory_process, "related_processes") - expect(linked_processes).to match_array([another_process]) + expect(linked_processes).to contain_exactly(another_process) end context "when sorting by weight" do - let!(:process_one) { create :participatory_process, organization: organization, weight: 2 } - let!(:process_two) { create :participatory_process, organization: organization, weight: 1 } + let!(:process_one) { create(:participatory_process, organization:, weight: 2) } + let!(:process_two) { create(:participatory_process, organization:, weight: 1) } let(:related_process_ids) { [process_one.id, process_two.id] } it "links processes in right way" do diff --git a/spec/commands/update_participatory_process_spec.rb b/spec/commands/update_participatory_process_spec.rb index f321102..776c2e3 100644 --- a/spec/commands/update_participatory_process_spec.rb +++ b/spec/commands/update_participatory_process_spec.rb @@ -33,8 +33,6 @@ module Decidim::ParticipatoryProcesses area: my_process.area, errors: my_process.errors, participatory_process_group: my_process.participatory_process_group, - show_metrics: my_process.show_metrics, - show_statistics: my_process.show_statistics, private_space: my_process.private_space, emitter_name: my_process.emitter_name }.merge(attachment_params) @@ -43,8 +41,7 @@ module Decidim::ParticipatoryProcesses let(:attachment_params) do { hero_image: my_process.hero_image.blob, - banner_image: my_process.banner_image.blob, - emitter: my_process.banner_image.blob + emitter: my_process.hero_image.blob } end let(:user) { create :user, :admin, :confirmed, organization: my_process.organization } @@ -58,7 +55,7 @@ module Decidim::ParticipatoryProcesses let(:form) do Admin::ParticipatoryProcessForm.from_params(params).with_context(context) end - let(:command) { described_class.new(my_process, form) } + let(:command) { described_class.new(form, my_process) } describe "when the form is not valid" do before do @@ -82,7 +79,6 @@ module Decidim::ParticipatoryProcesses allow(form).to receive(:invalid?).and_return(false) expect(my_process).to receive(:valid?).at_least(:once).and_return(false) my_process.errors.add(:hero_image, "File resolution is too large") - my_process.errors.add(:banner_image, "File resolution is too large") end it "broadcasts invalid" do @@ -93,7 +89,6 @@ module Decidim::ParticipatoryProcesses command.call expect(form.errors[:hero_image]).not_to be_empty - expect(form.errors[:banner_image]).not_to be_empty end end @@ -109,10 +104,10 @@ module Decidim::ParticipatoryProcesses expect(my_process.title["en"]).to eq("Foo title") end - it "tracks the action", versioning: true do + it "tracks the action", :versioning do expect(Decidim.traceability) .to receive(:perform_action!) - .with(:update, my_process, user) + .with(:update, my_process, user, {}) .and_call_original expect { command.call }.to change(Decidim::ActionLog, :count) @@ -129,41 +124,7 @@ module Decidim::ParticipatoryProcesses command.call linked_processes = my_process.linked_participatory_space_resources(:participatory_process, "related_processes") - expect(linked_processes).to match_array([another_process]) - end - end - - context "when no homepage image is set" do - let(:attachment_params) do - { - banner_image: my_process.banner_image.blob - } - end - - it "does not replace the homepage image" do - expect(my_process).not_to receive(:hero_image=) - - command.call - my_process.reload - - expect(my_process.hero_image.attached?).to be true - end - end - - context "when no banner image is set" do - let(:attachment_params) do - { - hero_image: my_process.hero_image.blob - } - end - - it "does not replace the banner image" do - expect(my_process).not_to receive(:banner_image=) - - command.call - my_process.reload - - expect(my_process.banner_image.attached?).to be true + expect(linked_processes).to contain_exactly(another_process) end end end diff --git a/spec/forms/participatory_process_form_spec.rb b/spec/forms/participatory_process_form_spec.rb index 7304811..22c5627 100644 --- a/spec/forms/participatory_process_form_spec.rb +++ b/spec/forms/participatory_process_form_spec.rb @@ -41,8 +41,6 @@ module Admin let(:slug) { "slug" } let(:attachment) { upload_test_file(Decidim::Dev.test_file("city.jpeg", "image/jpeg")) } let(:emitter_name) { "city" } - let(:show_metrics) { true } - let(:show_statistics) { true } let(:attributes) do { "participatory_process" => { @@ -60,12 +58,9 @@ module Admin "short_description_es" => short_description[:es], "short_description_ca" => short_description[:ca], "hero_image" => attachment, - "banner_image" => attachment, - "emitter" => attachment, - "emitter_name" => emitter_name, "slug" => slug, - "show_metrics" => show_metrics, - "show_statistics" => show_statistics + "emitter" => attachment, + "emitter_name" => emitter_name } } end @@ -74,7 +69,7 @@ module Admin it { is_expected.to be_valid } end - context "when banner_image is too big" do + context "when hero_image is too big" do before do organization.settings.tap do |settings| settings.upload.maximum_file_size.default = 5 @@ -146,7 +141,7 @@ module Admin context "when slug is not unique" do context "and process in the same organization" do before do - create(:participatory_process, slug: slug, organization: organization) + create(:participatory_process, slug:, organization:) end it "is not valid" do @@ -157,7 +152,7 @@ module Admin context "and process in another organization" do before do - create(:participatory_process, slug: slug) + create(:participatory_process, slug:) end it "is valid" do diff --git a/spec/helpers/decidim/emitter/emitter_helper_spec.rb b/spec/helpers/decidim/emitter/emitter_helper_spec.rb index 7e51bf6..515be6d 100644 --- a/spec/helpers/decidim/emitter/emitter_helper_spec.rb +++ b/spec/helpers/decidim/emitter/emitter_helper_spec.rb @@ -9,11 +9,11 @@ module Emitter let(:organization) { create(:organization) } let(:emitter_names) { %w(Abidjan London Tokyo) } let(:emitter) { upload_test_file(Decidim::Dev.test_file("city.jpeg", "image/jpeg")) } - let!(:participatory_process) { create(:participatory_process, emitter_name: "Berlin", emitter: emitter, organization: organization) } + let!(:participatory_process) { create(:participatory_process, emitter_name: "Berlin", emitter:, organization:) } before do emitter_names.each do |emitter_name| - create(:participatory_process, emitter_name: emitter_name, emitter: emitter, organization: organization) + create(:participatory_process, emitter_name:, emitter:, organization:) end allow_any_instance_of(ActionView::Base).to receive(:current_organization).and_return(organization) end diff --git a/spec/lib/decidim/emitter/version_spec.rb b/spec/lib/decidim/emitter/version_spec.rb index ab08706..ba28bd0 100644 --- a/spec/lib/decidim/emitter/version_spec.rb +++ b/spec/lib/decidim/emitter/version_spec.rb @@ -7,7 +7,7 @@ module Decidim subject { described_class } it "has version" do - expect(Decidim::Emitter::VERSION).to eq("0.1.0") + expect(Decidim::Emitter::VERSION).to eq("1.0.0") end end end diff --git a/spec/models/decidim/participatory_process_spec.rb b/spec/models/decidim/participatory_process_spec.rb index e0a260a..40d35f8 100644 --- a/spec/models/decidim/participatory_process_spec.rb +++ b/spec/models/decidim/participatory_process_spec.rb @@ -20,7 +20,7 @@ module Decidim .to eq Decidim::ParticipatoryProcesses::AdminLog::ParticipatoryProcessPresenter end - context "when there's a process with the same slug in the same organization" do + context "when there is a process with the same slug in the same organization" do let!(:external_process) { create :participatory_process, organization: participatory_process.organization, slug: "my-slug" } it "is not valid" do @@ -29,16 +29,16 @@ module Decidim end end - context "when there's a process with the same slug in another organization" do + context "when there is a process with the same slug in another organization" do let!(:external_process) { create :participatory_process, slug: "my-slug" } it { is_expected.to be_valid } end context "when a process is attached to a scope type" do - let!(:participatory_process) { create(:participatory_process, :with_scope, slug: "my-slug", scope_type_max_depth: scope_type, organization: organization) } + let!(:participatory_process) { create(:participatory_process, :with_scope, slug: "my-slug", scope_type_max_depth: scope_type, organization:) } let(:organization) { create(:organization) } - let(:scope_type) { create(:scope_type, organization: organization) } + let(:scope_type) { create(:scope_type, organization:) } it "allows destroying the scope type" do scope_type.destroy! @@ -124,7 +124,7 @@ module Decidim describe "active_spaces" do it "returns the currently active ones" do - expect(described_class.active_spaces).to match_array [active, ends_today] + expect(described_class.active_spaces).to contain_exactly(active, ends_today) expect(described_class.active_spaces).not_to include past expect(described_class.active_spaces).not_to include upcoming end diff --git a/spec/permissions/admin/permissions_spec.rb b/spec/permissions/admin/permissions_spec.rb index d4fc73c..678906f 100644 --- a/spec/permissions/admin/permissions_spec.rb +++ b/spec/permissions/admin/permissions_spec.rb @@ -18,7 +18,7 @@ module Decidim::Emitter::Admin let(:permission_action) { Decidim::PermissionAction.new(**action) } context "when user is admin" do - let(:user) { create :user, :admin, organization: organization } + let(:user) { create :user, :admin, organization: } it { is_expected.to be_truthy } @@ -32,7 +32,7 @@ module Decidim::Emitter::Admin end context "when user is not admin" do - let(:user) { create :user, organization: organization } + let(:user) { create :user, organization: } it_behaves_like "permission is not set" end diff --git a/spec/shared/manage_processes_examples.rb b/spec/shared/manage_processes_examples.rb index b72c16f..98e52bd 100644 --- a/spec/shared/manage_processes_examples.rb +++ b/spec/shared/manage_processes_examples.rb @@ -2,25 +2,24 @@ shared_examples "manage processes examples" do context "when viewing the processes list" do - let!(:process_group) { create(:participatory_process_group, organization: organization) } - let!(:process_with_group) { create(:participatory_process, organization: organization, participatory_process_group: process_group) } - let!(:process_without_group) { create(:participatory_process, organization: organization) } + let!(:process_group) { create(:participatory_process_group, organization:) } + let!(:process_with_group) { create(:participatory_process, organization:, participatory_process_group: process_group) } + let!(:process_without_group) { create(:participatory_process, organization:) } let(:model_name) { participatory_process.class.model_name } let(:resource_controller) { Decidim::ParticipatoryProcesses::Admin::ParticipatoryProcessesController } + include_context "with filterable context" + def filter_by_group(group_title) visit current_path - within(".card-title") do - click_button("Process Groups") - click_link(group_title) - end + apply_filter("By process group", group_title) end it "allows the user to filter processes by process_group" do filter_by_group(translated(process_group.title)) expect(page).to have_content(translated(process_with_group.title)) - expect(page).not_to have_content(translated(process_without_group.title)) + expect(page).to have_no_content(translated(process_without_group.title)) end describe "listing processes" do @@ -31,21 +30,15 @@ def filter_by_group(group_title) context "when processes are filtered by process_group" do before { filter_by_group(translated(process_group.title)) } - it "allows the user to edit the process_group" do - click_link translated(process_group.title) - - expect(page).to have_content("Edit process group") - end - describe "listing processes filtered by group" do it_behaves_like "filtering collection by published/unpublished" do let!(:published_space) { process_with_group } - let!(:unpublished_space) { create(:participatory_process, :unpublished, organization: organization, participatory_process_group: process_group) } + let!(:unpublished_space) { create(:participatory_process, :unpublished, organization:, participatory_process_group: process_group) } end it_behaves_like "filtering collection by private/public" do let!(:public_space) { process_with_group } - let!(:private_space) { create(:participatory_process, :private, organization: organization, participatory_process_group: process_group) } + let!(:private_space) { create(:participatory_process, :private, organization:, participatory_process_group: process_group) } end end end @@ -53,28 +46,32 @@ def filter_by_group(group_title) context "when previewing processes" do context "when the process is unpublished" do - let!(:participatory_process) { create(:participatory_process, :unpublished, organization: organization) } + let!(:participatory_process) { create(:participatory_process, :unpublished, organization:) } it "allows the user to preview the unpublished process" do - within find("tr", text: translated(participatory_process.title)) do - click_link "Preview" - end + new_window = window_opened_by { page.find("tr", text: translated(participatory_process.title)).click_on("Preview") } - expect(page).to have_css(".process-header") - expect(page).to have_content(translated(participatory_process.title)) + page.within_window(new_window) do + expect(page).to have_css(".participatory-space__container") + expect(page).to have_content(translated(participatory_process.title)) + end end end context "when the process is published" do - let!(:participatory_process) { create(:participatory_process, organization: organization) } + let!(:participatory_process) { create(:participatory_process, organization:) } it "allows the user to preview the published process" do - within find("tr", text: translated(participatory_process.title)) do - click_link "Preview" + within "tr", text: translated(participatory_process.title) do + click_on "Preview" end - expect(page).to have_current_path decidim_participatory_processes.participatory_process_path(participatory_process) - expect(page).to have_content(translated(participatory_process.title)) + new_window = window_opened_by { page.find("tr", text: translated(participatory_process.title)).click_on("Preview") } + + page.within_window(new_window) do + expect(page).to have_current_path decidim_participatory_processes.participatory_process_path(participatory_process) + expect(page).to have_content(translated(participatory_process.title)) + end end end end @@ -88,23 +85,34 @@ def filter_by_group(group_title) context "when updating a participatory process" do let(:image3_filename) { "city3.jpeg" } let(:image3_path) { Decidim::Dev.asset(image3_filename) } + let(:attributes) { attributes_for(:participatory_process, organization:) } before do - click_link translated(participatory_process.title) + within "tr", text: translated(participatory_process.title) do + click_on translated(participatory_process.title) + end + + within_admin_sidebar_menu do + click_on "About this process" + end end it "updates a participatory_process" do - fill_in_i18n( - :participatory_process_title, - "#participatory_process-title-tabs", - en: "My new title", - es: "Mi nuevo título", - ca: "El meu nou títol" - ) - dynamically_attach_file(:participatory_process_banner_image, image3_path, remove_before: true) - - page.execute_script("$('#participatory_process_end_date').focus()") - page.find(".datepicker-dropdown .day", text: "22").click + fill_in_i18n(:participatory_process_title, "#participatory_process-title-tabs", **attributes[:title].except("machine_translations")) + fill_in_i18n(:participatory_process_subtitle, "#participatory_process-subtitle-tabs", **attributes[:subtitle].except("machine_translations")) + fill_in_i18n_editor(:participatory_process_short_description, "#participatory_process-short_description-tabs", **attributes[:short_description].except("machine_translations")) + fill_in_i18n_editor(:participatory_process_description, "#participatory_process-description-tabs", **attributes[:description].except("machine_translations")) + fill_in_i18n_editor(:participatory_process_announcement, "#participatory_process-announcement-tabs", **attributes[:announcement].except("machine_translations")) + fill_in_i18n(:participatory_process_developer_group, "#participatory_process-developer_group-tabs", **attributes[:developer_group].except("machine_translations")) + fill_in_i18n(:participatory_process_local_area, "#participatory_process-local_area-tabs", **attributes[:local_area].except("machine_translations")) + fill_in_i18n(:participatory_process_meta_scope, "#participatory_process-meta_scope-tabs", **attributes[:meta_scope].except("machine_translations")) + fill_in_i18n(:participatory_process_target, "#participatory_process-target-tabs", **attributes[:target].except("machine_translations")) + fill_in_i18n(:participatory_process_participatory_scope, "#participatory_process-participatory_scope-tabs", **attributes[:participatory_scope].except("machine_translations")) + fill_in_i18n(:participatory_process_participatory_structure, "#participatory_process-participatory_structure-tabs", **attributes[:participatory_structure].except("machine_translations")) + + dynamically_attach_file(:participatory_process_hero_image, image3_path, remove_before: true) + + fill_in_datepicker :participatory_process_end_date_date, with: Time.new.utc.strftime("%d/%m/%Y") within ".edit_participatory_process" do find("*[type=submit]").click @@ -112,22 +120,31 @@ def filter_by_group(group_title) expect(page).to have_admin_callout("successfully") - within ".container" do - expect(page).to have_selector("input[value='My new title']") + within "[data-content]" do + expect(page).to have_css("input[value='#{translated(attributes[:title])}']") expect(page).to have_css("img[src*='#{image3_filename}']") end + + visit decidim_admin.root_path + expect(page).to have_content("updated the #{translated(attributes[:title])} participatory process") end end context "when publishing a process" do - let!(:participatory_process) { create(:participatory_process, :unpublished, organization: organization) } + let!(:participatory_process) { create(:participatory_process, :unpublished, organization:) } before do - click_link translated(participatory_process.title) + within "tr", text: translated(participatory_process.title) do + click_on translated(participatory_process.title) + end + + within_admin_sidebar_menu do + click_on "About this process" + end end it "publishes the process" do - click_link "Publish" + click_on "Publish" expect(page).to have_content("successfully published") expect(page).to have_content("Unpublish") expect(page).to have_current_path decidim_admin_participatory_processes.edit_participatory_process_path(participatory_process) @@ -138,14 +155,20 @@ def filter_by_group(group_title) end context "when unpublishing a process" do - let!(:participatory_process) { create(:participatory_process, organization: organization) } + let!(:participatory_process) { create(:participatory_process, organization:) } before do - click_link translated(participatory_process.title) + within "tr", text: translated(participatory_process.title) do + click_on translated(participatory_process.title) + end + + within_admin_sidebar_menu do + click_on "About this process" + end end it "unpublishes the process" do - click_link "Unpublish" + click_on "Unpublish" expect(page).to have_content("successfully unpublished") expect(page).to have_content("Publish") expect(page).to have_current_path decidim_admin_participatory_processes.edit_participatory_process_path(participatory_process) @@ -162,7 +185,7 @@ def filter_by_group(group_title) visit decidim_admin_participatory_processes.participatory_processes_path end - it "doesn't let the admin manage processes form other organizations" do + it "does not let the admin manage processes form other organizations" do within "table" do expect(page).to have_no_content(external_participatory_process.title["en"]) end @@ -170,19 +193,24 @@ def filter_by_group(group_title) end context "when the process has a scope" do - let(:scope) { create(:scope, organization: organization) } + let(:scope) { create(:scope, organization:) } before do - participatory_process.update!(scopes_enabled: true, scope: scope) + participatory_process.update!(scopes_enabled: true, scope:) end it "disables the scope for a participatory process" do - click_link translated(participatory_process.title) + within "tr", text: translated(participatory_process.title) do + click_on translated(participatory_process.title) + end + + within_admin_sidebar_menu do + click_on "About this process" + end uncheck :participatory_process_scopes_enabled - expect(page).to have_selector("#participatory_process_scope_id.disabled") - expect(page).to have_selector("#participatory_process_scope_id .picker-values div input[disabled]", visible: :all) + expect(page).to have_css("#participatory_process_scope_id[disabled]") within ".edit_participatory_process" do find("*[type=submit]").click diff --git a/spec/shared/participatory_process_administration_by_admin_shared_context.rb b/spec/shared/participatory_process_administration_by_admin_shared_context.rb index e0b64e8..1cc359c 100644 --- a/spec/shared/participatory_process_administration_by_admin_shared_context.rb +++ b/spec/shared/participatory_process_administration_by_admin_shared_context.rb @@ -2,7 +2,7 @@ shared_context "when admin administrating a participatory process" do let!(:user) do - create(:user, :admin, :confirmed, organization: organization) + create(:user, :admin, :confirmed, organization:) end include_context "when administrating a participatory process" diff --git a/spec/shared/participatory_process_administration_shared_context.rb b/spec/shared/participatory_process_administration_shared_context.rb index 22e5bef..3839d1b 100644 --- a/spec/shared/participatory_process_administration_shared_context.rb +++ b/spec/shared/participatory_process_administration_shared_context.rb @@ -3,5 +3,5 @@ shared_context "when administrating a participatory process" do let(:organization) { create(:organization) } - let!(:participatory_process) { create(:participatory_process, organization: organization) } + let!(:participatory_process) { create(:participatory_process, organization:) } end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 66d395a..8e5b69d 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -9,7 +9,7 @@ require "decidim/dev/test/base_spec_helper" Capybara.register_driver :headless_chrome do |app| - options = ::Selenium::WebDriver::Chrome::Options.new + options = Selenium::WebDriver::Chrome::Options.new options.args << "--headless=new" options.args << "--no-sandbox" options.args << if ENV["BIG_SCREEN_SIZE"].present? @@ -21,6 +21,6 @@ Capybara::Selenium::Driver.new( app, browser: :chrome, - capabilities: [options] + options: ) end diff --git a/spec/system/admin/admin_import_participatory_process_spec.rb b/spec/system/admin/admin_import_participatory_process_spec.rb index efca96f..e8d125c 100644 --- a/spec/system/admin/admin_import_participatory_process_spec.rb +++ b/spec/system/admin/admin_import_participatory_process_spec.rb @@ -2,9 +2,8 @@ require "spec_helper" -describe "Admin imports participatory process", type: :system do +describe "Admin imports participatory process" do # rubocop:disable RSpec/DescribeClass include_context "when admin administrating a participatory process" - let!(:user) { create(:user, :admin, :confirmed, organization: organization) } before do switch_to_host(organization.host) @@ -14,7 +13,9 @@ context "with context" do before "Imports the process with the basic fields" do - click_link "Import", match: :first + within_admin_menu do + click_on "Import" + end within ".import_participatory_process" do fill_in_i18n( @@ -28,32 +29,42 @@ end stub_get_request_with_format("http://localhost:3000/uploads/decidim/participatory_process/hero_image/1/city.jpeg", "image/jpeg") - stub_get_request_with_format("http://localhost:3000/uploads/decidim/participatory_process/banner_image/1/city2.jpeg", "image/jpeg") dynamically_attach_file(:participatory_process_document, Decidim::Dev.asset("participatory_processes.json")) - click_button "Import" + click_on "Import" end it "imports the json document" do expect(page).to have_content("successfully") expect(page).to have_content("Import participatory process") - expect(page).to have_content("Not published") + expect(page).to have_content("Unpublished") - click_link "Import participatory process" + within "tr", text: "Import participatory process" do + click_on "Import participatory process" + end + + within_admin_sidebar_menu do + click_on "Phases" + end - click_link "Phases" within ".table-list" do expect(page).to have_content(translated("Magni.")) end - click_link "Categories" + within_admin_sidebar_menu do + click_on "Categories" + end + within ".table-list" do expect(page).to have_content(translated("Illum nesciunt praesentium explicabo qui.")) expect(page).to have_content(translated("Expedita sint earum rerum consequatur.")) end - click_link "Components" + within_admin_sidebar_menu do + click_on "Components" + end + expect(Decidim::ParticipatoryProcess.last.components.size).to eq(3) within ".table-list" do Decidim::ParticipatoryProcess.last.components.each do |component| @@ -61,7 +72,10 @@ end end - click_link "Files" + within_admin_sidebar_menu do + click_on "Attachments" + end + if Decidim::ParticipatoryProcess.last.attachments.any? within ".table-list" do Decidim::ParticipatoryProcess.last.attachments.each do |attachment| diff --git a/spec/system/admin/admin_manages_participatory_processes_spec.rb b/spec/system/admin/admin_manages_participatory_processes_spec.rb index 2f30644..9b3a0c3 100644 --- a/spec/system/admin/admin_manages_participatory_processes_spec.rb +++ b/spec/system/admin/admin_manages_participatory_processes_spec.rb @@ -2,11 +2,11 @@ require "spec_helper" -describe "Admin manages participatory processes", versioning: true, type: :system do +describe "Admin manages participatory processes", :versioning do # rubocop:disable RSpec/DescribeClass include_context "when admin administrating a participatory process" let!(:participatory_process_groups) do - create_list(:participatory_process_group, 3, organization: organization) + create_list(:participatory_process_group, 3, organization:) end before do @@ -15,6 +15,37 @@ visit decidim_admin_participatory_processes.participatory_processes_path end + context "when conditionally displaying private user menu entry" do + let!(:my_space) { create(:participatory_process, organization:, private_space:) } + + before do + switch_to_host(organization.host) + login_as user, scope: :user + visit decidim_admin_participatory_processes.participatory_processes_path + click_on translated(my_space.title) + end + + context "when the participatory process is private" do + let(:private_space) { true } + + it "hides the private user menu entry" do + within_admin_sidebar_menu do + expect(page).to have_content("Private participants") + end + end + end + + context "when the participatory process is public" do + let(:private_space) { false } + + it "shows the private user menu entry" do + within_admin_sidebar_menu do + expect(page).to have_no_content("Private participants") + end + end + end + end + it_behaves_like "manage processes examples" it_behaves_like "manage processes announcements" @@ -24,9 +55,10 @@ let(:image2_filename) { "city2.jpeg" } let(:image2_path) { Decidim::Dev.asset(image2_filename) } + let(:attributes) { attributes_for(:participatory_process, organization:) } before do - click_link "New process" + click_on "New process" end %w(short_description description announcement).each do |field| @@ -35,34 +67,18 @@ it "creates a new participatory process" do within ".new_participatory_process" do - fill_in_i18n( - :participatory_process_title, - "#participatory_process-title-tabs", - en: "My participatory process", - es: "Mi proceso participativo", - ca: "El meu procés participatiu" - ) - fill_in_i18n( - :participatory_process_subtitle, - "#participatory_process-subtitle-tabs", - en: "Subtitle", - es: "Subtítulo", - ca: "Subtítol" - ) - fill_in_i18n_editor( - :participatory_process_short_description, - "#participatory_process-short_description-tabs", - en: "Short description", - es: "Descripción corta", - ca: "Descripció curta" - ) - fill_in_i18n_editor( - :participatory_process_description, - "#participatory_process-description-tabs", - en: "A longer description", - es: "Descripción más larga", - ca: "Descripció més llarga" - ) + fill_in_i18n(:participatory_process_title, "#participatory_process-title-tabs", **attributes[:title].except("machine_translations")) + fill_in_i18n(:participatory_process_subtitle, "#participatory_process-subtitle-tabs", **attributes[:subtitle].except("machine_translations")) + fill_in_i18n_editor(:participatory_process_short_description, "#participatory_process-short_description-tabs", **attributes[:short_description].except("machine_translations")) + fill_in_i18n_editor(:participatory_process_description, "#participatory_process-description-tabs", **attributes[:description].except("machine_translations")) + fill_in_i18n_editor(:participatory_process_announcement, "#participatory_process-announcement-tabs", **attributes[:announcement].except("machine_translations")) + + fill_in_i18n(:participatory_process_developer_group, "#participatory_process-developer_group-tabs", **attributes[:developer_group].except("machine_translations")) + fill_in_i18n(:participatory_process_local_area, "#participatory_process-local_area-tabs", **attributes[:local_area].except("machine_translations")) + fill_in_i18n(:participatory_process_meta_scope, "#participatory_process-meta_scope-tabs", **attributes[:meta_scope].except("machine_translations")) + fill_in_i18n(:participatory_process_target, "#participatory_process-target-tabs", **attributes[:target].except("machine_translations")) + fill_in_i18n(:participatory_process_participatory_scope, "#participatory_process-participatory_scope-tabs", **attributes[:participatory_scope].except("machine_translations")) + fill_in_i18n(:participatory_process_participatory_structure, "#participatory_process-participatory_structure-tabs", **attributes[:participatory_structure].except("machine_translations")) group_title = participatory_process_groups.first.title["en"] select group_title, from: :participatory_process_participatory_process_group_id @@ -73,7 +89,6 @@ end dynamically_attach_file(:participatory_process_hero_image, image1_path) - dynamically_attach_file(:participatory_process_banner_image, image2_path) within ".new_participatory_process" do find("*[type=submit]").click @@ -81,122 +96,42 @@ expect(page).to have_admin_callout("successfully") - within ".container" do + within "[data-content]" do expect(page).to have_current_path decidim_admin_participatory_processes.participatory_process_steps_path(Decidim::ParticipatoryProcess.last) expect(page).to have_content("Phases") expect(page).to have_content("Introduction") end - end - context "with emitter fields" do - it "creates a new participatory process" do - within ".new_participatory_process" do - fill_in_i18n( - :participatory_process_title, - "#participatory_process-title-tabs", - en: "My participatory process", - es: "Mi proceso participativo", - ca: "El meu procés participatiu" - ) - fill_in_i18n( - :participatory_process_subtitle, - "#participatory_process-subtitle-tabs", - en: "Subtitle", - es: "Subtítulo", - ca: "Subtítol" - ) - fill_in_i18n_editor( - :participatory_process_short_description, - "#participatory_process-short_description-tabs", - en: "Short description", - es: "Descripción corta", - ca: "Descripció curta" - ) - fill_in_i18n_editor( - :participatory_process_description, - "#participatory_process-description-tabs", - en: "A longer description", - es: "Descripción más larga", - ca: "Descripció més llarga" - ) - - group_title = participatory_process_groups.first.title["en"] - select group_title, from: :participatory_process_participatory_process_group_id - - fill_in :participatory_process_slug, with: "slug" - fill_in :participatory_process_hashtag, with: "#hashtag" - fill_in :participatory_process_weight, with: 1 - end - - dynamically_attach_file :participatory_process_emitter_image, image1_path - fill_in :participatory_process_emitter_name_image, with: "logo" - - dynamically_attach_file(:participatory_process_hero_image, image1_path) - dynamically_attach_file(:participatory_process_banner_image, image2_path) - - within ".new_participatory_process" do - find("*[type=submit]").click - end - - expect(page).to have_admin_callout("successfully") - end - - context "when creating a participatory process with emitter select" do - let!(:process1) { create(:participatory_process, :with_emitter, organization: organization) } - - it "creates a new participatory process" do - within ".new_participatory_process" do - fill_in_i18n( - :participatory_process_title, - "#participatory_process-title-tabs", - en: "My participatory process", - ca: "Mi proceso participativo" - ) - fill_in_i18n( - :participatory_process_subtitle, - "#participatory_process-subtitle-tabs", - en: "Subtitle", - ca: "Subtítulo" - ) - fill_in_i18n_editor( - :participatory_process_short_description, - "#participatory_process-short_description-tabs", - en: "Short description", - ca: "Descripción corta" - ) - fill_in_i18n_editor( - :participatory_process_description, - "#participatory_process-description-tabs", - en: "A longer description", - ca: "Descripción más larga" - ) - fill_in :participatory_process_slug, with: "slug" - fill_in :participatory_process_weight, with: 1 - end - select process1.emitter_name, from: "Select an emitter" - find("*[type=submit]").click - - expect(page).to have_admin_callout("successfully") - end - end + visit decidim_admin.root_path + expect(page).to have_content("created the #{translated(attributes[:title])} participatory process") end end context "when updating a participatory process" do - let!(:participatory_process3) { create(:participatory_process, organization: organization) } + let!(:participatory_process3) { create(:participatory_process, organization:) } before do visit decidim_admin_participatory_processes.participatory_processes_path end it "update a participatory process without images does not delete them" do - click_link translated(participatory_process3.title) - click_submenu_link "Info" - click_button "Update" + within "tr", text: translated(participatory_process3.title) do + click_on translated(participatory_process3.title) + end + + within_admin_sidebar_menu do + click_on "About this process" + end + + click_on "Update" expect(page).to have_admin_callout("successfully") - expect(page).to have_css("img[src*='#{participatory_process3.attached_uploader(:hero_image).path}']") - expect(page).to have_css("img[src*='#{participatory_process3.attached_uploader(:banner_image).path}']") + + hero_blob = participatory_process3.hero_image.blob + within %([data-active-uploads] [data-filename="#{hero_blob.filename}"]) do + src = page.find("img")["src"] + expect(src).to be_blob_url(hero_blob) + end end end end diff --git a/spec/system/participatory_processes_spec.rb b/spec/system/participatory_processes_spec.rb index 877499b..32149e0 100644 --- a/spec/system/participatory_processes_spec.rb +++ b/spec/system/participatory_processes_spec.rb @@ -3,22 +3,19 @@ require "spec_helper" require "decidim/core/test/shared_examples/has_contextual_help" -describe "Participatory Processes", type: :system do +describe "Participatory Processes" do # rubocop:disable RSpec/DescribeClass let(:organization) { create(:organization) } - let(:show_metrics) { true } - let(:show_statistics) { true } let(:hashtag) { true } let(:base_description) { { en: "Description", ca: "Descripció", es: "Descripción" } } let(:short_description) { { en: "Short description", ca: "Descripció curta", es: "Descripción corta" } } + let(:base_process) do create( :participatory_process, :active, - organization: organization, + organization:, description: base_description, - short_description: short_description, - show_metrics: show_metrics, - show_statistics: show_statistics + short_description: ) end @@ -33,10 +30,12 @@ end context "when there are no processes and accessing from the homepage" do + let!(:menu_content_block) { create(:content_block, organization:, manifest_name: :global_menu, scope_name: :homepage) } + it "does not show the menu link" do visit decidim.root_path - within ".main-nav" do + within "#home__menu" do expect(page).to have_no_content("Processes") end end @@ -50,7 +49,7 @@ context "when there are some processes and all are unpublished" do before do - create(:participatory_process, :unpublished, organization: organization) + create(:participatory_process, :unpublished, organization:) create(:participatory_process, :published) end @@ -61,10 +60,12 @@ end context "and accessing from the homepage" do + let!(:menu_content_block) { create(:content_block, organization:, manifest_name: :global_menu, scope_name: :homepage) } + it "the menu link is not shown" do visit decidim.root_path - within ".main-nav" do + within "#home__menu" do expect(page).to have_no_content("Processes") end end @@ -73,12 +74,12 @@ context "when there are some published processes" do let!(:participatory_process) { base_process } - let!(:promoted_process) { create(:participatory_process, :promoted, organization: organization) } - let!(:unpublished_process) { create(:participatory_process, :unpublished, organization: organization) } - let!(:past_process) { create :participatory_process, :past, organization: organization } - let!(:upcoming_process) { create :participatory_process, :upcoming, organization: organization } - let!(:grouped_process) { create :participatory_process, organization: organization } - let!(:group) { create :participatory_process_group, participatory_processes: [grouped_process], organization: organization } + let!(:promoted_process) { create(:participatory_process, :promoted, organization:) } + let!(:unpublished_process) { create(:participatory_process, :unpublished, organization:) } + let!(:past_process) { create(:participatory_process, :past, organization:) } + let!(:upcoming_process) { create(:participatory_process, :upcoming, organization:) } + let!(:grouped_process) { create(:participatory_process, organization:) } + let!(:group) { create(:participatory_process_group, participatory_processes: [grouped_process], organization:) } it_behaves_like "shows contextual help" do let(:index_path) { decidim_participatory_processes.participatory_processes_path } @@ -100,7 +101,7 @@ context "when no emitter" do it "doesn't displays logo or text" do within "#participatory_process_#{promoted_process.id}" do - expect(page).not_to have_css(".emitter-header") + expect(page).not_to have_css(".emitter") end end end @@ -111,18 +112,16 @@ :participatory_process, :active, :with_emitter, - organization: organization, + organization:, description: { en: "Description", ca: "Descripció", es: "Descripción" }, short_description: { en: "Short description", ca: "Descripció curta", es: "Descripción corta" }, - show_metrics: show_metrics, - show_statistics: show_statistics, developer_group: { en: "Developer group" } ) end it "displays logo and text" do within "#participatory_process_#{base_process.id}" do - within ".emitter-header" do + within ".card-data-header" do expect(page).to have_css("img", count: 1) expect(page).to have_content("Consultation published by Developer group") end @@ -132,12 +131,13 @@ end context "and accessing from the homepage" do + let!(:menu_content_block) { create(:content_block, organization:, manifest_name: :global_menu, scope_name: :homepage) } + it "the menu link is not shown" do visit decidim.root_path - within ".main-nav" do - expect(page).to have_content("Processes") - click_link "Processes" + within "#home__menu" do + click_on "Processes" end expect(page).to have_current_path decidim_participatory_processes.participatory_processes_path @@ -157,7 +157,7 @@ context "when no emitter" do it "doesn't displays logo or text" do within "#participatory_process_#{promoted_process.id}" do - expect(page).not_to have_css(".emitter-header") + expect(page).not_to have_css(".emitter") end end end @@ -168,229 +168,152 @@ :participatory_process, :active, :with_emitter, - organization: organization, + organization:, description: { en: "Description", ca: "Descripció", es: "Descripción" }, short_description: { en: "Short description", ca: "Descripció curta", es: "Descripción corta" }, - show_metrics: show_metrics, - show_statistics: show_statistics, developer_group: { en: "Developer group" } ) end it "displays logo and text" do within "#participatory_process_#{base_process.id}" do - within ".emitter-header" do + within ".card-data-header" do expect(page).to have_css("img", count: 1) expect(page).to have_content("Consultation published by Developer group") end end end end - - it "lists all the highlighted processes" do - within "#highlighted-processes" do - expect(page).to have_content(translated(promoted_process.title, locale: :en)) - expect(page).to have_selector(".card--full", count: 1) - end - end end - it "lists the active processes" do - within "#processes-grid" do - within "#processes-grid h3" do - expect(page).to have_content("3 ACTIVE PROCESSES") - end - - expect(page).to have_content(translated(participatory_process.title, locale: :en)) + it "lists all the highlighted processes" do + within "#highlighted-processes" do expect(page).to have_content(translated(promoted_process.title, locale: :en)) - expect(page).to have_content(translated(group.title, locale: :en)) - expect(page).to have_selector(".card", count: 3) - - expect(page).to have_no_content(translated(unpublished_process.title, locale: :en)) - expect(page).to have_no_content(translated(past_process.title, locale: :en)) - expect(page).to have_no_content(translated(upcoming_process.title, locale: :en)) - expect(page).to have_no_content(translated(grouped_process.title, locale: :en)) + expect(page).to have_css("[id^='participatory_process_highlight']", count: 1) end end + end - it "links to the individual process page" do - first(".card__link", text: translated(participatory_process.title, locale: :en)).click - - expect(page).to have_current_path decidim_participatory_processes.participatory_process_path(participatory_process) - end - - context "with active steps" do - let!(:step) { create(:participatory_process_step, participatory_process: participatory_process) } - let!(:active_step) do - create(:participatory_process_step, - :active, - participatory_process: participatory_process, - title: { en: "Active step", ca: "Fase activa", es: "Fase activa" }) + it "lists the active processes" do + within "#processes-grid" do + within "#processes-grid h2" do + expect(page).to have_content("3 active processes") end - it "links to the active step" do - visit decidim_participatory_processes.participatory_processes_path + expect(page).to have_content(translated(participatory_process.title, locale: :en)) + expect(page).to have_content(translated(promoted_process.title, locale: :en)) + expect(page).to have_content(translated(group.title, locale: :en)) + expect(page).to have_css("a.card__grid", count: 3) - within find("#processes-grid .column", text: translated(participatory_process.title)) do - within ".card__footer" do - expect(page).to have_content("Current phase:\nActive step") - end - end - end - - context "when the active step has CTA text and url set" do - let(:cta_path) { "my_path" } - let(:cta_text) { { en: "Take action!", ca: "Take action!", es: "Take action!" } } - - before do - active_step.update!(cta_path: cta_path, cta_text: cta_text) - end - - it "shows a CTA button" do - visit decidim_participatory_processes.participatory_processes_path - - within "#participatory_process_#{participatory_process.id}" do - expect(page).to have_link("Take action!") - end - end - - context "when cta_text is empty in current locale" do - let(:cta_text) { { en: "", ca: "Take action!", es: "Take action!" } } - - it "displays the regular cta button" do - visit decidim_participatory_processes.participatory_processes_path + expect(page).to have_no_content(translated(unpublished_process.title, locale: :en)) + expect(page).to have_no_content(translated(past_process.title, locale: :en)) + expect(page).to have_no_content(translated(upcoming_process.title, locale: :en)) + expect(page).to have_no_content(translated(grouped_process.title, locale: :en)) + end + end - within "#participatory_process_#{participatory_process.id}" do - expect(page).not_to have_link("Take action!") - expect(page).to have_link("More info") - end - end - end + it "links to the individual process page" do + first(".card__grid h3", text: translated(participatory_process.title, locale: :en)).click - context "when process is promoted" do - let(:cta_text) { { en: "Take promoted action!", ca: "Take promoted action!", es: "Take promoted action!" } } - let!(:active_step) do - create(:participatory_process_step, - :active, - participatory_process: promoted_process, - title: { en: "Active step", ca: "Fase activa", es: "Fase activa" }) - end - - it "shows a CTA button" do - visit decidim_participatory_processes.participatory_processes_path + expect(page).to have_current_path decidim_participatory_processes.participatory_process_path(participatory_process) + end - within "#highlighted-processes" do - expect(page).to have_link("Take promoted action!") - end - end - end + context "with active steps" do + let!(:step) { create(:participatory_process_step, participatory_process:) } + let!(:active_step) do + create(:participatory_process_step, + :active, + participatory_process:, + title: { en: "Active step", ca: "Fase activa", es: "Fase activa" }) + end - context "when user switch locale" do - before do - visit decidim_participatory_processes.participatory_processes_path - within_language_menu do - click_link "Català" - end - end + it "links to the active step" do + visit decidim_participatory_processes.participatory_processes_path - it "displays the regular cta button" do - within "#participatory_process_#{participatory_process.id}" do - expect(page).to have_link("Take action!", href: "/processes/#{participatory_process.slug}/my_path") - end - end + within "#processes-grid .card__grid", text: translated(participatory_process.title) do + within ".card__grid-metadata" do + expect(page).to have_content("Active step") end end end + end - context "when there are promoted participatory process groups" do - let!(:promoted_group) { create(:participatory_process_group, :promoted, :with_participatory_processes, organization: organization) } - let(:promoted_items_titles) { page.all("#highlighted-processes .card__title").map(&:text) } + context "when there are promoted participatory process groups" do + let!(:promoted_group) { create(:participatory_process_group, :promoted, :with_participatory_processes, organization:) } + let(:promoted_items_titles) { page.all("#highlighted-processes .h3").map(&:text) } - before do - promoted_group.title["en"] = "D'Artagnan #{promoted_group.title["en"]}" - promoted_group.save! - visit decidim_participatory_processes.participatory_processes_path - end + before do + promoted_group.title["en"] = "D'Artagnan #{promoted_group.title["en"]}" + promoted_group.save! + visit decidim_participatory_processes.participatory_processes_path + end - it "shows a highligted processes section" do - expect(page).to have_content("HIGHLIGHTED PROCESSES") - end + it "shows a highlighted processes section" do + expect(page).to have_content("Highlighted processes") + end - it "lists only promoted groups" do - expect(promoted_items_titles).to include(translated(promoted_group.title, locale: :en)) - expect(promoted_items_titles).not_to include(translated(group.title, locale: :en)) - end + it "lists only promoted groups" do + expect(promoted_items_titles).to include(translated(promoted_group.title, locale: :en)) + expect(promoted_items_titles).not_to include(translated(group.title, locale: :en)) + end - it "lists all the highlighted process groups" do - within "#highlighted-processes" do - expect(page).to have_content(translated(promoted_group.title, locale: :en)) - expect(page).to have_selector(".card--full", count: 2) - end + it "lists all the highlighted process groups" do + within "#highlighted-processes" do + expect(page).to have_content(translated(promoted_group.title, locale: :en)) + expect(page).to have_css("[id^='participatory_process_highlight']", count: 1) + expect(page).to have_css("[id^='participatory_process_group_highlight']", count: 1) end + end + end + end + end - context "and promoted group has defined a CTA content block" do - let(:cta_settings) do - { - button_url: "https://example.org/action", - button_text_en: "cta text", - description_en: "cta description" - } - end + it_behaves_like "followable content for users" do + let!(:participatory_process) { base_process } + let!(:user) { create(:user, :confirmed, organization:) } + let(:followable) { participatory_process } + let(:followable_path) { decidim_participatory_processes.participatory_process_path(participatory_process) } + end - before do - create( - :content_block, - organization: organization, - scope_name: :participatory_process_group_homepage, - scoped_resource_id: promoted_group.id, - manifest_name: :cta, - settings: cta_settings - ) - visit decidim_participatory_processes.participatory_processes_path - end + context "when going to the participatory process page" do + let!(:participatory_process) { base_process } + let!(:proposals_component) { create(:component, :published, participatory_space: participatory_process, manifest_name: :proposals) } + let!(:meetings_component) { create(:component, :unpublished, participatory_space: participatory_process, manifest_name: :meetings) } - it "shows a CTA button inside group card" do - within("#highlighted-processes") do - expect(page).to have_link(cta_settings[:button_text_en], href: cta_settings[:button_url]) - end - end + before do + create_list(:proposal, 3, component: proposals_component) + allow(Decidim).to receive(:component_manifests).and_return([proposals_component.manifest, meetings_component.manifest]) + end - context "and promoted group belongs to another organization" do - let!(:promoted_group) { create(:participatory_process_group, :promoted, :with_participatory_processes) } + describe "page title" do + it "has the participatory process title in the show page" do + visit decidim_participatory_processes.participatory_process_path(participatory_process) - it "shows a CTA button inside group card" do - within("#highlighted-processes") do - expect(page).not_to have_link(cta_settings[:button_text_en], href: cta_settings[:button_url]) - end - end - end - end - end + expect(page).to have_title("#{translated(participatory_process.title)} - #{translated(organization.name)}") end end - context "when going to the participatory process page" do - let!(:participatory_process) { base_process } - let!(:proposals_component) { create(:component, :published, participatory_space: participatory_process, manifest_name: :proposals) } - let!(:meetings_component) { create(:component, :unpublished, participatory_space: participatory_process, manifest_name: :meetings) } + it_behaves_like "editable content for admins" do + let(:target_path) { decidim_participatory_processes.participatory_process_path(participatory_process) } + end + + context "when requesting the participatory process path" do + let(:blocks_manifests) { [] } before do - create_list(:proposal, 3, component: proposals_component) - allow(Decidim).to receive(:component_manifests).and_return([proposals_component.manifest, meetings_component.manifest]) + blocks_manifests.each do |manifest_name| + create(:content_block, organization:, scope_name: :participatory_process_homepage, manifest_name:, scoped_resource_id: participatory_process.id) + end + visit decidim_participatory_processes.participatory_process_path(participatory_process) end - it_behaves_like "editable content for admins" do - let(:target_path) { decidim_participatory_processes.participatory_process_path(participatory_process) } - end + context "when requesting the process path" do + context "when hero, main_data and phase and duration blocks are enabled" do + let(:blocks_manifests) { [:hero, :main_data, :extra_data, :metadata] } - context "when requesting the participatory process path" do - before do - visit decidim_participatory_processes.participatory_process_path(participatory_process) - end - - context "when requesting the process path" do it "shows the details of the given process" do - within "main" do + within "[data-content]" do + expect(page).to have_content("About this process") expect(page).to have_content(translated(participatory_process.title, locale: :en)) expect(page).to have_content(translated(participatory_process.subtitle, locale: :en)) expect(page).to have_content(translated(participatory_process.description, locale: :en)) @@ -401,12 +324,20 @@ expect(page).to have_content(translated(participatory_process.target, locale: :en)) expect(page).to have_content(translated(participatory_process.participatory_scope, locale: :en)) expect(page).to have_content(translated(participatory_process.participatory_structure, locale: :en)) - expect(page).to have_content(I18n.l(participatory_process.end_date, format: :long)) + expect(page).to have_content(I18n.l(participatory_process.start_date, format: :decidim_short_with_month_name_short)) + expect(page).to have_content(I18n.l(participatory_process.end_date, format: :decidim_short_with_month_name_short)) expect(page).to have_content(participatory_process.hashtag) end end - it_behaves_like "has attachments" do + it_behaves_like "has embedded video in description", :base_description + it_behaves_like "has embedded video in description", :short_description + end + + context "when attachments blocks enabled" do + let(:blocks_manifests) { [:related_documents, :related_images] } + + it_behaves_like "has attachments content blocks" do let(:attached_to) { participatory_process } end @@ -414,148 +345,143 @@ let(:attached_to) { participatory_process } let(:collection_for) { participatory_process } end + end - context "and it belongs to a group" do - let!(:group) { create :participatory_process_group, participatory_processes: [participatory_process], organization: organization } + context "and it belongs to a group" do + let!(:group) { create(:participatory_process_group, participatory_processes: [participatory_process], organization:) } + let(:blocks_manifests) { [:extra_data] } - it "has a link to the group the process belongs to" do - visit decidim_participatory_processes.participatory_process_path(participatory_process) + it "has a link to the group the process belongs to" do + visit decidim_participatory_processes.participatory_process_path(participatory_process) - expect(page).to have_link(translated(group.title, locale: :en), href: decidim_participatory_processes.participatory_process_group_path(group)) - end + expect(page).to have_link(translated(group.title, locale: :en), href: decidim_participatory_processes.participatory_process_group_path(group)) end + end - context "when it has some linked processes" do - let(:published_process) { create :participatory_process, :published, organization: organization } - let(:unpublished_process) { create :participatory_process, :unpublished, organization: organization } - - it "only shows the published linked processes" do - participatory_process - .link_participatory_space_resources( - [published_process, unpublished_process], - "related_processes" - ) - visit decidim_participatory_processes.participatory_process_path(participatory_process) - expect(page).to have_content(translated(published_process.title)) - expect(page).to have_no_content(translated(unpublished_process.title)) - end + context "when it has some linked processes" do + let(:published_process) { create(:participatory_process, :published, organization:) } + let(:unpublished_process) { create(:participatory_process, :unpublished, organization:) } + let(:blocks_manifests) { [:related_processes] } + + it "only shows the published linked processes" do + participatory_process + .link_participatory_space_resources( + [published_process, unpublished_process], + "related_processes" + ) + visit decidim_participatory_processes.participatory_process_path(participatory_process) + expect(page).to have_content(translated(published_process.title)) + expect(page).to have_no_content(translated(unpublished_process.title)) end + end - context "and the process has some components" do - it "shows the components" do - within ".process-nav" do - expect(page).to have_content(translated(proposals_component.name, locale: :en).upcase) - expect(page).to have_no_content(translated(meetings_component.name, locale: :en).upcase) - end - end + context "and the process has some components" do + let(:blocks_manifests) { [:main_data] } - context "and the process metrics are enabled" do - let(:organization) { create(:organization) } - let(:metrics) do - Decidim.metrics_registry.filtered(highlight: true, scope: "participatory_process").each do |metric_registry| - create(:metric, metric_type: metric_registry.metric_name, day: Time.zone.today - 1.week, organization: organization, participatory_space_type: Decidim::ParticipatoryProcess.name, participatory_space_id: participatory_process.id, cumulative: 5, quantity: 2) - end - end + it "shows the components" do + within ".participatory-space__nav-container" do + expect(page).to have_content(translated(proposals_component.name, locale: :en)) + expect(page).to have_no_content(translated(meetings_component.name, locale: :en)) + end + end - before do - metrics - visit current_path + context "and the process metrics are enabled" do + let(:organization) { create(:organization) } + let(:metrics) do + Decidim.metrics_registry.filtered(highlight: true, scope: "participatory_process").each do |metric_registry| + create(:metric, metric_type: metric_registry.metric_name, day: Time.zone.today - 1.week, organization:, participatory_space_type: Decidim::ParticipatoryProcess.name, participatory_space_id: participatory_process.id, cumulative: 5, quantity: 2) end + end + let(:blocks_manifests) { [:metrics] } - it "shows the metrics charts" do - expect(page).to have_css("h3.section-heading", text: "METRICS") + before do + metrics + visit current_path + end - within "#metrics" do - expect(page).to have_css("input#metrics-space_type[value='Decidim::ParticipatoryProcess']", visible: :hidden) - expect(page).to have_css("input#metrics-space_id[value='#{participatory_process.id}']", visible: :hidden) - Decidim.metrics_registry.filtered(highlight: true, scope: "participatory_process").each do |metric_registry| - expect(page).to have_css(%(##{metric_registry.metric_name}_chart)) - end - end - end + it "shows the metrics charts" do + expect(page).to have_css("h2.h2", text: "Metrics") - it "renders a link to all metrics" do - within "#metrics" do - expect(page).to have_link("Show all metrics") + within "[data-metrics]" do + Decidim.metrics_registry.filtered(highlight: true, scope: "participatory_process").each do |metric_registry| + expect(page).to have_css(%(##{metric_registry.metric_name}_chart)) end end + end - it "click link" do - click_link("Show all metrics") - have_current_path(decidim_participatory_processes.all_metrics_participatory_process_path(participatory_process)) + it "renders a link to all metrics" do + within "[data-metrics]" do + expect(page).to have_link("Show all") end end - context "and the process statistics are enabled" do - let(:show_statistics) { true } - - it "the stats for those components are visible" do - within ".section-statistics" do - expect(page).to have_css("h3.section-heading", text: "STATISTICS") - expect(page).to have_css(".statistic__title", text: "PROPOSALS") - expect(page).to have_css(".statistic__number", text: "3") - expect(page).to have_no_css(".statistic__title", text: "MEETINGS") - expect(page).to have_no_css(".statistic__number", text: "0") - end - end + it "click link" do # rubocop:disable RSpec/NoExpectationExample + click_on("Show all") + have_current_path(decidim_participatory_processes.all_metrics_participatory_process_path(participatory_process)) end + end - context "and the process statistics are not enabled" do - let(:show_statistics) { false } + context "and the process statistics are enabled" do + let(:blocks_manifests) { [:hero, :stats] } - it "the stats for those components are not visible" do - expect(page).to have_no_css("h3.section-heading", text: "STATISTICS") - expect(page).to have_no_css(".statistic__title", text: "PROPOSALS") - expect(page).to have_no_css(".statistic__number", text: "3") - end + it "the stats for those components are visible" do + expect(page).to have_css("[data-statistic]", count: 3) end - context "and the process metrics are not enabled" do - let(:show_metrics) { false } + it_behaves_like "accessible page" + end - it "the metrics for the participatory processes are not rendered" do - expect(page).to have_no_css("h4.section-heading", text: "METRICS") - end + context "and the process statistics are not enabled" do + let(:blocks_manifests) { [] } - it "has no link to all metrics" do - expect(page).to have_no_link("Show all metrics") - end + it "the stats for those components are not visible" do + expect(page).to have_no_css("[data-statistics]", count: 3) + expect(page).to have_no_css(".statistic__title", text: "Proposals") + expect(page).to have_no_css(".statistic__number", text: "3") end + end - context "and the process doesn't have hashtag" do - let(:hashtag) { false } + context "and the process metrics are not enabled" do + it "the metrics for the participatory processes are not rendered" do + expect(page).to have_no_css("h4", text: "METRICS") + end - it "the hashtags for those components are not visible" do - expect(page).to have_no_content("#") - end + it "has no link to all metrics" do + expect(page).to have_no_link("Show all metrics") end end - context "when assemblies are linked to participatory process" do - let!(:published_assembly) { create(:assembly, :published, organization: organization) } - let!(:unpublished_assembly) { create(:assembly, :unpublished, organization: organization) } - let!(:private_assembly) { create(:assembly, :published, :private, :opaque, organization: organization) } - let!(:transparent_assembly) { create(:assembly, :published, :private, :transparent, organization: organization) } + context "and the process does not have hashtag" do + let(:hashtag) { false } - before do - published_assembly.link_participatory_space_resources(participatory_process, "included_participatory_processes") - unpublished_assembly.link_participatory_space_resources(participatory_process, "included_participatory_processes") - private_assembly.link_participatory_space_resources(participatory_process, "included_participatory_processes") - transparent_assembly.link_participatory_space_resources(participatory_process, "included_participatory_processes") - visit decidim_participatory_processes.participatory_process_path(participatory_process) + it "the hashtags for those components are not visible" do + expect(page).to have_no_content("#") end + end + end - it "display related assemblies" do - expect(page).to have_content("RELATED ASSEMBLIES") - expect(page).to have_content(translated(published_assembly.title)) - expect(page).to have_content(translated(transparent_assembly.title)) - expect(page).to have_no_content(translated(unpublished_assembly.title)) - expect(page).to have_no_content(translated(private_assembly.title)) - end + context "when assemblies are linked to participatory process" do + let!(:published_assembly) { create(:assembly, :published, organization:) } + let!(:unpublished_assembly) { create(:assembly, :unpublished, organization:) } + let!(:private_assembly) { create(:assembly, :published, :private, :opaque, organization:) } + let!(:transparent_assembly) { create(:assembly, :published, :private, :transparent, organization:) } + let(:blocks_manifests) { [:related_assemblies] } + + before do + published_assembly.link_participatory_space_resources(participatory_process, "included_participatory_processes") + unpublished_assembly.link_participatory_space_resources(participatory_process, "included_participatory_processes") + private_assembly.link_participatory_space_resources(participatory_process, "included_participatory_processes") + transparent_assembly.link_participatory_space_resources(participatory_process, "included_participatory_processes") + visit decidim_participatory_processes.participatory_process_path(participatory_process) end - it_behaves_like "has embedded video in description", :base_description - it_behaves_like "has embedded video in description", :short_description + it "display related assemblies" do + expect(page).to have_content("Related assemblies") + expect(page).to have_content(translated(published_assembly.title)) + expect(page).to have_content(translated(transparent_assembly.title)) + expect(page).to have_no_content(translated(unpublished_assembly.title)) + expect(page).to have_no_content(translated(private_assembly.title)) + end end end end