diff --git a/.github/workflows/ci_emitter.yml b/.github/workflows/ci_emitter.yml index d903449..402f2fc 100644 --- a/.github/workflows/ci_emitter.yml +++ b/.github/workflows/ci_emitter.yml @@ -71,6 +71,10 @@ jobs: npm- - run: bundle exec rake test_app name: Create test app + - run: | + rm -f ./spec/decidim_dummy_app/app/services/dummy_signature_handler.rb + rm -f ./spec/decidim_dummy_app/app/services/dummy_sms_mobile_phone_validator.rb + name: Remove Initiative-dependent dummy files - run: mkdir -p ./spec/decidim_dummy_app/tmp/screenshots name: Create the screenshots folder - uses: nanasess/setup-chromedriver@v2 diff --git a/.node-version b/.node-version index 4a1f488..7d41c73 100644 --- a/.node-version +++ b/.node-version @@ -1 +1 @@ -18.17.1 +22.14.0 diff --git a/.ruby-version b/.ruby-version index be94e6f..a0891f5 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -3.2.2 +3.3.4 diff --git a/Gemfile b/Gemfile index ce110bd..54f1427 100644 --- a/Gemfile +++ b/Gemfile @@ -16,6 +16,7 @@ gem "decidim", DECIDIM_VERSION.to_s gem "decidim-emitter", path: "." gem "bootsnap", "~> 1.4" +gem "faker" gem "puma", ">= 6.3.1" group :development, :test do diff --git a/Gemfile.lock b/Gemfile.lock index 243249a..2c37941 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,81 +1,89 @@ PATH remote: . specs: - decidim-emitter (1.0.0) - decidim-core (~> 0.29.0) - decidim-participatory_processes (~> 0.29.0) + decidim-emitter (2.0.0) + decidim-core (~> 0.31.0) + decidim-participatory_processes (~> 0.31.0) GEM remote: https://rubygems.org/ specs: - actioncable (7.0.8.7) - actionpack (= 7.0.8.7) - activesupport (= 7.0.8.7) + actioncable (7.2.3) + actionpack (= 7.2.3) + activesupport (= 7.2.3) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - 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) - 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 (7.0.8.7) - actionview (= 7.0.8.7) - activesupport (= 7.0.8.7) - rack (~> 2.0, >= 2.2.4) + zeitwerk (~> 2.6) + actionmailbox (7.2.3) + actionpack (= 7.2.3) + activejob (= 7.2.3) + activerecord (= 7.2.3) + activestorage (= 7.2.3) + activesupport (= 7.2.3) + mail (>= 2.8.0) + actionmailer (7.2.3) + actionpack (= 7.2.3) + actionview (= 7.2.3) + activejob (= 7.2.3) + activesupport (= 7.2.3) + mail (>= 2.8.0) + rails-dom-testing (~> 2.2) + actionpack (7.2.3) + actionview (= 7.2.3) + activesupport (= 7.2.3) + cgi + nokogiri (>= 1.8.5) + racc + rack (>= 2.2.4, < 3.3) + rack-session (>= 1.0.1) rack-test (>= 0.6.3) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (7.0.8.7) - actionpack (= 7.0.8.7) - activerecord (= 7.0.8.7) - activestorage (= 7.0.8.7) - activesupport (= 7.0.8.7) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + useragent (~> 0.16) + actiontext (7.2.3) + actionpack (= 7.2.3) + activerecord (= 7.2.3) + activestorage (= 7.2.3) + activesupport (= 7.2.3) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.0.8.7) - activesupport (= 7.0.8.7) + actionview (7.2.3) + activesupport (= 7.2.3) builder (~> 3.1) - erubi (~> 1.4) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.1, >= 1.2.0) + cgi + erubi (~> 1.11) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) active_link_to (1.0.5) actionpack addressable - activejob (7.0.8.7) - activesupport (= 7.0.8.7) + activejob (7.2.3) + activesupport (= 7.2.3) globalid (>= 0.3.6) - 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) + activemodel (7.2.3) + activesupport (= 7.2.3) + activerecord (7.2.3) + activemodel (= 7.2.3) + activesupport (= 7.2.3) + timeout (>= 0.4.0) + activestorage (7.2.3) + actionpack (= 7.2.3) + activejob (= 7.2.3) + activerecord (= 7.2.3) + activesupport (= 7.2.3) marcel (~> 1.0) - mini_mime (>= 1.1.0) - activesupport (7.0.8.7) - concurrent-ruby (~> 1.0, >= 1.0.2) + activesupport (7.2.3) + base64 + benchmark (>= 0.3) + bigdecimal + concurrent-ruby (~> 1.0, >= 1.3.1) + connection_pool (>= 2.2.5) + drb i18n (>= 1.6, < 2) + logger (>= 1.4.2) minitest (>= 5.1) - tzinfo (~> 2.0) + securerandom (>= 0.3) + tzinfo (~> 2.0, >= 2.0.5) acts_as_list (1.2.4) activerecord (>= 6.1) activesupport (>= 6.1) @@ -83,11 +91,12 @@ GEM public_suffix (>= 2.0.2, < 7.0) ast (2.4.2) base64 (0.2.0) - batch-loader (1.5.0) + batch-loader (2.0.6) bcrypt (3.1.20) - better_html (2.1.1) - actionview (>= 6.0) - activesupport (>= 6.0) + benchmark (0.5.0) + better_html (2.2.0) + actionview (>= 7.0) + activesupport (>= 7.0) ast (~> 2.0) erubi (~> 1.4) parser (>= 2.4) @@ -98,9 +107,9 @@ GEM msgpack (~> 1.2) brakeman (6.2.2) racc - browser (2.7.1) + browser (6.2.0) builder (3.3.0) - bullet (7.1.6) + bullet (8.0.8) activesupport (>= 3.0.0) uniform_notifier (~> 1.11) byebug (11.1.3) @@ -124,135 +133,153 @@ GEM cells-rails (0.1.6) actionpack (>= 5.0) cells (>= 4.1.6, < 5.0.0) + cgi (0.5.1) charlock_holmes (0.7.9) + chartkick (5.1.5) childprocess (5.1.0) logger (~> 1.5) + chunky_png (1.4.0) climate_control (1.2.0) - commonmarker (0.23.11) + cmdparse (3.0.7) + commonmarker (0.23.12) concurrent-ruby (1.3.4) - crack (1.0.0) + connection_pool (2.5.5) + crack (1.0.1) bigdecimal rexml crass (1.0.6) css_parser (1.21.0) addressable csv (3.3.2) - dartsass (1.49.8) + data_migrate (11.3.1) + activerecord (>= 6.1) + railties (>= 6.1) date (3.4.1) date_validator (0.12.0) activemodel (>= 3) activesupport (>= 3) - 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) + decidim (0.31.1) + decidim-accountability (= 0.31.1) + decidim-admin (= 0.31.1) + decidim-api (= 0.31.1) + decidim-assemblies (= 0.31.1) + decidim-blogs (= 0.31.1) + decidim-budgets (= 0.31.1) + decidim-comments (= 0.31.1) + decidim-core (= 0.31.1) + decidim-debates (= 0.31.1) + decidim-forms (= 0.31.1) + decidim-generators (= 0.31.1) + decidim-meetings (= 0.31.1) + decidim-pages (= 0.31.1) + decidim-participatory_processes (= 0.31.1) + decidim-proposals (= 0.31.1) + decidim-sortitions (= 0.31.1) + decidim-surveys (= 0.31.1) + decidim-system (= 0.31.1) + decidim-verifications (= 0.31.1) + decidim-accountability (0.31.1) + decidim-comments (= 0.31.1) + decidim-core (= 0.31.1) + decidim-admin (0.31.1) active_link_to (~> 1.0) - decidim-core (= 0.29.1) + decidim-core (= 0.31.1) devise (~> 4.7) devise-i18n (~> 1.2) devise_invitable (~> 2.0, >= 2.0.9) - decidim-api (0.29.1) - decidim-core (= 0.29.1) - graphql (~> 2.2.6) - graphql-docs (~> 4.0) + decidim-api (0.31.1) + decidim-core (= 0.31.1) + devise-jwt (~> 0.12.1) + graphql (~> 2.4.0, >= 2.4.17) + graphql-docs (~> 5.0) rack-cors (~> 1.0) - 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) + decidim-assemblies (0.31.1) + decidim-core (= 0.31.1) + decidim-blogs (0.31.1) + decidim-admin (= 0.31.1) + decidim-comments (= 0.31.1) + decidim-core (= 0.31.1) + decidim-budgets (0.31.1) + decidim-comments (= 0.31.1) + decidim-core (= 0.31.1) + decidim-comments (0.31.1) + decidim-core (= 0.31.1) redcarpet (~> 3.5, >= 3.5.1) - decidim-core (0.29.1) + decidim-core (0.31.1) active_link_to (~> 1.0) acts_as_list (~> 1.0) - batch-loader (~> 1.2) - browser (~> 2.7) + batch-loader (~> 2.0) + browser (~> 6.2.0) cells-erb (~> 0.1.0) cells-rails (~> 0.1.3) charlock_holmes (~> 0.7) + chartkick (~> 5.1.2) + concurrent-ruby (~> 1.3.0) + connection_pool (< 3) + data_migrate (~> 11.3) date_validator (~> 0.12.0) devise (~> 4.7) - devise-i18n (~> 1.2, < 1.11.1) + devise-i18n (~> 1.2) diffy (~> 3.3) 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) + hexapdf (~> 1.1.0) image_processing (~> 1.2) invisible_captcha (~> 0.12) kaminari (~> 1.2, >= 1.2.1) loofah (~> 2.19, >= 2.19.1) mime-types (>= 1.16, < 4.0) mini_magick (~> 4.9) - net-smtp (~> 0.3.1) + net-smtp (~> 0.5.0) 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.4.0, < 2) + paper_trail (~> 16.0) + paranoia (~> 3.0.0) + pg (~> 1.5.0, < 2) pg_search (~> 2.2) premailer-rails (~> 1.10) - psych (~> 4.0) rack (~> 2.2, >= 2.2.8.1) rack-attack (~> 6.0) - rails (~> 7.0.8) + rails (~> 7.2.0, >= 7.2.2.2) rails-i18n (~> 7.0) - ransack (~> 3.2.1) + ransack (~> 4.2.0) redis (~> 4.1) - request_store (~> 1.5.0) + request_store (~> 1.7.0) + rqrcode (~> 2.2.0) rubyXL (~> 3.4) rubyzip (~> 2.0) - shakapacker (~> 7.1.0) - valid_email2 (~> 4.0) + shakapacker (~> 8.3.0) + valid_email2 (~> 7.0) web-push (~> 3.0) - wisper (~> 2.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) + wisper (~> 3.0) + decidim-debates (0.31.1) + decidim-comments (= 0.31.1) + decidim-core (= 0.31.1) + decidim-dev (0.31.1) + bullet (~> 8.0.0) byebug (~> 11.0) capybara (~> 3.39) - decidim (= 0.29.1) - erb_lint (~> 0.4.0) + decidim-admin (= 0.31.1) + decidim-api (= 0.31.1) + decidim-comments (= 0.31.1) + decidim-core (= 0.31.1) + decidim-generators (= 0.31.1) + decidim-verifications (= 0.31.1) + erb_lint (~> 0.8.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) + puma (~> 6.5) rails-controller-testing (~> 1.0) rspec (~> 3.12) rspec-cells (~> 0.3.7) @@ -260,15 +287,16 @@ GEM rspec-rails (~> 6.0) rspec-retry (~> 0.6.2) 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) + rubocop (~> 1.78.0) + rubocop-capybara (~> 2.22.0, >= 2.22.1) + rubocop-factory_bot (~> 2.27.0) + rubocop-faker (~> 1.3, >= 1.3.0) + rubocop-graphql (~> 1.5, >= 1.5.6) + rubocop-performance (~> 1.25, >= 1.25.0) + rubocop-rails (~> 2.32.0, >= 2.32.0) + rubocop-rspec (~> 3.0, >= 3.6.0) + rubocop-rspec_rails (~> 2.31.0) + rubocop-rubycw (~> 0.2.0) selenium-webdriver (~> 4.9) simplecov (~> 0.22.0) simplecov-cobertura (~> 2.1.0) @@ -277,41 +305,39 @@ GEM w3c_rspec_validators (~> 0.3.0) webmock (~> 3.18) wisper-rspec (~> 1.0) - decidim-forms (0.29.1) - decidim-core (= 0.29.1) - wicked_pdf (~> 2.1) - 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) + decidim-forms (0.31.1) + decidim-core (= 0.31.1) + decidim-generators (0.31.1) + decidim-core (= 0.31.1) + decidim-meetings (0.31.1) + decidim-core (= 0.31.1) + decidim-forms (= 0.31.1) icalendar (~> 2.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) + decidim-pages (0.31.1) + decidim-core (= 0.31.1) + decidim-participatory_processes (0.31.1) + decidim-core (= 0.31.1) + decidim-proposals (0.31.1) + decidim-comments (= 0.31.1) + decidim-core (= 0.31.1) + doc2text (~> 0.4.0, >= 0.4.8) redcarpet (~> 3.5, >= 3.5.1) - 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) + decidim-sortitions (0.31.1) + decidim-admin (= 0.31.1) + decidim-comments (= 0.31.1) + decidim-core (= 0.31.1) + decidim-proposals (= 0.31.1) + decidim-surveys (0.31.1) + decidim-core (= 0.31.1) + decidim-forms (= 0.31.1) + decidim-system (0.31.1) active_link_to (~> 1.0) - decidim-core (= 0.29.1) + decidim-core (= 0.31.1) devise (~> 4.7) devise-i18n (~> 1.2) devise_invitable (~> 2.0, >= 2.0.9) - decidim-verifications (0.29.1) - decidim-core (= 0.29.1) + decidim-verifications (0.31.1) + decidim-core (= 0.31.1) declarative-builder (0.2.0) trailblazer-option (~> 0.1.0) declarative-option (0.1.0) @@ -323,24 +349,39 @@ GEM warden (~> 1.2.3) devise-i18n (1.11.0) devise (>= 4.9.0) - devise_invitable (2.0.9) + devise-jwt (0.12.1) + devise (~> 4.0) + warden-jwt_auth (~> 0.10) + devise_invitable (2.0.11) actionmailer (>= 5.0) devise (>= 4.6) - diff-lcs (1.5.1) + diff-lcs (1.6.2) diffy (3.4.3) - doc2text (0.4.7) - nokogiri (>= 1.13.2, < 1.17.0) + doc2text (0.4.8) + nokogiri (>= 1.18.2) rubyzip (~> 2.3.0) docile (1.4.1) doorkeeper (5.8.1) railties (>= 5) doorkeeper-i18n (4.0.1) - erb_lint (0.4.0) + drb (2.2.3) + dry-auto_inject (1.1.0) + dry-core (~> 1.1) + zeitwerk (~> 2.6) + dry-configurable (1.3.0) + dry-core (~> 1.1) + zeitwerk (~> 2.6) + dry-core (1.2.0) + concurrent-ruby (~> 1.0) + logger + zeitwerk (~> 2.6) + erb (6.0.1) + erb_lint (0.8.0) activesupport better_html (>= 2.0.1) parser (>= 2.7.1.4) rainbow - rubocop + rubocop (>= 1) smart_properties erbse (0.1.4) temple @@ -349,11 +390,11 @@ GEM excon (1.2.3) extended-markdown-filter (0.7.0) html-pipeline (~> 2.9) - factory_bot (6.5.0) - activesupport (>= 5.0.0) - factory_bot_rails (6.4.4) + factory_bot (6.5.6) + activesupport (>= 6.1.0) + factory_bot_rails (6.5.1) factory_bot (~> 6.5) - railties (>= 5.0.0) + railties (>= 6.1.0) faker (3.5.1) i18n (>= 1.8.11, < 2) faraday (2.12.2) @@ -362,8 +403,10 @@ GEM logger faraday-net_http (3.4.0) net-http (>= 0.5.0) + ffi (1.17.1-arm64-darwin) ffi (1.17.1-x86_64-darwin) ffi (1.17.1-x86_64-linux-gnu) + fiber-storage (1.0.1) file_validators (3.0.0) activemodel (>= 3.2) mime-types (>= 1.0) @@ -375,29 +418,43 @@ GEM fog-local (0.8.0) fog-core (>= 1.27, < 3.0) formatador (1.1.0) - foundation_rails_helper (4.0.1) - actionpack (>= 4.1, < 7.1) - activemodel (>= 4.1, < 7.1) - activesupport (>= 4.1, < 7.1) - railties (>= 4.1, < 7.1) gemoji (3.0.1) geocoder (1.8.5) base64 (>= 0.1.0) csv (>= 3.0.0) + geom2d (0.4.1) globalid (1.2.1) activesupport (>= 6.1) - graphql (2.2.16) + google-protobuf (4.33.4-arm64-darwin) + bigdecimal + rake (>= 13) + google-protobuf (4.33.4-x86_64-darwin) + bigdecimal + rake (>= 13) + google-protobuf (4.33.4-x86_64-linux-gnu) + bigdecimal + rake (>= 13) + graphql (2.4.17) base64 - graphql-docs (4.0.0) + fiber-storage + logger + graphql-docs (5.2.0) commonmarker (~> 0.23, >= 0.23.6) - dartsass (~> 1.49) escape_utils (~> 1.2) extended-markdown-filter (~> 0.4) gemoji (~> 3.0) graphql (~> 2.0) html-pipeline (~> 2.14, >= 2.14.3) + logger (~> 1.6) + ostruct (~> 0.6) + sass-embedded (~> 1.58) hashdiff (1.1.2) hashie (5.0.0) + hexapdf (1.1.1) + cmdparse (~> 3.0, >= 3.0.3) + geom2d (~> 0.4, >= 0.4.1) + openssl (>= 2.2.1) + strscan (>= 3.1.2) highline (3.1.2) reline html-pipeline (2.14.3) @@ -406,18 +463,22 @@ GEM htmlentities (4.3.4) i18n (1.14.6) concurrent-ruby (~> 1.0) - i18n-tasks (1.0.14) + i18n-tasks (1.1.2) activesupport (>= 4.0.2) ast (>= 2.1.0) erubi - highline (>= 2.0.0) + highline (>= 3.0.0) i18n parser (>= 3.2.2.1) + prism rails-i18n rainbow (>= 2.2.2, < 4.0) + ruby-progressbar (~> 1.8, >= 1.8.1) terminal-table (>= 1.5.1) - icalendar (2.10.3) + icalendar (2.12.1) + base64 ice_cube (~> 0.16) + logger ostruct ice_cube (0.17.0) image_processing (1.13.0) @@ -425,7 +486,11 @@ GEM ruby-vips (>= 2.0.17, < 3) invisible_captcha (0.13.0) rails (>= 3.2.0) - io-console (0.8.0) + io-console (0.8.2) + irb (1.16.0) + pp (>= 0.6.0) + rdoc (>= 4.0.0) + reline (>= 0.4.2) json (2.9.1) jwt (2.10.1) base64 @@ -452,6 +517,7 @@ GEM letter_opener (~> 1.7) railties (>= 5.2) rexml + lint_roller (1.1.0) listen (3.9.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) @@ -465,8 +531,7 @@ GEM net-pop net-smtp marcel (1.0.4) - matrix (0.4.2) - method_source (1.1.0) + matrix (0.4.3) mime-types (3.6.0) logger mime-types-data (~> 3.2015) @@ -486,12 +551,14 @@ GEM net-protocol net-protocol (0.2.2) timeout - net-smtp (0.3.4) + net-smtp (0.5.1) net-protocol nio4r (2.7.4) - nokogiri (1.16.8-x86_64-darwin) + nokogiri (1.19.0-arm64-darwin) racc (~> 1.4) - nokogiri (1.16.8-x86_64-linux) + nokogiri (1.19.0-x86_64-darwin) + racc (~> 1.4) + nokogiri (1.19.0-x86_64-linux-gnu) racc (~> 1.4) oauth (1.1.0) oauth-tty (~> 1.0, >= 1.0.1) @@ -532,20 +599,25 @@ GEM 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) + ostruct (0.6.3) + package_json (0.2.0) + paper_trail (16.0.0) + activerecord (>= 6.1) + request_store (~> 1.4) parallel (1.26.3) parallel_tests (4.8.0) parallel - parser (3.3.6.0) + paranoia (3.0.1) + activerecord (>= 6, < 8.1) + parser (3.3.10.1) ast (~> 2.4.1) racc - pg (1.4.6) + pg (1.5.9) pg_search (2.3.7) activerecord (>= 6.1) activesupport (>= 6.1) + pp (0.6.3) + prettyprint premailer (1.27.0) addressable css_parser (>= 1.19.0) @@ -554,6 +626,8 @@ GEM actionmailer (>= 3) net-smtp premailer (~> 1.7, >= 1.7.9) + prettyprint (0.2.0) + prism (1.9.0) psych (4.0.6) stringio public_suffix (6.0.1) @@ -570,22 +644,27 @@ GEM rack (~> 2.2, >= 2.2.4) rack-proxy (0.7.7) rack + rack-session (1.0.2) + rack (< 3) rack-test (2.2.0) rack (>= 1.3) - 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) + rackup (1.0.1) + rack (< 3) + webrick + rails (7.2.3) + actioncable (= 7.2.3) + actionmailbox (= 7.2.3) + actionmailer (= 7.2.3) + actionpack (= 7.2.3) + actiontext (= 7.2.3) + actionview (= 7.2.3) + activejob (= 7.2.3) + activemodel (= 7.2.3) + activerecord (= 7.2.3) + activestorage (= 7.2.3) + activesupport (= 7.2.3) bundler (>= 1.15.0) - railties (= 7.0.8.7) + railties (= 7.2.3) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) actionview (>= 5.0.1.rc1) @@ -600,49 +679,60 @@ GEM rails-i18n (7.0.10) i18n (>= 0.7, < 2) railties (>= 6.0.0, < 8) - railties (7.0.8.7) - actionpack (= 7.0.8.7) - activesupport (= 7.0.8.7) - method_source + railties (7.2.3) + actionpack (= 7.2.3) + activesupport (= 7.2.3) + cgi + irb (~> 1.13) + rackup (>= 1.0.0) rake (>= 12.2) - thor (~> 1.0) - zeitwerk (~> 2.5) + thor (~> 1.0, >= 1.2.2) + tsort (>= 0.2) + zeitwerk (~> 2.6) rainbow (3.1.1) rake (13.2.1) - ransack (3.2.1) + ransack (4.2.1) activerecord (>= 6.1.5) activesupport (>= 6.1.5) i18n rb-fsevent (0.11.2) rb-inotify (0.11.1) ffi (~> 1.0) - redcarpet (3.6.0) + rdoc (7.1.0) + erb + psych (>= 4.0.0) + tsort + redcarpet (3.6.1) redis (4.8.1) regexp_parser (2.10.0) - reline (0.6.0) + reline (0.6.3) io-console (~> 0.5) - request_store (1.5.1) + request_store (1.7.0) rack (>= 1.4) responders (3.1.1) actionpack (>= 5.2) railties (>= 5.2) rexml (3.4.0) - rspec (3.13.0) + rqrcode (2.2.0) + chunky_png (~> 1.0) + rqrcode_core (~> 1.0) + rqrcode_core (1.2.0) + rspec (3.13.2) rspec-core (~> 3.13.0) rspec-expectations (~> 3.13.0) rspec-mocks (~> 3.13.0) rspec-cells (0.3.10) cells (>= 4.0.0, < 6.0.0) rspec-rails (>= 3.0.0) - rspec-core (3.13.2) + rspec-core (3.13.6) rspec-support (~> 3.13.0) - rspec-expectations (3.13.3) + rspec-expectations (3.13.5) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) rspec-html-matchers (0.10.0) nokogiri (~> 1) rspec (>= 3.0.0.a) - rspec-mocks (3.13.2) + rspec-mocks (3.13.7) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) rspec-rails (6.1.5) @@ -655,44 +745,56 @@ GEM rspec-support (~> 3.13) rspec-retry (0.6.2) rspec-core (> 3.3) - rspec-support (3.13.2) + rspec-support (3.13.7) rspec_junit_formatter (0.6.0) rspec-core (>= 2, < 4, != 2.12.0) - rubocop (1.65.1) + rubocop (1.78.0) json (~> 2.3) - language_server-protocol (>= 3.17.0) + language_server-protocol (~> 3.17.0.2) + lint_roller (~> 1.1.0) parallel (~> 1.10) parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 2.4, < 3.0) - rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.31.1, < 2.0) + regexp_parser (>= 2.9.3, < 3.0) + rubocop-ast (>= 1.45.1, < 2.0) ruby-progressbar (~> 1.7) - 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) + unicode-display_width (>= 2.4.0, < 4.0) + rubocop-ast (1.49.0) + parser (>= 3.3.7.2) + prism (~> 1.7) + rubocop-capybara (2.22.1) + lint_roller (~> 1.1) + rubocop (~> 1.72, >= 1.72.1) + rubocop-factory_bot (2.27.1) + lint_roller (~> 1.1) + rubocop (~> 1.72, >= 1.72.1) + rubocop-faker (1.3.0) faker (>= 2.12.0) - 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) + lint_roller (~> 1.1) + rubocop (>= 1.72.1) + rubocop-graphql (1.5.6) + lint_roller (~> 1.1) + rubocop (>= 1.72.1, < 2) + rubocop-performance (1.26.1) + lint_roller (~> 1.1) + rubocop (>= 1.75.0, < 2.0) + rubocop-ast (>= 1.47.1, < 2.0) + rubocop-rails (2.32.0) activesupport (>= 4.2.0) + lint_roller (~> 1.1) rack (>= 1.1) - 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) + rubocop (>= 1.75.0, < 2.0) + rubocop-ast (>= 1.44.0, < 2.0) + rubocop-rspec (3.7.0) + lint_roller (~> 1.1) + rubocop (~> 1.72, >= 1.72.1) + rubocop-rspec_rails (2.31.0) + lint_roller (~> 1.1) + rubocop (~> 1.72, >= 1.72.1) + rubocop-rspec (~> 3.5) + rubocop-rubycw (0.2.2) + lint_roller (~> 1.1) + rubocop (~> 1.72, >= 1.72.1) ruby-progressbar (1.13.0) ruby-vips (2.2.2) ffi (~> 1.12) @@ -701,15 +803,23 @@ GEM nokogiri (>= 1.10.8) rubyzip (>= 1.3.0) rubyzip (2.3.2) - selenium-webdriver (4.27.0) + sass-embedded (1.97.3-arm64-darwin) + google-protobuf (~> 4.31) + sass-embedded (1.97.3-x86_64-darwin) + google-protobuf (~> 4.31) + sass-embedded (1.97.3-x86_64-linux-gnu) + google-protobuf (~> 4.31) + securerandom (0.4.1) + selenium-webdriver (4.40.0) base64 (~> 0.2) logger (~> 1.4) rexml (~> 3.2, >= 3.2.5) - rubyzip (>= 1.2.2, < 3.0) + rubyzip (>= 1.2.2, < 4.0) websocket (~> 1.0) semantic_range (3.1.0) - shakapacker (7.1.0) + shakapacker (8.3.0) activesupport (>= 5.2) + package_json rack-proxy (>= 0.6.1) railties (>= 5.2) semantic_range (>= 2.3.0) @@ -720,7 +830,7 @@ GEM simplecov-cobertura (2.1.0) rexml simplecov (~> 0.19) - simplecov-html (0.13.1) + simplecov-html (0.13.2) simplecov_json_formatter (0.1.4) smart_properties (1.17.0) snaky_hash (2.0.1) @@ -731,21 +841,24 @@ GEM listen (>= 2.7, < 4.0) spring (>= 4) stringio (3.1.2) + strscan (3.1.7) temple (0.10.3) - terminal-table (3.0.2) - unicode-display_width (>= 1.1.1, < 3) + terminal-table (4.0.0) + unicode-display_width (>= 1.1.1, < 4) thor (1.3.2) tilt (2.5.0) timeout (0.4.3) trailblazer-option (0.1.2) + tsort (0.2.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) uber (0.1.0) unicode-display_width (2.6.0) - uniform_notifier (1.16.0) + uniform_notifier (1.18.0) uri (1.0.2) - valid_email2 (4.0.6) - activemodel (>= 3.2) + useragent (0.16.11) + valid_email2 (7.0.13) + activemodel (>= 6.0) mail (~> 2.5) version_gem (1.1.4) w3c_rspec_validators (0.3.0) @@ -758,6 +871,11 @@ GEM rexml (~> 3.2) warden (1.2.9) rack (>= 2.0.9) + warden-jwt_auth (0.12.0) + dry-auto_inject (>= 0.8, < 2) + dry-configurable (>= 0.13, < 2) + jwt (>= 2.1, < 4) + warden (~> 1.2) web-console (4.2.1) actionview (>= 6.0.0) activemodel (>= 6.0.0) @@ -766,26 +884,24 @@ GEM web-push (3.0.1) jwt (~> 2.0) openssl (~> 3.0) - webmock (3.24.0) + webmock (3.26.1) addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) + webrick (1.9.2) websocket (1.2.11) websocket-driver (0.7.7) base64 websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) - wicked_pdf (2.8.2) - activesupport - ostruct - wisper (2.0.1) + wisper (3.0.0) wisper-rspec (1.1.0) - wkhtmltopdf-binary (0.12.6.6) xpath (3.2.0) nokogiri (~> 1.8) zeitwerk (2.7.1) PLATFORMS + arm64-darwin-23 x86_64-darwin x86_64-linux @@ -794,9 +910,10 @@ DEPENDENCIES brakeman (~> 6.1) byebug (~> 11.0) climate_control (~> 1.2) - decidim (~> 0.29.0) - decidim-dev (~> 0.29.0) + decidim (~> 0.31.0) + decidim-dev (~> 0.31.0) decidim-emitter! + faker letter_opener_web (~> 2.0) listen (~> 3.1) parallel_tests (~> 4.2) @@ -807,7 +924,7 @@ DEPENDENCIES web-console (~> 4.2) RUBY VERSION - ruby 3.2.2p53 + ruby 3.3.4p94 BUNDLED WITH 2.5.22 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 f0481be..5c390df 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 @@ -12,11 +12,11 @@ module CreateParticipatoryProcessOverride 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, + fetch_form_attributes :organization, :title, :subtitle, :weight, :slug, :description, + :short_description, :promoted, :taxonomizations, :announcement, + :private_space, :developer_group, :local_area, :target, :participatory_scope, :participatory_structure, :meta_scope, :start_date, :end_date, - :participatory_process_group, :participatory_process_type, :emitter_name + :participatory_process_group, :emitter_name end 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/duplicate_participatory_process_override.rb similarity index 68% rename from app/commands/concerns/decidim/emitter/participatory_processes/admin/copy_participatory_process_override.rb rename to app/commands/concerns/decidim/emitter/participatory_processes/admin/duplicate_participatory_process_override.rb index 62000db..f2067ad 100644 --- a/app/commands/concerns/decidim/emitter/participatory_processes/admin/copy_participatory_process_override.rb +++ b/app/commands/concerns/decidim/emitter/participatory_processes/admin/duplicate_participatory_process_override.rb @@ -4,24 +4,21 @@ module Decidim module Emitter module ParticipatoryProcesses module Admin - module CopyParticipatoryProcessOverride + module DuplicateParticipatoryProcessOverride extend ActiveSupport::Concern included do - def copy_participatory_process - @copied_process = ParticipatoryProcess.create!( + def duplicate_participatory_process + @duplicated_process = ParticipatoryProcess.create!( organization: @participatory_process.organization, title: form.title, subtitle: @participatory_process.subtitle, slug: form.slug, - hashtag: @participatory_process.hashtag, description: @participatory_process.description, short_description: @participatory_process.short_description, promoted: @participatory_process.promoted, - scope: @participatory_process.scope, developer_group: @participatory_process.developer_group, local_area: @participatory_process.local_area, - area: @participatory_process.area, target: @participatory_process.target, participatory_scope: @participatory_process.participatory_scope, participatory_structure: @participatory_process.participatory_structure, @@ -30,16 +27,19 @@ def copy_participatory_process end_date: @participatory_process.end_date, participatory_process_group: @participatory_process.participatory_process_group, private_space: @participatory_process.private_space, + taxonomies: @participatory_process.taxonomies, emitter_name: @participatory_process.emitter_name ) end - def copy_participatory_process_attachments - [:hero_image, :emitter].each do |attribute| - next unless @participatory_process.attached_uploader(attribute).attached? + def duplicate_participatory_process_attachments + return unless @participatory_process.attached_uploader(:hero_image).attached? - @copied_process.send(attribute).attach(@participatory_process.send(attribute).blob) - end + @duplicated_process.send(:hero_image).attach(@participatory_process.send(:hero_image).blob) + + return unless @participatory_process.attached_uploader(:emitter).attached? + + @duplicated_process.emitter.attach(@participatory_process.emitter.blob) 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 16723f4..c0c1450 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 @@ -10,11 +10,11 @@ module UpdateParticipatoryProcessOverride included do 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 + fetch_form_attributes :title, :subtitle, :weight, :slug, :promoted, + :taxonomizations, :private_space, :developer_group, :local_area, + :target, :participatory_scope, :participatory_structure, + :meta_scope, :start_date, :end_date, :participatory_process_group, + :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 40bf129..c718d1b 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 @@ -44,10 +44,11 @@ def emitter_image=(value) def emitter_select=(value) if value.present? - target_pp = Decidim::ParticipatoryProcess.find(value) - blob = target_pp.emitter.attachment.blob - @emitter_select = blob - @emitter_name_select = target_pp.emitter_name + target_pp = Decidim::ParticipatoryProcess.find_by(id: value) + if target_pp&.emitter&.attached? + @emitter_select = target_pp.emitter.attachment.blob + @emitter_name_select = target_pp.emitter_name + end end prepare_emitter! prepare_emitter_name! diff --git a/app/views/decidim/participatory_processes/admin/participatory_process_imports/_form.html.erb b/app/views/decidim/participatory_processes/admin/participatory_process_imports/_form.html.erb new file mode 100644 index 0000000..6185497 --- /dev/null +++ b/app/views/decidim/participatory_processes/admin/participatory_process_imports/_form.html.erb @@ -0,0 +1,41 @@ +
+
+
+
+ <%= cell("decidim/announcement", { body: t("decidim.participatory_processes.admin.new_import.help_html") }, callout_class: "info") %> +
+ +
+ <%= form.translated :text_field, :title, autofocus: true, aria: { label: :title } %> +
+ +
+ <%= form.text_field :slug, help_text: t(".slug_help_html", url: decidim_form_slug_url(:processes, form.object.slug)) %> +
+ +
+ <%= form.upload :document, label: t(".document_legend"), button_class: "button button__sm button__transparent-secondary", help_i18n_scope: "decidim.forms.file_help.import", help_i18n_messages: ["message_1"] %> +
+ +
+
+ <%= t("participatory_process_imports.new.select", scope: "decidim.admin") %> +
+
+
+
+
+ <%= form.check_box :import_steps %> +
+
+ <%= form.check_box :import_attachments %> +
+
+ <%= form.check_box :import_components %> +
+
+
+ +
+
+
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 b2518a0..116a315 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,5 +1,5 @@
-
+
-
+
<%= form.text_field :slug, help_text: t(".slug_help_html", url: decidim_form_slug_url(:processes, form.object.slug)) %>
- -
- <%= form.text_field :hashtag %> -
- <%= form.translated :editor, :short_description, aria: { label: :short_description } %> + <%= form.translated :editor, :short_description, resource_mentionable: true, aria: { label: :short_description } %>
- <%= form.translated :editor, :description, aria: { label: :description } %> + <%= form.translated :editor, :description, resource_mentionable: true, aria: { label: :description } %>
@@ -45,7 +41,7 @@
-
+
-
+
-
+
-
-
- <%= form.translated :text_field, :developer_group, aria: { label: :developer_group } %> -
+
+ <%= form.translated :text_field, :developer_group, aria: { label: :developer_group } %> +
-
- <%= form.translated :text_field, :local_area, aria: { label: :local_area } %> -
+
+ <%= form.translated :text_field, :local_area, aria: { label: :local_area } %>
@@ -128,43 +122,34 @@
-
+
-
-
-
- <%= form.check_box :scopes_enabled %> -
- -
- <%= 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 %> -
- -
- <%= form.areas_select :area_id, - areas_for_select(current_organization), - selected: current_participatory_process.try(:decidim_area_id), - include_blank: t(".select_an_area") %> -
+
+ <% if @form.taxonomy_filters.blank? %> +
+

+ <%= t("no_taxonomy_filters_found", scope: "decidim.participatory_processes.admin.participatory_processes.form") %> + <%= link_to(t("define_taxonomy_filters", scope: "decidim.participatory_processes.admin.participatory_processes.form"), decidim_admin.taxonomies_path, class: "button button__text-secondary") %> +

+
+ <% else %> + <% @form.taxonomy_filters.each do |filter| %> +
+ <%= filter_taxonomy_items_select_field form, :taxonomies, filter %> +
+ <% end %> + <% end %>
-
+
-
+
- - -
-
- -
- -
- <% 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" %> diff --git a/config/locales/en.yml b/config/locales/en.yml index e0bcaae..37cf4e2 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1,5 +1,10 @@ --- en: + activemodel: + attributes: + participatory_process: + emitter_name: Emitter name + emitter_image: Emitter logo decidim: admin: forms: @@ -8,19 +13,34 @@ en: explanation: 'Guidance for logo:' message_1: Preferrably a logo that will be seen on a white background. message_2: The service reduce the image. + participatory_process_imports: + new: + select: Select which data you would like to duplicate components: emitter: name: Emitter + forms: + file_help: + import: + message_1: Has to be a JSON document downloaded through the export feature. + explanation: 'Guidance for file:' participatory_processes: admin: + new_import: + help_html: This import feature allows you to create a new participatory process from an exported JSON file. You can export a process from another organization or from this same organization. The imported process will include its settings, components, and attachments (if selected). participatory_processes: form: emitter: Emitter emitter_logo: Emitter logo emitter_logo_select: Select an emitter emitter_name: Emitter name + emitter_image: Emitter logo emitter_new: New emitter emitter_now: Emitter now + participatory_process_imports: + form: + document_legend: Add a document + slug_help_html: 'URL slugs are used to generate the URLs that point to this process. Only accepts letters, numbers and dashes, and must start with a letter. Example: %{url}' 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 993be55..3a3c65a 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -1,5 +1,10 @@ --- fr: + activemodel: + attributes: + participatory_process: + emitter_name: Nom de l’émetteur + emitter_image: Logo de l’émetteur decidim: admin: forms: @@ -8,11 +13,21 @@ fr: explanation: 'Consignes pour le logo :' message_1: De préférence un logo qui sera visible sur un fond blanc. message_2: Le service réduit l'image. + participatory_process_imports: + new: + select: Sélectionnez les données que vous souhaitez dupliquer components: emitter: name: Émetteur + forms: + file_help: + import: + message_1: Les fichiers CSV, JSON et Excel (.xlsx) sont supportés + explanation: 'Instructions concernant le fichier:' participatory_processes: admin: + new_import: + help_html: Cette fonctionnalité d’importation vous permet de créer un nouveau processus participatif à partir d’un fichier JSON exporté. Vous pouvez exporter un processus depuis une autre organisation ou depuis cette même organisation. Le processus importé inclura ses paramètres, ses composants et ses pièces jointes (si sélectionnés). participatory_processes: form: emitter: Organisateur @@ -21,6 +36,10 @@ fr: emitter_name: Nom du nouveau logo emitter_new: Ou choisissez un nouveau logo pour l’organisateur de la concertation emitter_now: Émetteur actuel + participatory_process_imports: + form: + document_legend: Ajouter un document + slug_help_html: 'Les identifiants d''URL sont utilisés pour générer les URL qui pointent vers cette concertation. N''accepte que des lettres, des chiffres et des tirets et doit commencer par une lettre. Exemple: %{url}' emitter: emitter_text: Publié par %{developer_group} emitter_img_alt_test: Logo de %{developer_group} diff --git a/lib/decidim/emitter/engine.rb b/lib/decidim/emitter/engine.rb index 480c038..cec7523 100644 --- a/lib/decidim/emitter/engine.rb +++ b/lib/decidim/emitter/engine.rb @@ -39,7 +39,7 @@ class Engine < ::Rails::Engine Decidim::ParticipatoryProcesses::Admin::CreateParticipatoryProcess.include(Decidim::Emitter::ParticipatoryProcesses::Admin::CreateParticipatoryProcessOverride) end unless Decidim::Emitter.skip_extend?(:participatory_process_copy) - Decidim::ParticipatoryProcesses::Admin::CopyParticipatoryProcess.include(Decidim::Emitter::ParticipatoryProcesses::Admin::CopyParticipatoryProcessOverride) + Decidim::ParticipatoryProcesses::Admin::DuplicateParticipatoryProcess.include(Decidim::Emitter::ParticipatoryProcesses::Admin::DuplicateParticipatoryProcessOverride) end unless Decidim::Emitter.skip_extend?(:participatory_process_update) Decidim::ParticipatoryProcesses::Admin::UpdateParticipatoryProcess.include(Decidim::Emitter::ParticipatoryProcesses::Admin::UpdateParticipatoryProcessOverride) diff --git a/lib/decidim/emitter/test/factories.rb b/lib/decidim/emitter/test/factories.rb index 0686693..3d904ef 100644 --- a/lib/decidim/emitter/test/factories.rb +++ b/lib/decidim/emitter/test/factories.rb @@ -30,8 +30,6 @@ participatory_scope { generate_localized_title } participatory_structure { generate_localized_title } announcement { generate_localized_title } - show_metrics { true } - show_statistics { true } private_space { false } start_date { Date.current } end_date { 2.months.from_now } diff --git a/lib/decidim/emitter/version.rb b/lib/decidim/emitter/version.rb index 442864c..dcbbe34 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 = "1.0.0" - DECIDIM_VERSION = "~> 0.29.0" + VERSION = "2.0.0" + DECIDIM_VERSION = "~> 0.31.0" end end diff --git a/spec/commands/create_participatory_process_spec.rb b/spec/commands/create_participatory_process_spec.rb index 0177912..f597d92 100644 --- a/spec/commands/create_participatory_process_spec.rb +++ b/spec/commands/create_participatory_process_spec.rb @@ -8,14 +8,15 @@ module Decidim::ParticipatoryProcesses 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(:taxonomizations) do + 2.times.map { build(:taxonomization, taxonomy: create(:taxonomy, :with_parent, organization:), taxonomizable: nil) } + end + let(:emitter) { upload_test_file(Decidim::Dev.test_file("city.jpeg", "image/jpeg")) } let(:emitter_name) { "Berlin" } let(:form) do @@ -26,7 +27,6 @@ module Decidim::ParticipatoryProcesses subtitle: { en: "subtitle" }, weight:, slug: "slug", - hashtag: "hashtag", meta_scope: { en: "meta scope" }, hero_image:, promoted: nil, @@ -42,20 +42,17 @@ module Decidim::ParticipatoryProcesses current_user:, current_organization: organization, organization:, - scopes_enabled: true, private_space: false, - scope:, - scope_type_max_depth: nil, - area:, + taxonomizations:, errors:, related_process_ids:, participatory_process_group:, - participatory_process_type:, announcement: { en: "message" }, emitter:, emitter_name: ) end + let(:invalid) { false } context "when the form is not valid" do @@ -103,8 +100,7 @@ module Decidim::ParticipatoryProcesses .and_call_original expect { subject.call }.to change(Decidim::ActionLog, :count) - action_log = Decidim::ActionLog.last - expect(action_log.version).to be_present + expect(Decidim::ActionLog.last.version).to be_present end it "broadcasts ok" do @@ -122,6 +118,20 @@ module Decidim::ParticipatoryProcesses expect(current_user.follows?(process)).to be true end + it "links to taxonomizations" do + subject.call + expect(process.taxonomizations).to match_array(taxonomizations) + end + + context "when no taxonomizations are set" do + let(:taxonomizations) { [] } + + it "taxonomizations are empty" do + subject.call + expect(process.taxonomizations).to be_empty + end + end + context "with related processes" do let!(:another_process) { create(:participatory_process, organization:) } let(:related_process_ids) { [another_process.id] } diff --git a/spec/commands/copy_participatory_process_spec.rb b/spec/commands/duplicate_participatory_process_spec.rb similarity index 69% rename from spec/commands/copy_participatory_process_spec.rb rename to spec/commands/duplicate_participatory_process_spec.rb index 0187e7e..e1abbc6 100644 --- a/spec/commands/copy_participatory_process_spec.rb +++ b/spec/commands/duplicate_participatory_process_spec.rb @@ -3,39 +3,34 @@ require "spec_helper" module Decidim::ParticipatoryProcesses - describe Admin::CopyParticipatoryProcess do + describe Admin::DuplicateParticipatoryProcess do subject { described_class.new(form, participatory_process) } 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(:participatory_process_group) { create(:participatory_process_group, organization:, taxonomies: [taxonomy]) } + let(:taxonomy) { create(:taxonomy, with_parent, organization:) } let(:errors) { double.as_null_object } let!(:participatory_process) { create(:participatory_process, :with_steps) } + let!(:content_block) { create(:content_block, manifest_name: :hero, organization: participatory_process.organization, scope_name: :participatory_process_homepage, scoped_resource_id: participatory_process.id) } let!(:component) { create(:component, manifest_name: :dummy, participatory_space: participatory_process) } let(:form) do instance_double( - Admin::ParticipatoryProcessCopyForm, + Admin::ParticipatoryProcessDuplicateForm, invalid?: invalid, title: { en: "title" }, slug: "copied-slug", - copy_steps?: copy_steps, - copy_categories?: copy_categories, - copy_components?: copy_components, + duplicate_steps?: duplicate_steps, + duplicate_components?: duplicate_components, + duplicate_landing_page_blocks?: duplicate_landing_page_blocks, current_user: ) end - let!(:category) do - create( - :category, - participatory_space: participatory_process - ) - end let(:invalid) { false } - let(:copy_steps) { false } - let(:copy_categories) { false } - let(:copy_components) { false } + let(:duplicate_steps) { false } + let(:duplicate_components) { false } + let(:duplicate_landing_page_blocks) { false } context "when the form is not valid" do let(:invalid) { true } @@ -60,7 +55,6 @@ module Decidim::ParticipatoryProcesses expect(new_participatory_process.description).to eq(old_participatory_process.description) expect(new_participatory_process.short_description).to eq(old_participatory_process.short_description) expect(new_participatory_process.promoted).to eq(old_participatory_process.promoted) - expect(new_participatory_process.scope).to eq(old_participatory_process.scope) expect(new_participatory_process.developer_group).to eq(old_participatory_process.developer_group) expect(new_participatory_process.local_area).to eq(old_participatory_process.local_area) expect(new_participatory_process.target).to eq(old_participatory_process.target) @@ -70,6 +64,7 @@ module Decidim::ParticipatoryProcesses expect(new_participatory_process.participatory_process_group).to eq(old_participatory_process.participatory_process_group) expect(new_participatory_process.private_space).to eq(old_participatory_process.private_space) expect(new_participatory_process.emitter_name).to eq(old_participatory_process.emitter_name) + expect(new_participatory_process.taxonomies).to eq(old_participatory_process.taxonomies) end it "broadcasts ok" do @@ -89,8 +84,8 @@ module Decidim::ParticipatoryProcesses end end - context "when copy_steps exists" do - let(:copy_steps) { true } + context "when duplicate_steps exists" do + let(:duplicate_steps) { true } it "duplicates a participatory process and the steps" do expect { subject.call }.to change(Decidim::ParticipatoryProcessStep, :count).by(1) @@ -106,40 +101,12 @@ module Decidim::ParticipatoryProcesses end end - context "when copy_categories exists" do - let(:copy_categories) { true } - - it "duplicates a participatory process and the categories" do - expect { subject.call }.to change(Decidim::Category, :count).by(1) - expect(Decidim::Category.unscoped.distinct.pluck(:decidim_participatory_space_id).count).to eq 2 - - old_participatory_process_category = Decidim::Category.unscoped.first - new_participatory_process_category = Decidim::Category.unscoped.last - - expect(new_participatory_process_category.name).to eq(old_participatory_process_category.name) - expect(new_participatory_process_category.description).to eq(old_participatory_process_category.description) - expect(new_participatory_process_category.participatory_space).not_to eq(participatory_process) - end - - context "with subcategories" do - let!(:subcategory) { create(:category, parent: category, participatory_space: participatory_process) } - - it "duplicates the parent and its children" do - expect { subject.call }.to change(Decidim::Category, :count).by(2) - new_participatory_process = Decidim::ParticipatoryProcess.last - - expect(participatory_process.categories.count).to eq(2) - expect(new_participatory_process.categories.count).to eq(2) - end - end - end - - context "when copy_components exists" do - let(:copy_components) { true } + context "when duplicate_components exists" do + let(:duplicate_components) { true } it "duplicates a participatory process and the components" do dummy_hook = proc {} - component.manifest.on :copy, &dummy_hook + component.manifest.on :duplicate, &dummy_hook expect(dummy_hook).to receive(:call).with({ new_component: an_instance_of(Decidim::Component), old_component: component }) expect { subject.call }.to change(Decidim::Component, :count).by(1) @@ -155,5 +122,39 @@ module Decidim::ParticipatoryProcesses expect(last_component.step_settings.values).not_to eq(component.step_settings.values) end end + + context "when duplicate_landing_page_blocks exists" do + let(:duplicate_landing_page_blocks) { true } + let(:original_image) do + Rack::Test::UploadedFile.new( + Decidim::Dev.test_file("city.jpeg", "image/jpeg"), + "image/jpeg" + ) + end + + before do + content_block.images_container.background_image.purge + content_block.images_container.background_image = original_image + content_block.save + content_block.reload + end + + it "duplicates a participatory_process and the content_block with its attachments" do + expect { subject.call }.to change(Decidim::ContentBlock, :count).by(1) + + old_block = Decidim::ContentBlock.unscoped.first + new_block = Decidim::ContentBlock.unscoped.last + last_process = Decidim::ParticipatoryProcess.last + + expect(new_block.scope_name).to eq(old_block.scope_name) + expect(new_block.manifest_name).to eq(old_block.manifest_name) + # published_at is set in content_block factory + expect(new_block.published_at).not_to be_nil + expect(new_block.scoped_resource_id).to eq(last_process.id) + expect(new_block.attachments.length).to eq(1) + expect(new_block.attachments.first.name).to eq("background_image") + expect(new_block.images_container.attached_uploader(:background_image).url).not_to be_nil + end + end end end diff --git a/spec/commands/update_participatory_process_spec.rb b/spec/commands/update_participatory_process_spec.rb index 776c2e3..569312b 100644 --- a/spec/commands/update_participatory_process_spec.rb +++ b/spec/commands/update_participatory_process_spec.rb @@ -5,7 +5,11 @@ module Decidim::ParticipatoryProcesses describe Admin::UpdateParticipatoryProcess do describe "call" do - let(:my_process) { create :participatory_process } + let(:organization) { create(:organization) } + let(:my_process) { create(:participatory_process, organization:, taxonomies:) } + let(:taxonomies) { create_list(:taxonomy, 2, :with_parent, organization:) } + let(:taxonomy) { create(:taxonomy, :with_parent, organization:) } + let(:user) { create(:user, :admin, :confirmed, organization:) } let(:params) do { participatory_process: { @@ -18,7 +22,6 @@ module Decidim::ParticipatoryProcesses subtitle_es: my_process.subtitle, weight: my_process.weight, slug: my_process.slug, - hashtag: my_process.hashtag, meta_scope: my_process.meta_scope, promoted: my_process.promoted, description_en: my_process.description, @@ -27,13 +30,11 @@ module Decidim::ParticipatoryProcesses short_description_en: my_process.short_description, short_description_ca: my_process.short_description, short_description_es: my_process.short_description, - current_organization: my_process.organization, - scopes_enabled: my_process.scopes_enabled, - scope: my_process.scope, - area: my_process.area, + current_organization: organization, errors: my_process.errors, participatory_process_group: my_process.participatory_process_group, private_space: my_process.private_space, + taxonomies: [taxonomy.id, taxonomies.first.id], emitter_name: my_process.emitter_name }.merge(attachment_params) } @@ -44,7 +45,6 @@ module Decidim::ParticipatoryProcesses emitter: my_process.hero_image.blob } end - let(:user) { create :user, :admin, :confirmed, organization: my_process.organization } let(:context) do { current_organization: my_process.organization, @@ -97,6 +97,12 @@ module Decidim::ParticipatoryProcesses expect { command.call }.to broadcast(:ok) end + it "updates the taxonomizations" do + expect(my_process.reload.taxonomies).to match_array(taxonomies) + command.call + expect(my_process.reload.taxonomies).to contain_exactly(taxonomy, taxonomies.first) + end + it "updates the participatory process" do expect { command.call }.to broadcast(:ok) my_process.reload @@ -117,7 +123,7 @@ module Decidim::ParticipatoryProcesses end context "with related processes" do - let!(:another_process) { create :participatory_process, organization: my_process.organization } + let!(:another_process) { create(:participatory_process, organization:) } it "links related processes" do allow(form).to receive(:related_process_ids).and_return([another_process.id]) diff --git a/spec/forms/participatory_process_form_spec.rb b/spec/forms/participatory_process_form_spec.rb index 22c5627..db76b5c 100644 --- a/spec/forms/participatory_process_form_spec.rb +++ b/spec/forms/participatory_process_form_spec.rb @@ -8,7 +8,13 @@ module Admin describe ParticipatoryProcessForm do subject { described_class.from_params(attributes).with_context(current_organization: organization) } - let(:organization) { create :organization } + let(:organization) { create(:organization) } + let(:root_taxonomy) { create(:taxonomy, organization:) } + let!(:taxonomies) { create_list(:taxonomy, 3, parent: root_taxonomy, organization:) } + let!(:process_taxonomy_filter_one) { create(:taxonomy_filter, participatory_space_manifests: ["participatory_processes"], root_taxonomy:) } + let!(:process_taxonomy_filter_two) { create(:taxonomy_filter, participatory_space_manifests: ["participatory_processes"], root_taxonomy:) } + let!(:assembly_taxonomy_filter) { create(:taxonomy_filter, participatory_space_manifests: ["assemblies"], root_taxonomy:) } + let!(:process_taxonomy_filter_without_root) { create(:taxonomy_filter, participatory_space_manifests: ["participatory_processes"]) } let(:title) do { en: "Title", @@ -38,6 +44,8 @@ module Admin ca: "Descripció curta" } end + let(:start_date) { 1.month.ago } + let(:end_date) { 1.month.from_now } let(:slug) { "slug" } let(:attachment) { upload_test_file(Decidim::Dev.test_file("city.jpeg", "image/jpeg")) } let(:emitter_name) { "city" } @@ -57,10 +65,13 @@ module Admin "short_description_en" => short_description[:en], "short_description_es" => short_description[:es], "short_description_ca" => short_description[:ca], + "start_date" => start_date, + "end_date" => end_date, "hero_image" => attachment, "slug" => slug, "emitter" => attachment, - "emitter_name" => emitter_name + "emitter_name" => emitter_name, + "taxonomies" => [taxonomies.first.id, taxonomies.second.id] } } end @@ -69,6 +80,18 @@ module Admin it { is_expected.to be_valid } end + it "returns taxonomizations and taxonomies" do + expect(subject.taxonomizations.map(&:taxonomy_id)).to eq([taxonomies.first.id, taxonomies.second.id]) + expect(subject.root_taxonomies).to eq([root_taxonomy]) + expect(subject.taxonomy_filters).to contain_exactly(process_taxonomy_filter_one, process_taxonomy_filter_two) + end + + context "when taxonomies belong to another organization" do + let!(:taxonomies) { create_list(:taxonomy, 3) } + + it { is_expected.not_to be_valid } + end + context "when hero_image is too big" do before do organization.settings.tap do |settings| @@ -160,6 +183,71 @@ module Admin end end end + + context "when the start_date is later than end_date" do + let(:start_date) { 1.month.from_now } + let(:end_date) { 2.months.ago } + + it { is_expected.to be_invalid } + + it "has an error" do + subject.valid? + + expect(subject.errors).not_to be_empty + expect(subject.errors[:end_date]).not_to be_empty + expect(subject.errors[:start_date]).not_to be_empty + end + end + + context "when start_date is present" do + let(:start_date) { 3.months.ago } + + it { is_expected.to be_valid } + end + + context "when end_date is present" do + let(:end_date) { 2.months.from_now } + + it { is_expected.to be_valid } + end + + context "when start_date is not present" do + let(:start_date) { nil } + + it { is_expected.to be_valid } + end + + context "when end_date is not present" do + let(:end_date) { nil } + + it { is_expected.to be_valid } + end + + context "when selecting an emitter from another process" do + let(:other_process_with_emitter) { create(:participatory_process, organization:) } + let(:other_process_without_emitter) { create(:participatory_process, organization:) } + + before do + other_process_with_emitter.emitter.attach( + io: File.open(Decidim::Dev.test_file("city.jpeg", "image/jpeg")), + filename: "city.jpeg", + content_type: "image/jpeg" + ) + other_process_with_emitter.update!(emitter_name: "Other Emitter") + end + + context "when the target process has no emitter attached" do + before do + attributes["participatory_process"]["emitter_select"] = other_process_without_emitter.id + end + + it { is_expected.to be_valid } + + it "does not raise an error" do + expect { subject.valid? }.not_to raise_error + end + end + end end end end diff --git a/spec/lib/decidim/emitter/version_spec.rb b/spec/lib/decidim/emitter/version_spec.rb index ba28bd0..15a8ab8 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("1.0.0") + expect(Decidim::Emitter::VERSION).to eq("2.0.0") end end end diff --git a/spec/shared/manage_processes_examples.rb b/spec/shared/manage_processes_examples.rb index 98e52bd..88d509c 100644 --- a/spec/shared/manage_processes_examples.rb +++ b/spec/shared/manage_processes_examples.rb @@ -49,7 +49,12 @@ def filter_by_group(group_title) let!(:participatory_process) { create(:participatory_process, :unpublished, organization:) } it "allows the user to preview the unpublished process" do - new_window = window_opened_by { page.find("tr", text: translated(participatory_process.title)).click_on("Preview") } + new_window = window_opened_by do + within("tr", text: translated(participatory_process.title)) do + find("button[data-controller='dropdown']").click + click_on "Preview" + end + end page.within_window(new_window) do expect(page).to have_css(".participatory-space__container") @@ -62,12 +67,13 @@ def filter_by_group(group_title) let!(:participatory_process) { create(:participatory_process, organization:) } it "allows the user to preview the published process" do - within "tr", text: translated(participatory_process.title) do - click_on "Preview" + new_window = window_opened_by do + within("tr", text: translated(participatory_process.title)) do + find("button[data-controller='dropdown']").click + click_on "Preview" + end end - 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)) @@ -134,20 +140,23 @@ def filter_by_group(group_title) let!(:participatory_process) { create(:participatory_process, :unpublished, organization:) } before do - 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 + visit decidim_admin_participatory_processes.participatory_processes_path end it "publishes the process" do - click_on "Publish" + within("tr", text: translated_attribute(participatory_process.title)) do + find("button[data-controller='dropdown']").click + find("a", text: "Publish", visible: true).click + end + 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) + + within("tr", text: translated_attribute(participatory_process.title)) do + find("button[data-controller='dropdown']").click + expect(page).to have_content("Unpublish") + end + + expect(page).to have_current_path decidim_admin_participatory_processes.participatory_processes_path participatory_process.reload expect(participatory_process).to be_published @@ -158,20 +167,18 @@ def filter_by_group(group_title) let!(:participatory_process) { create(:participatory_process, organization:) } before do - 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 + visit decidim_admin_participatory_processes.participatory_processes_path end it "unpublishes the process" do - click_on "Unpublish" + within("tr", text: translated_attribute(participatory_process.title)) do + find("button[data-controller='dropdown']").click + find("a", text: "Unpublish", visible: true).click + end + 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) + expect(page).to have_current_path decidim_admin_participatory_processes.participatory_processes_path participatory_process.reload expect(participatory_process).not_to be_published @@ -191,32 +198,4 @@ def filter_by_group(group_title) end end end - - context "when the process has a scope" do - let(:scope) { create(:scope, organization:) } - - before do - participatory_process.update!(scopes_enabled: true, scope:) - end - - it "disables the scope for a participatory process" do - 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_css("#participatory_process_scope_id[disabled]") - - within ".edit_participatory_process" do - find("*[type=submit]").click - end - - expect(page).to have_admin_callout("successfully") - end - end end diff --git a/spec/shared/process_announcements_examples.rb b/spec/shared/process_announcements_examples.rb new file mode 100644 index 0000000..06c2e26 --- /dev/null +++ b/spec/shared/process_announcements_examples.rb @@ -0,0 +1,77 @@ +# frozen_string_literal: true + +shared_examples "manage processes announcements" do + let!(:participatory_process) { create(:participatory_process, :with_content_blocks, organization:, blocks_manifests: [:announcement], announcement: {}) } + + it "can customize a general announcement for the process" do + 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 + + fill_in_i18n_editor( + :participatory_process_announcement, + "#participatory_process-announcement-tabs", + en: "An important announcement", + es: "Un aviso muy importante", + ca: "Un avís molt important" + ) + + within ".edit_participatory_process" do + find("*[type=submit]").click + end + + expect(page).to have_admin_callout("successfully") + + visit decidim_admin_participatory_processes.participatory_processes_path + + new_window = window_opened_by do + within("tr", text: translated(participatory_process.title)) do + find("button[data-controller='dropdown']").click + click_on "Preview" + end + end + + page.within_window(new_window) do + expect(page).to have_content("An important announcement") + end + end + + it "remove announcement element if announcement body is empty" do + 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 + + find_by_id("participatory_process-announcement-tabs").click + send_keys("T") + send_keys(:backspace) + + within ".edit_participatory_process" do + find("*[type=submit]").click + end + + expect(page).to have_admin_callout("successfully") + + visit decidim_admin_participatory_processes.participatory_processes_path + + new_window = window_opened_by do + within("tr", text: translated(participatory_process.title)) do + find("button[data-controller='dropdown']").click + click_on "Preview" + end + end + + page.within_window(new_window) do + expect(page).to have_no_css(".flash") + expect(page).to have_no_css(".flash__message") + expect(page).to have_no_css(".announcement") + end + end +end diff --git a/spec/system/admin/admin_import_participatory_process_spec.rb b/spec/system/admin/admin_import_participatory_process_spec.rb index e8d125c..f173f38 100644 --- a/spec/system/admin/admin_import_participatory_process_spec.rb +++ b/spec/system/admin/admin_import_participatory_process_spec.rb @@ -2,7 +2,7 @@ require "spec_helper" -describe "Admin imports participatory process" do # rubocop:disable RSpec/DescribeClass +describe "Admin imports participatory process", type: :system do include_context "when admin administrating a participatory process" before do @@ -11,6 +11,18 @@ visit decidim_admin_participatory_processes.participatory_processes_path end + context "when viewing the import page" do + before do + within_admin_menu do + click_on "Import" + end + end + + it "displays the import help text" do + expect(page).to have_content("This import feature allows you to create a new participatory process from an exported JSON file") + end + end + context "with context" do before "Imports the process with the basic fields" do within_admin_menu do @@ -52,15 +64,6 @@ expect(page).to have_content(translated("Magni.")) end - 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 - within_admin_sidebar_menu do click_on "Components" end diff --git a/spec/system/admin/admin_manages_participatory_processes_spec.rb b/spec/system/admin/admin_manages_participatory_processes_spec.rb index 9b3a0c3..77ffa64 100644 --- a/spec/system/admin/admin_manages_participatory_processes_spec.rb +++ b/spec/system/admin/admin_manages_participatory_processes_spec.rb @@ -4,7 +4,10 @@ describe "Admin manages participatory processes", :versioning do # rubocop:disable RSpec/DescribeClass include_context "when admin administrating a participatory process" + include_context "with taxonomy filters context" + let(:participatory_space_manifests) { ["participatory_processes"] } + let!(:another_taxonomy_filter) { create(:taxonomy_filter, root_taxonomy: another_root_taxonomy, participatory_space_manifests:) } let!(:participatory_process_groups) do create_list(:participatory_process_group, 3, organization:) end @@ -30,7 +33,7 @@ it "hides the private user menu entry" do within_admin_sidebar_menu do - expect(page).to have_content("Private participants") + expect(page).to have_content("Members") end end end @@ -40,7 +43,7 @@ it "shows the private user menu entry" do within_admin_sidebar_menu do - expect(page).to have_no_content("Private participants") + expect(page).to have_no_content("Members") end end end @@ -56,6 +59,7 @@ let(:image2_filename) { "city2.jpeg" } let(:image2_path) { Decidim::Dev.asset(image2_filename) } let(:attributes) { attributes_for(:participatory_process, organization:) } + let(:last_participatory_process) { Decidim::ParticipatoryProcess.last } before do click_on "New process" @@ -83,8 +87,9 @@ group_title = participatory_process_groups.first.title["en"] select group_title, from: :participatory_process_participatory_process_group_id + select(decidim_sanitize_translated(taxonomy.name), from: "taxonomies-#{taxonomy_filter.id}") + fill_in :participatory_process_slug, with: "slug" - fill_in :participatory_process_hashtag, with: "#hashtag" fill_in :participatory_process_weight, with: 1 end @@ -95,6 +100,7 @@ end expect(page).to have_admin_callout("successfully") + expect(last_participatory_process.taxonomies).to contain_exactly(taxonomy) within "[data-content]" do expect(page).to have_current_path decidim_admin_participatory_processes.participatory_process_steps_path(Decidim::ParticipatoryProcess.last) @@ -123,9 +129,14 @@ click_on "About this process" end + select(decidim_sanitize_translated(taxonomy.name), from: "taxonomies-#{taxonomy_filter.id}") + click_on "Update" expect(page).to have_admin_callout("successfully") + expect(page).to have_select("taxonomies-#{taxonomy_filter.id}", selected: decidim_sanitize_translated(taxonomy.name)) + expect(page).to have_select("taxonomies-#{another_taxonomy_filter.id}", selected: "Please select an option") + expect(participatory_process3.reload.taxonomies).to contain_exactly(taxonomy) hero_blob = participatory_process3.hero_image.blob within %([data-active-uploads] [data-filename="#{hero_blob.filename}"]) do diff --git a/spec/system/participatory_processes_spec.rb b/spec/system/participatory_processes_spec.rb index 32149e0..d1926c4 100644 --- a/spec/system/participatory_processes_spec.rb +++ b/spec/system/participatory_processes_spec.rb @@ -268,7 +268,7 @@ end end - it_behaves_like "followable content for users" do + it_behaves_like "followable space content for users" do let!(:participatory_process) { base_process } let!(:user) { create(:user, :confirmed, organization:) } let(:followable) { participatory_process } @@ -326,7 +326,6 @@ expect(page).to have_content(translated(participatory_process.participatory_structure, locale: :en)) 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 @@ -385,42 +384,6 @@ end end - 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] } - - before do - metrics - visit current_path - end - - it "shows the metrics charts" do - expect(page).to have_css("h2.h2", text: "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 "renders a link to all metrics" do - within "[data-metrics]" do - expect(page).to have_link("Show all") - 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 enabled" do let(:blocks_manifests) { [:hero, :stats] } @@ -440,24 +403,6 @@ expect(page).to have_no_css(".statistic__number", text: "3") end end - - 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 "has no link to all metrics" do - expect(page).to have_no_link("Show all metrics") - end - end - - context "and the process does not have hashtag" do - let(:hashtag) { false } - - it "the hashtags for those components are not visible" do - expect(page).to have_no_content("#") - end - end end context "when assemblies are linked to participatory process" do