diff --git a/.erb_lint.yml b/.erb_lint.yml index 52ddcfd0aa525..00d73da81c5f8 100644 --- a/.erb_lint.yml +++ b/.erb_lint.yml @@ -24,6 +24,14 @@ linters: - text/template - application/ld+json + AdminPageTitleLinter: + enabled: true + exclude: + - decidim-admin/app/views/decidim/admin/shared/landing_page_content_blocks/edit.html.erb + - decidim-admin/app/views/decidim/admin/shared/landing_page/edit.html.erb + - decidim-admin/app/views/decidim/admin/imports/new.html.erb + - decidim-meetings/app/views/decidim/meetings/admin/poll/edit.html.erb + DeprecatedClasses: enabled: true exclude: diff --git a/.erb_linters/admin_page_title_linter.rb b/.erb_linters/admin_page_title_linter.rb new file mode 100644 index 0000000000000..7a201cfe2ff3c --- /dev/null +++ b/.erb_linters/admin_page_title_linter.rb @@ -0,0 +1,3 @@ +# frozen_string_literal: true + +require_relative "../decidim-dev/lib/erb_lint/linters/admin_page_title_linter" diff --git a/.github/actions/spelling/expect.txt b/.github/actions/spelling/expect.txt index 54ba642be5ae0..cc6ad0b8f7327 100644 --- a/.github/actions/spelling/expect.txt +++ b/.github/actions/spelling/expect.txt @@ -19,6 +19,7 @@ activelog activemodel activerecord activestorage +actualitzar actualizado addlabel Adeu @@ -280,6 +281,7 @@ erblint Errbit Esa espa +estar estat etherpad evanfuture @@ -407,6 +409,7 @@ Ijkl ilike illgotten impersonatable +importmap inbox includeurl Indicacions @@ -512,6 +515,7 @@ markercluster marydoe Massot matrixmultiple +mattr matutes maxtimeout mcdoggo @@ -878,6 +882,7 @@ timeouter timestamped tiptap Tmpname +tms TLDR todos Tomorrowland diff --git a/.github/workflows/publiccode-yml-validation.yml b/.github/workflows/publiccode-yml-validation.yml index 96c2ef0c3aa52..50c8b329ccdfe 100644 --- a/.github/workflows/publiccode-yml-validation.yml +++ b/.github/workflows/publiccode-yml-validation.yml @@ -11,3 +11,4 @@ jobs: - uses: italia/publiccode-parser-action@v1 with: publiccode: 'publiccode.yml' + no-network: true diff --git a/.github/workflows/test_app.yml b/.github/workflows/test_app.yml index 572b557bc604d..813b796847a64 100644 --- a/.github/workflows/test_app.yml +++ b/.github/workflows/test_app.yml @@ -141,7 +141,7 @@ jobs: with: name: ${{ inputs.working-directory }} flags: ${{ inputs.working-directory }} - - uses: actions/upload-artifact@v6 + - uses: actions/upload-artifact@v7 if: always() with: name: Screenshots of run ${{ github.run_id }} diff --git a/Gemfile b/Gemfile index 294d62a2351f5..85852c1125bab 100644 --- a/Gemfile +++ b/Gemfile @@ -14,7 +14,7 @@ gem "decidim-elections", path: "." gem "decidim-initiatives", path: "." gem "decidim-templates", path: "." -gem "bootsnap", "~> 1.4" +gem "bootsnap", "~> 1.23" gem "puma", ">= 6.3.1" @@ -23,12 +23,12 @@ group :development, :test do gem "decidim-dev", path: "." - gem "brakeman", "~> 7.0" - gem "parallel_tests", "~> 4.2" + gem "brakeman", "~> 8.0" + gem "parallel_tests", "~> 5.6" end group :development do gem "letter_opener_web", "~> 3.0" - gem "listen", "~> 3.1" - gem "web-console", "~> 4.2" + gem "listen", "~> 3.10" + gem "web-console", "~> 4.3" end diff --git a/Gemfile.lock b/Gemfile.lock index b28081094ae02..24d321f7ef3f8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -26,7 +26,7 @@ PATH decidim-admin (0.32.0.dev) active_link_to (~> 1.0) decidim-core (= 0.32.0.dev) - devise (~> 4.7) + devise (>= 4.7, < 6.0) devise-i18n (~> 1.2) devise_invitable (~> 2.0, >= 2.0.9) decidim-ai (0.32.0.dev) @@ -34,10 +34,10 @@ PATH decidim-core (= 0.32.0.dev) decidim-api (0.32.0.dev) decidim-core (= 0.32.0.dev) - devise-jwt (~> 0.12.1) + devise-jwt (>= 0.12.1, < 0.14.0) graphql (>= 2.4.17, < 2.6) - graphql-docs (~> 5.0) - rack-cors (~> 1.0) + graphql-docs (>= 5, < 7) + rack-cors (>= 1, < 4) decidim-assemblies (0.32.0.dev) decidim-core (= 0.32.0.dev) decidim-blogs (0.32.0.dev) @@ -63,16 +63,16 @@ PATH cells-erb (~> 0.1.0) cells-rails (~> 0.1.3) charlock_holmes (~> 0.7) - chartkick (~> 5.1.2) + chartkick (>= 5.1.2, < 5.3.0) concurrent-ruby (~> 1.3.0) - connection_pool (< 3) + connection_pool (< 4) data_migrate (~> 11.3) date_validator (~> 0.12.0) - devise (~> 4.7) + devise (>= 4.7, < 6.0) devise-i18n (~> 1.2) diffy (~> 3.3) doorkeeper (~> 5.6, >= 5.6.6) - doorkeeper-i18n (~> 4.0) + doorkeeper-i18n (>= 4, < 6) file_validators (~> 3.0) fog-local (~> 0.6) geocoder (~> 1.8) @@ -86,23 +86,23 @@ PATH net-smtp (~> 0.5.0) nokogiri (~> 1.16, >= 1.16.2) omniauth (~> 2.0) - omniauth-facebook (~> 5.0) + omniauth-facebook (>= 5, < 11) omniauth-google-oauth2 (~> 1.0) - omniauth-rails_csrf_protection (~> 1.0) + omniauth-rails_csrf_protection (>= 1, < 3) omniauth-twitter (~> 1.4) - paper_trail (~> 16.0) - paranoia (~> 3.0.0) - pg (~> 1.5.0, < 2) + paper_trail (~> 17.0) + paranoia (~> 3.1.0) + pg (>= 1.5, < 1.7) pg_search (~> 2.2) premailer-rails (~> 1.10) rack (>= 3.2.4, < 4.0) - rack-attack (~> 6.7.0) - rails (~> 7.2.0, >= 7.2.3) - rails-i18n (~> 7.0) - ransack (~> 4.2.0) - redis (~> 4.1) + rack-attack (>= 6.7, < 6.9) + rails (~> 8.1.0) + rails-i18n (~> 8.1.0, < 8.2) + ransack (>= 4.2, < 4.5) + redis (>= 4.1, < 6.0) request_store (~> 1.7.0) - rqrcode (~> 2.2.0) + rqrcode (>= 2.2, < 3.3) ruby-vips (~> 2.2) rubyXL (~> 3.4) rubyzip (~> 2.0) @@ -119,7 +119,7 @@ PATH decidim-design (0.32.0.dev) decidim-core (= 0.32.0.dev) decidim-dev (0.32.0.dev) - bullet (~> 8.0.0) + bullet (~> 8.1.0) byebug (>= 11, < 14) capybara (~> 3.39) decidim-admin (= 0.32.0.dev) @@ -128,31 +128,31 @@ PATH decidim-core (= 0.32.0.dev) decidim-generators (= 0.32.0.dev) decidim-verifications (= 0.32.0.dev) - erb_lint (~> 0.8.0) + erb_lint (>= 0.8, < 0.10) factory_bot_rails (~> 6.2) faker (~> 3.2) i18n-tasks (~> 1.0) nokogiri (~> 1.16, >= 1.16.2) - parallel_tests (~> 4.2) - puma (~> 6.5) + parallel_tests (>= 4.2, < 6.0) + puma (>= 6.5, < 8.0) rails-controller-testing (~> 1.0) rspec (~> 3.12) rspec-cells (~> 0.3.7) rspec-html-matchers (~> 0.10) - rspec-rails (~> 6.0) + rspec-rails (>= 6, < 9) rspec-retry (~> 0.6.2) rspec_junit_formatter (~> 0.6.0) - rubocop (~> 1.78.0) + rubocop (>= 1.78, < 1.86) rubocop-capybara (~> 2.22.0, >= 2.22.1) - rubocop-factory_bot (~> 2.27.0) + rubocop-factory_bot (>= 2.27, < 2.29) 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-rails (>= 2.32, < 2.35) rubocop-rspec (~> 3.0, >= 3.6.0) - rubocop-rspec_rails (~> 2.31.0) + rubocop-rspec_rails (>= 2.31, < 2.33) rubocop-rubycw (~> 0.2.0) - rubocop-yard (~> 1.0.0) + rubocop-yard (>= 1.0, < 1.2) selenium-webdriver (~> 4.9) simplecov (~> 0.22.0) simplecov-cobertura (~> 3.1.0) @@ -193,7 +193,7 @@ PATH decidim-system (0.32.0.dev) active_link_to (~> 1.0) decidim-core (= 0.32.0.dev) - devise (~> 4.7) + devise (>= 4.7, < 6.0) devise-i18n (~> 1.2) devise_invitable (~> 2.0, >= 2.0.9) decidim-templates (0.32.0.dev) @@ -205,108 +205,108 @@ PATH GEM remote: https://rubygems.org/ specs: - actioncable (7.2.3) - actionpack (= 7.2.3) - activesupport (= 7.2.3) + action_text-trix (2.1.17) + railties + actioncable (8.1.2) + actionpack (= 8.1.2) + activesupport (= 8.1.2) nio4r (~> 2.0) websocket-driver (>= 0.6.1) 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) + actionmailbox (8.1.2) + actionpack (= 8.1.2) + activejob (= 8.1.2) + activerecord (= 8.1.2) + activestorage (= 8.1.2) + activesupport (= 8.1.2) mail (>= 2.8.0) - actionmailer (7.2.3) - actionpack (= 7.2.3) - actionview (= 7.2.3) - activejob (= 7.2.3) - activesupport (= 7.2.3) + actionmailer (8.1.2) + actionpack (= 8.1.2) + actionview (= 8.1.2) + activejob (= 8.1.2) + activesupport (= 8.1.2) mail (>= 2.8.0) rails-dom-testing (~> 2.2) - actionpack (7.2.3) - actionview (= 7.2.3) - activesupport (= 7.2.3) - cgi + actionpack (8.1.2) + actionview (= 8.1.2) + activesupport (= 8.1.2) nokogiri (>= 1.8.5) - racc - rack (>= 2.2.4, < 3.3) + rack (>= 2.2.4) rack-session (>= 1.0.1) rack-test (>= 0.6.3) 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) + actiontext (8.1.2) + action_text-trix (~> 2.1.15) + actionpack (= 8.1.2) + activerecord (= 8.1.2) + activestorage (= 8.1.2) + activesupport (= 8.1.2) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.2.3) - activesupport (= 7.2.3) + actionview (8.1.2) + activesupport (= 8.1.2) builder (~> 3.1) - cgi erubi (~> 1.11) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) active_link_to (1.0.5) actionpack addressable - activejob (7.2.3) - activesupport (= 7.2.3) + activejob (8.1.2) + activesupport (= 8.1.2) globalid (>= 0.3.6) - activemodel (7.2.3) - activesupport (= 7.2.3) - activerecord (7.2.3) - activemodel (= 7.2.3) - activesupport (= 7.2.3) + activemodel (8.1.2) + activesupport (= 8.1.2) + activerecord (8.1.2) + activemodel (= 8.1.2) + activesupport (= 8.1.2) timeout (>= 0.4.0) - activestorage (7.2.3) - actionpack (= 7.2.3) - activejob (= 7.2.3) - activerecord (= 7.2.3) - activesupport (= 7.2.3) + activestorage (8.1.2) + actionpack (= 8.1.2) + activejob (= 8.1.2) + activerecord (= 8.1.2) + activesupport (= 8.1.2) marcel (~> 1.0) - activesupport (7.2.3) + activesupport (8.1.2) base64 - benchmark (>= 0.3) bigdecimal concurrent-ruby (~> 1.0, >= 1.3.1) connection_pool (>= 2.2.5) drb i18n (>= 1.6, < 2) + json logger (>= 1.4.2) minitest (>= 5.1) securerandom (>= 0.3) tzinfo (~> 2.0, >= 2.0.5) - acts_as_list (1.2.4) + uri (>= 0.13.1) + acts_as_list (1.2.6) activerecord (>= 6.1) activesupport (>= 6.1) - addressable (2.8.8) + addressable (2.8.9) public_suffix (>= 2.0.2, < 8.0) ast (2.4.3) base64 (0.3.0) - batch-loader (2.0.5) - bcrypt (3.1.20) - benchmark (0.5.0) - better_html (2.1.1) - actionview (>= 6.0) - activesupport (>= 6.0) + batch-loader (2.0.6) + bcrypt (3.1.22) + better_html (2.2.0) + actionview (>= 7.0) + activesupport (>= 7.0) ast (~> 2.0) erubi (~> 1.4) parser (>= 2.4) smart_properties bigdecimal (4.0.1) bindex (0.8.1) - bootsnap (1.18.6) + bootsnap (1.23.0) msgpack (~> 1.2) - brakeman (7.0.2) + brakeman (8.0.4) racc browser (6.2.0) builder (3.3.0) - bullet (8.0.8) + bullet (8.1.0) activesupport (>= 3.0.0) uniform_notifier (~> 1.11) byebug (13.0.0) @@ -331,9 +331,8 @@ 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) + chartkick (5.2.1) childprocess (5.1.0) logger (~> 1.5) chunky_png (1.4.0) @@ -341,10 +340,11 @@ GEM fast-stemmer (~> 1.0) matrix (~> 0.4) cmdparse (3.0.7) - commonmarker (0.23.12) + commonmarker (2.6.3-arm64-darwin) + commonmarker (2.6.3-x86_64-linux) concurrent-ruby (1.3.6) - connection_pool (2.5.5) - crack (1.0.0) + connection_pool (3.0.2) + crack (1.0.1) bigdecimal rexml crass (1.0.6) @@ -361,16 +361,17 @@ GEM declarative-builder (0.2.0) trailblazer-option (~> 0.1.0) declarative-option (0.1.0) - devise (4.9.4) + devise (5.0.3) bcrypt (~> 3.0) orm_adapter (~> 0.1) - railties (>= 4.1.0) + railties (>= 7.0) responders warden (~> 1.2.3) - devise-i18n (1.12.1) - devise (>= 4.9.0) - devise-jwt (0.12.1) - devise (~> 4.0) + devise-i18n (1.16.0) + devise (>= 5.0.0) + rails-i18n + devise-jwt (0.13.0) + devise (>= 4.0.0, < 6.0.0) warden-jwt_auth (~> 0.10) devise_invitable (2.0.11) actionmailer (>= 5.0) @@ -381,9 +382,10 @@ GEM nokogiri (>= 1.18.2) rubyzip (~> 2.3.0) docile (1.4.1) - doorkeeper (5.8.2) + doorkeeper (5.9.0) railties (>= 5) - doorkeeper-i18n (4.0.1) + doorkeeper-i18n (5.2.8) + doorkeeper (>= 5.2) drb (2.2.3) dry-auto_inject (1.1.0) dry-core (~> 1.1) @@ -391,12 +393,12 @@ GEM dry-configurable (1.3.0) dry-core (~> 1.1) zeitwerk (~> 2.6) - dry-core (1.1.0) + dry-core (1.2.0) concurrent-ruby (~> 1.0) logger zeitwerk (~> 2.6) erb (6.0.2) - erb_lint (0.8.0) + erb_lint (0.9.0) activesupport better_html (>= 2.0.1) parser (>= 2.7.1.4) @@ -407,16 +409,14 @@ GEM temple erubi (1.13.1) escape_utils (1.3.0) - excon (1.2.8) + excon (1.3.2) logger - extended-markdown-filter (0.7.0) - html-pipeline (~> 2.9) - factory_bot (6.5.4) + factory_bot (6.5.6) activesupport (>= 6.1.0) - factory_bot_rails (6.4.4) + factory_bot_rails (6.5.1) factory_bot (~> 6.5) - railties (>= 5.0.0) - faker (3.5.3) + railties (>= 6.1.0) + faker (3.6.1) i18n (>= 1.8.11, < 2) faraday (2.14.1) faraday-net_http (>= 2.0, < 3.5) @@ -425,8 +425,8 @@ GEM faraday-net_http (3.4.2) net-http (~> 0.5) fast-stemmer (1.0.2) - ffi (1.17.2-arm64-darwin) - ffi (1.17.2-x86_64-linux-gnu) + ffi (1.17.3-arm64-darwin) + ffi (1.17.3-x86_64-linux-gnu) fiber-storage (1.0.1) file_validators (3.0.0) activemodel (>= 3.2) @@ -436,38 +436,39 @@ GEM excon (~> 1.0) formatador (>= 0.2, < 2.0) mime-types - fog-local (0.8.0) + fog-local (0.9.0) fog-core (>= 1.27, < 3.0) - formatador (1.1.1) - gemoji (3.0.1) - geocoder (1.8.5) + formatador (1.2.3) + reline + gemoji (4.1.0) + geocoder (1.8.6) base64 (>= 0.1.0) csv (>= 3.0.0) geom2d (0.4.1) globalid (1.3.0) activesupport (>= 6.1) - google-protobuf (4.29.3-arm64-darwin) + google-protobuf (4.33.5-arm64-darwin) bigdecimal rake (>= 13) - google-protobuf (4.29.3-x86_64-linux) + google-protobuf (4.33.5-x86_64-linux-gnu) bigdecimal rake (>= 13) - graphql (2.5.19) + graphql (2.5.21) base64 fiber-storage logger - graphql-docs (5.1.0) - commonmarker (~> 0.23, >= 0.23.6) + graphql-docs (6.0.0) + commonmarker (~> 2.0) escape_utils (~> 1.2) - extended-markdown-filter (~> 0.4) - gemoji (~> 3.0) + gemoji (~> 4.0) graphql (~> 2.0) - html-pipeline (~> 2.14, >= 2.14.3) + html-pipeline (~> 3.0) logger (~> 1.6) ostruct (~> 0.6) sass-embedded (~> 1.58) - hashdiff (1.1.2) - hashie (5.0.0) + hashdiff (1.2.1) + hashie (5.1.0) + logger hexapdf (1.6.0) cmdparse (~> 3.0, >= 3.0.3) geom2d (~> 0.4, >= 0.4.1) @@ -475,25 +476,28 @@ GEM strscan (>= 3.1.2) highline (3.1.2) reline - html-pipeline (2.14.3) - activesupport (>= 2) - nokogiri (>= 1.4) + html-pipeline (3.2.4) + selma (~> 0.4) + zeitwerk (~> 2.5) htmlentities (4.3.4) i18n (1.14.8) concurrent-ruby (~> 1.0) - i18n-tasks (1.0.15) + 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.14.0) @@ -507,7 +511,10 @@ GEM prism (>= 1.3.0) rdoc (>= 4.0.0) reline (>= 0.4.2) - json (2.18.1) + json (2.19.2) + json-schema (6.2.0) + addressable (~> 2.8) + bigdecimal (>= 3.1, < 5) jwt (3.1.2) base64 kaminari (1.2.2) @@ -535,11 +542,12 @@ GEM railties (>= 6.1) rexml lint_roller (1.1.0) - listen (3.9.0) + listen (3.10.0) + logger rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) logger (1.7.0) - loofah (2.25.0) + loofah (2.25.1) crass (~> 1.0.2) nokogiri (>= 1.12.0) mail (2.9.0) @@ -550,10 +558,12 @@ GEM net-smtp marcel (1.1.0) matrix (0.4.3) - mime-types (3.6.0) + mcp (0.8.0) + json-schema (>= 4.1) + mime-types (3.7.0) logger - mime-types-data (~> 3.2015) - mime-types-data (3.2025.0722) + mime-types-data (~> 3.2025, >= 3.2025.0507) + mime-types-data (3.2026.0224) mini_magick (5.3.1) logger mini_mime (1.1.5) @@ -575,9 +585,9 @@ GEM net-smtp (0.5.1) net-protocol nio4r (2.7.5) - nokogiri (1.19.1-arm64-darwin) + nokogiri (1.19.2-arm64-darwin) racc (~> 1.4) - nokogiri (1.19.1-x86_64-linux-gnu) + nokogiri (1.19.2-x86_64-linux-gnu) racc (~> 1.4) oauth (1.1.0) oauth-tty (~> 1.0, >= 1.0.1) @@ -585,21 +595,23 @@ GEM version_gem (~> 1.1) oauth-tty (1.0.5) version_gem (~> 1.1, >= 1.1.1) - oauth2 (2.0.12) + oauth2 (2.0.18) faraday (>= 0.17.3, < 4.0) jwt (>= 1.0, < 4.0) logger (~> 1.2) multi_xml (~> 0.5) rack (>= 1.2, < 4) snaky_hash (~> 2.0, >= 2.0.3) - version_gem (>= 1.1.8, < 3) - omniauth (2.1.3) + version_gem (~> 1.1, >= 1.1.9) + omniauth (2.1.4) hashie (>= 3.4.6) + logger rack (>= 2.2.3) rack-protection - omniauth-facebook (5.0.0) - omniauth-oauth2 (~> 1.2) - omniauth-google-oauth2 (1.2.1) + omniauth-facebook (10.0.0) + bigdecimal + omniauth-oauth2 (>= 1.2, < 3) + omniauth-google-oauth2 (1.2.2) jwt (>= 2.9.2) oauth2 (~> 2.0) omniauth (~> 2.0) @@ -608,10 +620,10 @@ GEM oauth omniauth (>= 1.0, < 3) rack (>= 1.6.2, < 4) - omniauth-oauth2 (1.8.0) - oauth2 (>= 1.4, < 3) + omniauth-oauth2 (1.9.0) + oauth2 (>= 2.0.2, < 3) omniauth (~> 2.0) - omniauth-rails_csrf_protection (1.0.2) + omniauth-rails_csrf_protection (2.0.1) actionpack (>= 4.2) omniauth (~> 2.0) omniauth-twitter (1.4.0) @@ -621,18 +633,19 @@ GEM orm_adapter (0.5.0) ostruct (0.6.3) package_json (0.1.0) - paper_trail (16.0.0) - activerecord (>= 6.1) + paper_trail (17.0.0) + activerecord (>= 7.1) request_store (~> 1.4) parallel (1.27.0) - parallel_tests (4.9.0) + parallel_tests (5.6.0) parallel - paranoia (3.0.1) - activerecord (>= 6, < 8.1) - parser (3.3.9.0) + paranoia (3.1.0) + activerecord (>= 7, < 8.2) + parser (3.3.10.2) ast (~> 2.4.1) racc - pg (1.5.9) + pg (1.6.3-arm64-darwin) + pg (1.6.3-x86_64-linux) pg_search (2.3.7) activerecord (>= 6.1) activesupport (>= 6.1) @@ -651,15 +664,16 @@ GEM psych (5.3.1) date stringio - public_suffix (7.0.2) - puma (6.5.0) + public_suffix (7.0.5) + puma (7.2.0) nio4r (~> 2.0) racc (1.8.1) rack (3.2.5) - rack-attack (6.7.0) + rack-attack (6.8.0) rack (>= 1.0, < 4) - rack-cors (1.1.1) - rack (>= 2.0.0) + rack-cors (3.0.0) + logger + rack (>= 3.0.14) rack-protection (4.2.1) base64 (>= 0.1.0) logger (>= 1.6.0) @@ -673,20 +687,20 @@ GEM rack (>= 1.3) rackup (2.3.1) rack (>= 3) - 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) + rails (8.1.2) + actioncable (= 8.1.2) + actionmailbox (= 8.1.2) + actionmailer (= 8.1.2) + actionpack (= 8.1.2) + actiontext (= 8.1.2) + actionview (= 8.1.2) + activejob (= 8.1.2) + activemodel (= 8.1.2) + activerecord (= 8.1.2) + activestorage (= 8.1.2) + activesupport (= 8.1.2) bundler (>= 1.15.0) - railties (= 7.2.3) + railties (= 8.1.2) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) actionview (>= 5.0.1.rc1) @@ -698,13 +712,12 @@ GEM rails-html-sanitizer (1.7.0) loofah (~> 2.25) 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) + rails-i18n (8.1.0) i18n (>= 0.7, < 2) - railties (>= 6.0.0, < 8) - railties (7.2.3) - actionpack (= 7.2.3) - activesupport (= 7.2.3) - cgi + railties (>= 8.0.0, < 9) + railties (8.1.2) + actionpack (= 8.1.2) + activesupport (= 8.1.2) irb (~> 1.13) rackup (>= 1.0.0) rake (>= 12.2) @@ -713,9 +726,9 @@ GEM zeitwerk (~> 2.6) rainbow (3.1.1) rake (13.3.1) - ransack (4.2.1) - activerecord (>= 6.1.5) - activesupport (>= 6.1.5) + ransack (4.4.1) + activerecord (>= 7.2) + activesupport (>= 7.2) i18n rb-fsevent (0.11.2) rb-inotify (0.11.1) @@ -725,28 +738,31 @@ GEM psych (>= 4.0.0) tsort redcarpet (3.6.1) - redis (4.8.1) - regexp_parser (2.10.0) + redis (5.4.1) + redis-client (>= 0.22.0) + redis-client (0.27.0) + connection_pool + regexp_parser (2.11.3) reline (0.6.3) io-console (~> 0.5) request_store (1.7.0) rack (>= 1.4) - responders (3.1.1) - actionpack (>= 5.2) - railties (>= 5.2) + responders (3.2.0) + actionpack (>= 7.0) + railties (>= 7.0) rexml (3.4.4) - rqrcode (2.2.0) + rqrcode (3.2.0) chunky_png (~> 1.0) - rqrcode_core (~> 1.0) - rqrcode_core (1.2.0) - rspec (3.13.1) + rqrcode_core (~> 2.0) + rqrcode_core (2.1.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.5) + rspec-core (3.13.6) rspec-support (~> 3.13.0) rspec-expectations (3.13.5) diff-lcs (>= 1.2.0, < 2.0) @@ -754,92 +770,95 @@ GEM rspec-html-matchers (0.10.0) nokogiri (~> 1) rspec (>= 3.0.0.a) - rspec-mocks (3.13.5) + rspec-mocks (3.13.8) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - 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-rails (8.0.4) + actionpack (>= 7.2) + activesupport (>= 7.2) + railties (>= 7.2) + rspec-core (>= 3.13.0, < 5.0.0) + rspec-expectations (>= 3.13.0, < 5.0.0) + rspec-mocks (>= 3.13.0, < 5.0.0) + rspec-support (>= 3.13.0, < 5.0.0) rspec-retry (0.6.2) rspec-core (> 3.3) - rspec-support (3.13.4) + rspec-support (3.13.7) rspec_junit_formatter (0.6.0) rspec-core (>= 2, < 4, != 2.12.0) - rubocop (1.78.0) + rubocop (1.85.1) json (~> 2.3) language_server-protocol (~> 3.17.0.2) lint_roller (~> 1.1.0) + mcp (~> 0.6) parallel (~> 1.10) parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 2.9.3, < 3.0) - rubocop-ast (>= 1.45.1, < 2.0) + rubocop-ast (>= 1.49.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 4.0) - rubocop-ast (1.45.1) + rubocop-ast (1.49.0) parser (>= 3.3.7.2) - prism (~> 1.4) + prism (~> 1.7) rubocop-capybara (2.22.1) lint_roller (~> 1.1) rubocop (~> 1.72, >= 1.72.1) - rubocop-factory_bot (2.27.1) + rubocop-factory_bot (2.28.0) lint_roller (~> 1.1) rubocop (~> 1.72, >= 1.72.1) rubocop-faker (1.3.0) faker (>= 2.12.0) lint_roller (~> 1.1) rubocop (>= 1.72.1) - rubocop-graphql (1.5.6) + rubocop-graphql (1.6.0) lint_roller (~> 1.1) rubocop (>= 1.72.1, < 2) - rubocop-performance (1.25.0) + rubocop-performance (1.26.1) lint_roller (~> 1.1) rubocop (>= 1.75.0, < 2.0) - rubocop-ast (>= 1.38.0, < 2.0) - rubocop-rails (2.32.0) + rubocop-ast (>= 1.47.1, < 2.0) + rubocop-rails (2.34.3) activesupport (>= 4.2.0) lint_roller (~> 1.1) rack (>= 1.1) rubocop (>= 1.75.0, < 2.0) rubocop-ast (>= 1.44.0, < 2.0) - rubocop-rspec (3.6.0) + rubocop-rspec (3.9.0) lint_roller (~> 1.1) - rubocop (~> 1.72, >= 1.72.1) - rubocop-rspec_rails (2.31.0) + rubocop (~> 1.81) + rubocop-rspec_rails (2.32.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) - rubocop-yard (1.0.0) + rubocop-yard (1.1.0) lint_roller rubocop (~> 1.72) yard ruby-progressbar (1.13.0) - ruby-vips (2.2.5) + ruby-vips (2.3.0) ffi (~> 1.12) logger rubyXL (3.4.33) nokogiri (>= 1.10.8) rubyzip (>= 1.3.0) rubyzip (2.3.2) - sass-embedded (1.83.4-arm64-darwin) - google-protobuf (~> 4.29) - sass-embedded (1.83.4-x86_64-linux-gnu) - google-protobuf (~> 4.29) + sass-embedded (1.97.3-arm64-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.27.0) + selenium-webdriver (4.41.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) + selma (0.4.15-arm64-darwin) + selma (0.4.15-x86_64-linux) semantic_range (3.1.0) shakapacker (8.3.0) activesupport (>= 5.2) @@ -860,7 +879,7 @@ GEM snaky_hash (2.0.3) hashie (>= 0.1.0, < 6) version_gem (>= 1.1.8, < 3) - spring (4.2.1) + spring (4.4.2) spring-watcher-listen (2.1.0) listen (>= 2.7, < 4.0) spring (>= 4) @@ -877,16 +896,16 @@ GEM tzinfo (2.0.6) concurrent-ruby (~> 1.0) uber (0.1.0) - unicode-display_width (3.1.4) - unicode-emoji (~> 4.0, >= 4.0.4) - unicode-emoji (4.0.4) + unicode-display_width (3.2.0) + unicode-emoji (~> 4.1) + unicode-emoji (4.2.0) uniform_notifier (1.17.0) uri (1.1.1) useragent (0.16.11) valid_email2 (7.0.15) activemodel (>= 6.0) mail (~> 2.5) - version_gem (1.1.8) + version_gem (1.1.9) w3c_rspec_validators (0.3.0) rails rspec @@ -902,15 +921,14 @@ GEM 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) + web-console (4.3.0) + actionview (>= 8.0.0) bindex (>= 0.4.0) - railties (>= 6.0.0) + railties (>= 8.0.0) web-push (3.1.0) jwt (~> 3.0) openssl (>= 3.0) - webmock (3.24.0) + webmock (3.26.2) addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) @@ -923,7 +941,7 @@ GEM wisper-rspec (1.1.0) xpath (3.2.0) nokogiri (~> 1.8) - yard (0.9.37) + yard (0.9.38) zeitwerk (2.7.5) PLATFORMS @@ -932,8 +950,8 @@ PLATFORMS x86_64-linux DEPENDENCIES - bootsnap (~> 1.4) - brakeman (~> 7.0) + bootsnap (~> 1.23) + brakeman (~> 8.0) byebug (~> 13.0) decidim! decidim-ai! @@ -946,10 +964,10 @@ DEPENDENCIES decidim-initiatives! decidim-templates! letter_opener_web (~> 3.0) - listen (~> 3.1) - parallel_tests (~> 4.2) + listen (~> 3.10) + parallel_tests (~> 5.6) puma (>= 6.3.1) - web-console (~> 4.2) + web-console (~> 4.3) RUBY VERSION ruby 3.4.7p58 diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 619197596dbf2..bf20db8ab62e6 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -7,7 +7,7 @@ checking out the last version of this document in the [GitHub page for the relea As usual, we recommend that you have a full backup, of the database, application code and static files. -NOTE: Please note this release is updating Rails version from 7.2.2 to 7.2.3. Please ensure you back up your `SECRET_KEY_BASE` env variable and also `tmp/local_secret.txt` if you have it. +NOTE: Please note this release is updating Rails version from 7.2.2 to 8.1.2. Ensure you back up your `SECRET_KEY_BASE` env variable and also `tmp/local_secret.txt` if you have it. On your local development environment, you may need to set your `SECRET_KEY_BASE` env variable to the same value as the one present in your `tmp/local_secret.txt`. To update, follow these steps: @@ -38,6 +38,7 @@ gem "decidim-dev", github: "decidim/decidim" sudo apt install libvips libvips-tools # or the alternative installation process for your operating system. See "3.5. Replace image processing with imagemagick to libvips" bundle update decidim bin/rails decidim:upgrade +sed -i "s/config\.load_defaults 7\.2/config\.load_defaults 8.1/g" config/application.rb # see "2.1. Ruby on Rails update to 8.1" bin/rails db:migrate bin/rails decidim:upgrade:encryption # skip this command if you have run it before: @@ -62,7 +63,24 @@ You can read more about this change on PR [#15005](https://github.com/decidim/de ## 2. General notes -### 2.1. Module deprecations +### 2.1. Ruby on Rails update to 8.1 + +This particular release is deploying a new Rails version, 8.1. As a result you need to update your application configuration. Before that, you need to run the following commands: + +```console +sed -i "s/config\.load_defaults 7\.2/config\.load_defaults 8.1/g" config/application.rb # see "2.1. Ruby on Rails update to 8.1" +``` + +#### Removal of official Azure support from Active Storage + +Rails core team decided to remove the Azure Active Storage support from Rails 8.1, as the official Azure libraries are not maintained since September 2024. If you are using Azure for your Active Storage, support, you could use the unofficial Azure Active Storage gem [Azure Blob](https://github.com/testdouble/azure-blob) + +You can read more about this change on PR: + +- [Upgrade to Rails 8.0.4](https://github.com/decidim/decidim/pull/16214) +- [Upgrade to Rails 8.1.2](https://github.com/decidim/decidim/pull/16310). + +### 2.2. Module deprecations As part of our ongoing efforts to improve and make simpler Decidim, the following modules will be **deprecated** in this version (v0.31) and **removed** in the next major version (v0.32): @@ -78,7 +96,7 @@ The Sortitions module (`decidim-sortitions`) is removed in v0.32. This module pr The Polls feature within the Meetings module (`decidim-meetings`) will be removed in a future version (to be determined). This feature allowed meeting organizers to create polls during meetings. Organizations using meeting polls should plan to use external polling tools (for instance, through Jitsi) or migrate to other voting mechanisms available in Decidim, such as the new Elections module (`decidim-elections`). -### 2.2. Old private exports are now expired +### 2.3. Old private exports are now expired Due to some data consistency issues with the private exports, we have decided to expire all the previously generated files. Users are able to request and receive a new private export file. @@ -92,13 +110,13 @@ bin/rails decidim:upgrade:clean:remove_private_exports_attachments You can read more about this change on PR [#15020](https://github.com/decidim/decidim/pull/15020). -### 2.3. Add data migrations +### 2.4. Add data migrations At the moment we are adding this gem so we can start doing data migrations for fixes when v0.33.0 is released. You can read more about this at [Data migrations doc](https://docs.decidim.org/en/develop/develop/guide_data_migrations.html). You can read more about this change on PR [#15501](https://github.com/decidim/decidim/pull/15501). -### 2.4. Fix gitignore for ServiceWorker related files +### 2.5. Fix gitignore for ServiceWorker related files We detected a bug where some dynamic files are not added to the gitignore, so they could be committed to the repository. For fixing it, you need to add them to your gitignore file: @@ -108,7 +126,7 @@ echo "/public/sw.js*" >> .gitignore You can read more about this change on PR [#15601](https://github.com/decidim/decidim/pull/15601). -### 2.5. Data migration for organization short_name +### 2.6. Data migration for organization short_name A new data migration has been added to populate the `short_name` field for existing organizations. This field is required for the PWA (Progressive Web App) manifest to properly display the application name on mobile devices' home screens. @@ -118,7 +136,7 @@ This migration runs automatically when executing `bin/rails data:migrate` as par You can read more about this change on PR [#15729](https://github.com/decidim/decidim/pull/15729). -### 2.6. Add locale to the url +### 2.7. Add locale to the url For a long time Decidim has been using internally the user browser to detect the language of the user. This has been changed to use the locale of the url instead. @@ -141,7 +159,7 @@ We are also removing the `decidim_user_group_memberships` tables. You can read more about this change on PR [#16022](https://github.com/decidim/decidim/pull/16022). -### 2.8. [[TITLE OF THE ACTION]] +### 2.9. [[TITLE OF THE ACTION]] You can read more about this change on PR [#XXXX](https://github.com/decidim/decidim/pull/XXXX). @@ -280,7 +298,88 @@ After the rack upgrade, the filters are defined as follows: You can read more about this change on PR [#16103](https://github.com/decidim/decidim/pull/16103). -### 5.3. [[TITLE OF THE CHANGE]] +### 5.3. Decidim Configuration changes + +Once you have upgraded to this version, you may need to check your configuration. Previously, we were using `ActiveSupport::Configurable` to handle Decidim configuration. Now, this has been deprecated with Rails, and it will be removed in the next Rails version. + +We went ahead and changed the way we handle Decidim configuration, trying to keep the same API as before. + +Previously, you may had an initializer with some content like: + +```ruby +Decidim.configure do |config| + config.force_ssl = true + # some other configuration +end +``` + +Now we try to keep the same, but if there is some kind of custom configuration that you may have, you will need to change it to: + +```ruby +Decidim.force_ssl = true +``` + +#### Decidim module developer instructions + +If you are a module developer, you may want to change your plugin structure to remove `ActiveSupport::Configurable` calls. + +If you were using something like: + +```ruby +module Decidim + module Ai + module SpamDetection + include ActiveSupport::Configurable + + config_accessor :reporting_user_email do + "my default value" + end + # some other configuration + end + end +end +``` + +You can refactor to the following: + +```ruby +module Decidim + module Ai + module SpamDetection + + mattr_accessor :reporting_user_email, default: "my default value" + + # some other configuration + end + end +end +``` + +To keep the same API, you may want to add the following to your module definition + +```ruby +module Decidim + module Ai + module SpamDetection + class << self + def config = self + + def configure + yield self + end + end + + mattr_accessor :reporting_user_email, default: "my default value" + + # some other configuration + end + end +end +``` + +You can read more about this change on PR [#16366](https://github.com/decidim/decidim/pull/16366). + +### 5.4. [[TITLE OF THE CHANGE]] In order to [[REASONING (e.g. improve the maintenance of the code base)]] we have changed... diff --git a/config/i18n-tasks.yml b/config/i18n-tasks.yml index 12d2dfe08cd78..0057d76ebc5a0 100644 --- a/config/i18n-tasks.yml +++ b/config/i18n-tasks.yml @@ -162,13 +162,6 @@ ignore_unused: - decidim.elections.votes.check_census.* - decidim.elections.votes.question.* - decidim.proposals.answers.* - - decidim.proposals.collaborative_drafts.show.see_other_versions - - decidim.proposals.collaborative_drafts.wizard_aside.back - - decidim.proposals.collaborative_drafts.wizard_aside.back_from_collaborative_draft - - decidim.proposals.collaborative_drafts.wizard_aside.back_from_step_1 - - decidim.proposals.collaborative_drafts.wizard_aside.back_from_step_2 - - decidim.proposals.collaborative_drafts.wizard_aside.back_from_step_3 - - decidim.proposals.collaborative_drafts.wizard_aside.back_from_step_4 - decidim.proposals.proposal_likes_helper.likes_count_title - decidim.proposals.proposals.orders.* - decidim.proposals.proposals.likes_card_row.comments_title @@ -259,11 +252,6 @@ ignore_unused: - decidim.meetings.content_blocks.*.name - decidim.blogs.content_blocks.*.name - decidim.proposals.content_blocks.*.name - - decidim.proposals.collaborative_drafts.show.hidden_authors_count.* - - decidim.proposals.collaborative_drafts.orders* - - decidim.proposals.collaborative_drafts.filters* - - decidim.proposals.collaborative_drafts.show.withdraw - - decidim.proposals.collaborative_drafts.show.publish - decidim.conferences.content_blocks.*.name - decidim.conferences.pages.home.highlighted_conferences.* - decidim.conferences.conference_speaker.* diff --git a/decidim-accountability/app/cells/decidim/accountability/result_show_cell.rb b/decidim-accountability/app/cells/decidim/accountability/result_show_cell.rb index 5199b13934590..d9eb0bc0b56d3 100644 --- a/decidim-accountability/app/cells/decidim/accountability/result_show_cell.rb +++ b/decidim-accountability/app/cells/decidim/accountability/result_show_cell.rb @@ -8,6 +8,7 @@ module Accountability class ResultShowCell < Decidim::ViewModel include Decidim::Accountability::ApplicationHelper include Cell::ViewModel::Partial + delegate :children, :milestones, to: :model alias result model diff --git a/decidim-accountability/app/cells/decidim/accountability/status_cell.rb b/decidim-accountability/app/cells/decidim/accountability/status_cell.rb index 8ba35babf7e1f..dec94bd586a87 100644 --- a/decidim-accountability/app/cells/decidim/accountability/status_cell.rb +++ b/decidim-accountability/app/cells/decidim/accountability/status_cell.rb @@ -7,7 +7,7 @@ module Accountability # This cell renders the status of a taxonomy or a result. class StatusCell < Decidim::ViewModel include Decidim::Accountability::ApplicationHelper - include Decidim::Accountability::BreadcrumbHelper + include Decidim::Accountability::CalculatorHelper include ActionView::Helpers::NumberHelper def show @@ -80,10 +80,6 @@ def render_count options[:render_count] end - def count_calculator(taxonomy_id) - Decidim::Accountability::ResultsCalculator.new(current_component, taxonomy_id).count - end - def decidim Decidim::Accountability::Engine.routes.url_helpers end diff --git a/decidim-accountability/app/controllers/concerns/decidim/accountability/admin/filterable.rb b/decidim-accountability/app/controllers/concerns/decidim/accountability/admin/filterable.rb index d81e1646cb74e..ac879484908ad 100644 --- a/decidim-accountability/app/controllers/concerns/decidim/accountability/admin/filterable.rb +++ b/decidim-accountability/app/controllers/concerns/decidim/accountability/admin/filterable.rb @@ -44,7 +44,7 @@ def dynamically_translated_filters end def status_ids_hash(statuses) - statuses.each_with_object({}) { |status, hash| hash[status.id] = status.id } + statuses.to_h { |status| [status.id, status.id] } end def translated_status_id_eq(id) diff --git a/decidim-accountability/app/controllers/decidim/accountability/admin/import_components_controller.rb b/decidim-accountability/app/controllers/decidim/accountability/admin/import_components_controller.rb index 7059d2cbc914d..fcbcf6e038b51 100644 --- a/decidim-accountability/app/controllers/decidim/accountability/admin/import_components_controller.rb +++ b/decidim-accountability/app/controllers/decidim/accountability/admin/import_components_controller.rb @@ -22,7 +22,7 @@ def create on(:invalid) do flash[:alert] = I18n.t("import_components.create.invalid", scope: "decidim.accountability.admin") - render action: "new", status: :unprocessable_entity + render action: "new", status: :unprocessable_content end end end diff --git a/decidim-accountability/app/controllers/decidim/accountability/admin/import_results_controller.rb b/decidim-accountability/app/controllers/decidim/accountability/admin/import_results_controller.rb index a1114a405c7c2..484e2c829a21a 100644 --- a/decidim-accountability/app/controllers/decidim/accountability/admin/import_results_controller.rb +++ b/decidim-accountability/app/controllers/decidim/accountability/admin/import_results_controller.rb @@ -21,7 +21,7 @@ def create redirect_to import_results_path(current_participatory_space, current_component) else flash[:alert] = I18n.t("imports.create.invalid", scope: "decidim.accountability.admin") - render action: "new", status: :unprocessable_entity + render action: "new", status: :unprocessable_content end end diff --git a/decidim-accountability/app/controllers/decidim/accountability/admin/milestones_controller.rb b/decidim-accountability/app/controllers/decidim/accountability/admin/milestones_controller.rb index 2747b12cef95e..dd878b20dddad 100644 --- a/decidim-accountability/app/controllers/decidim/accountability/admin/milestones_controller.rb +++ b/decidim-accountability/app/controllers/decidim/accountability/admin/milestones_controller.rb @@ -27,7 +27,7 @@ def create on(:invalid) do flash.now[:alert] = I18n.t("milestones.create.invalid", scope: "decidim.accountability.admin") - render action: "new", status: :unprocessable_entity + render action: "new", status: :unprocessable_content end end end @@ -51,7 +51,7 @@ def update on(:invalid) do flash.now[:alert] = I18n.t("milestones.update.invalid", scope: "decidim.accountability.admin") - render action: "edit", status: :unprocessable_entity + render action: "edit", status: :unprocessable_content end end end diff --git a/decidim-accountability/app/controllers/decidim/accountability/admin/results_bulk_actions_controller.rb b/decidim-accountability/app/controllers/decidim/accountability/admin/results_bulk_actions_controller.rb index a89efd03afd5c..20ef9ad67aec6 100644 --- a/decidim-accountability/app/controllers/decidim/accountability/admin/results_bulk_actions_controller.rb +++ b/decidim-accountability/app/controllers/decidim/accountability/admin/results_bulk_actions_controller.rb @@ -88,12 +88,12 @@ def result_ids end def result_params - @result_params ||= params.require(:result_bulk_actions).permit( - :decidim_accountability_status_id, - :start_date, - :end_date, - result_ids: [], - taxonomies: [] + @result_params ||= params.expect( + result_bulk_actions: [:decidim_accountability_status_id, + :start_date, + :end_date, + { result_ids: [], + taxonomies: [] }] ) end end diff --git a/decidim-accountability/app/controllers/decidim/accountability/admin/results_controller.rb b/decidim-accountability/app/controllers/decidim/accountability/admin/results_controller.rb index 2b169f93d4c13..4adce6cfac7dd 100644 --- a/decidim-accountability/app/controllers/decidim/accountability/admin/results_controller.rb +++ b/decidim-accountability/app/controllers/decidim/accountability/admin/results_controller.rb @@ -38,7 +38,7 @@ def create on(:invalid) do flash.now[:alert] = I18n.t("results.create.invalid", scope: "decidim.accountability.admin") - render action: "new", status: :unprocessable_entity + render action: "new", status: :unprocessable_content end end end @@ -62,7 +62,7 @@ def update on(:invalid) do flash.now[:alert] = I18n.t("results.update.invalid", scope: "decidim.accountability.admin") - render action: "edit", status: :unprocessable_entity + render action: "edit", status: :unprocessable_content end end end diff --git a/decidim-accountability/app/controllers/decidim/accountability/admin/statuses_controller.rb b/decidim-accountability/app/controllers/decidim/accountability/admin/statuses_controller.rb index af990f2fa6633..af66db17b2041 100644 --- a/decidim-accountability/app/controllers/decidim/accountability/admin/statuses_controller.rb +++ b/decidim-accountability/app/controllers/decidim/accountability/admin/statuses_controller.rb @@ -28,7 +28,7 @@ def create on(:invalid) do flash.now[:alert] = I18n.t("statuses.create.invalid", scope: "decidim.accountability.admin") - render action: "new", status: :unprocessable_entity + render action: "new", status: :unprocessable_content end end end @@ -52,7 +52,7 @@ def update on(:invalid) do flash.now[:alert] = I18n.t("statuses.update.invalid", scope: "decidim.accountability.admin") - render action: "edit", status: :unprocessable_entity + render action: "edit", status: :unprocessable_content end end end diff --git a/decidim-accountability/app/controllers/decidim/accountability/results_controller.rb b/decidim-accountability/app/controllers/decidim/accountability/results_controller.rb index 4b5bf0fb88435..cd9fb087d6cb2 100644 --- a/decidim-accountability/app/controllers/decidim/accountability/results_controller.rb +++ b/decidim-accountability/app/controllers/decidim/accountability/results_controller.rb @@ -5,10 +5,12 @@ module Accountability # Exposes the result resource so users can view them class ResultsController < Decidim::Accountability::ApplicationController include FilterResource + helper Decidim::TraceabilityHelper helper Decidim::Accountability::BreadcrumbHelper + helper Decidim::Accountability::CalculatorHelper - helper_method :results, :result, :count_calculator, :selected_root_taxonomy, :selected_taxonomy_children, :selected_taxonomy_grandchildren? + helper_method :results, :result, :selected_root_taxonomy, :selected_taxonomy_children, :selected_taxonomy_grandchildren? def show raise ActionController::RoutingError, "Not Found" unless result @@ -64,10 +66,6 @@ def selected_root_taxonomy end end - def count_calculator(taxonomy_id) - Decidim::Accountability::ResultsCalculator.new(current_component, taxonomy_id).count - end - def add_parent_breadcrumb_item return {} if result&.parent.blank? diff --git a/decidim-accountability/app/helpers/decidim/accountability/breadcrumb_helper.rb b/decidim-accountability/app/helpers/decidim/accountability/breadcrumb_helper.rb index 215d9c96c4bf7..fd4d16afec83a 100644 --- a/decidim-accountability/app/helpers/decidim/accountability/breadcrumb_helper.rb +++ b/decidim-accountability/app/helpers/decidim/accountability/breadcrumb_helper.rb @@ -5,10 +5,6 @@ module Accountability # Helpers needed to render the navigation breadcrumbs in results. # module BreadcrumbHelper - def progress_calculator(taxonomy_id) - Decidim::Accountability::ResultsCalculator.new(current_component, taxonomy_id).progress - end - def taxonomy return if (taxonomy_id = params.dig(:filter, :taxonomies_part_of_contains)).blank? diff --git a/decidim-accountability/app/helpers/decidim/accountability/calculator_helper.rb b/decidim-accountability/app/helpers/decidim/accountability/calculator_helper.rb new file mode 100644 index 0000000000000..7e99b8764dfab --- /dev/null +++ b/decidim-accountability/app/helpers/decidim/accountability/calculator_helper.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Decidim + module Accountability + # Helpers for calculating results progress and count + module CalculatorHelper + def progress_calculator(taxonomy_id) + ResultsCalculator.new(current_component, taxonomy_id).progress + end + + def count_calculator(taxonomy_id) + ResultsCalculator.new(current_component, taxonomy_id).count + end + end + end +end diff --git a/decidim-accountability/app/mailers/decidim/accountability/import_projects_mailer.rb b/decidim-accountability/app/mailers/decidim/accountability/import_projects_mailer.rb index 444c8dffbc9e2..b070e2347f39b 100644 --- a/decidim-accountability/app/mailers/decidim/accountability/import_projects_mailer.rb +++ b/decidim-accountability/app/mailers/decidim/accountability/import_projects_mailer.rb @@ -6,6 +6,7 @@ module Accountability # projects from one budget component to accountability. class ImportProjectsMailer < Decidim::ApplicationMailer include Decidim::TranslatableAttributes + helper Decidim::TranslationsHelper # Public: Sends a notification email with the result of importing projects diff --git a/decidim-accountability/app/mailers/decidim/accountability/import_proposals_mailer.rb b/decidim-accountability/app/mailers/decidim/accountability/import_proposals_mailer.rb index 1b301987ccae7..2e52d41417f0b 100644 --- a/decidim-accountability/app/mailers/decidim/accountability/import_proposals_mailer.rb +++ b/decidim-accountability/app/mailers/decidim/accountability/import_proposals_mailer.rb @@ -6,6 +6,7 @@ module Accountability # proposals to the results. class ImportProposalsMailer < Decidim::ApplicationMailer include Decidim::TranslatableAttributes + helper Decidim::TranslationsHelper # Public: Sends a notification email with the result of proposals import selected proposals to Accountability diff --git a/decidim-accountability/lib/decidim/accountability/component.rb b/decidim-accountability/lib/decidim/accountability/component.rb index 92f3dc36949bd..0f6564f3b04d4 100644 --- a/decidim-accountability/lib/decidim/accountability/component.rb +++ b/decidim-accountability/lib/decidim/accountability/component.rb @@ -14,14 +14,12 @@ component.on(:publish) do |instance| Decidim::Accountability::Result.where(component: instance).find_each do |result| Decidim::UpdateSearchIndexesJob.perform_later([result]) - Decidim::UpdateSearchIndexesJob.perform_later(result.children.to_a) end end component.on(:unpublish) do |instance| Decidim::Accountability::Result.where(component: instance).find_each do |result| Decidim::RemoveSearchIndexesJob.perform_later([result]) - Decidim::UpdateSearchIndexesJob.perform_later(result.children.to_a) end end diff --git a/decidim-accountability/spec/cells/decidim/accountability/status_cell_spec.rb b/decidim-accountability/spec/cells/decidim/accountability/status_cell_spec.rb new file mode 100644 index 0000000000000..192dbcb724330 --- /dev/null +++ b/decidim-accountability/spec/cells/decidim/accountability/status_cell_spec.rb @@ -0,0 +1,95 @@ +# frozen_string_literal: true + +require "spec_helper" + +module Decidim::Accountability + describe StatusCell, type: :cell do + controller Decidim::Accountability::ResultsController + + let!(:component) { create(:accountability_component) } + let!(:taxonomy) { create(:taxonomy, :with_parent, organization: component.organization) } + let!(:result) { create(:result, component:, progress: 50) } + let(:component_settings) { double(display_progress_enabled?: true) } + + def status_cell(model, options = {}) + cell("decidim/accountability/status", model, options).tap do |cell| + allow(cell).to receive(:component_settings).and_return(component_settings) + allow(cell).to receive(:current_component).and_return(component) + end + end + + context "when rendering a taxonomy" do + let(:model) { taxonomy } + + context "with results" do + let!(:result) { create(:result, component:, taxonomies: [taxonomy], progress: 75) } + + it "renders the status" do + html = status_cell(taxonomy).call + expect(html).to have_css(".accountability__status") + end + + it "shows the progress" do + html = status_cell(taxonomy).call + expect(html).to have_content("75%") + end + end + + context "with no results" do + it "does not render" do + expect(status_cell(taxonomy).render?).to be false + end + end + end + + context "when rendering a result" do + let(:model) { result } + + it "renders the status" do + html = status_cell(result).call + expect(html).to have_css(".accountability__status") + end + + it "shows the progress from the model" do + html = status_cell(result).call + expect(html).to have_content("50%") + end + end + + context "with custom progress passed via options" do + let(:model) { result } + + it "does not use custom progress when model has progress" do + html = status_cell(result, progress: 80).call + expect(html).to have_content("50%") + expect(html).to have_no_content("80%") + end + end + + context "with custom count passed via options" do + let(:model) { result } + + it "displays the count" do + html = status_cell(result, count: 42).call + expect(html).to have_content("42") + end + end + + context "when render_blank option is true" do + let(:model) { taxonomy } + + it "renders even without results" do + expect(status_cell(taxonomy, render_blank: true).render?).to be true + end + end + + context "when render_count is false" do + let(:model) { result } + + it "does not display the count" do + html = status_cell(result, count: 99, render_count: false).call.to_s + expect(html).not_to include(">99<") + end + end + end +end diff --git a/decidim-accountability/spec/helpers/decidim/accountability/calculator_helper_spec.rb b/decidim-accountability/spec/helpers/decidim/accountability/calculator_helper_spec.rb new file mode 100644 index 0000000000000..80154700c09dc --- /dev/null +++ b/decidim-accountability/spec/helpers/decidim/accountability/calculator_helper_spec.rb @@ -0,0 +1,82 @@ +# frozen_string_literal: true + +require "spec_helper" + +module Decidim::Accountability + describe CalculatorHelper do + let(:participatory_process) { create(:participatory_process, :with_steps) } + let(:current_component) { create(:accountability_component, participatory_space: participatory_process) } + let(:taxonomy) { create(:taxonomy, :with_parent, organization: current_component.organization) } + let(:sub_taxonomy) { create(:taxonomy, parent: taxonomy, organization: current_component.organization) } + + let!(:result1) do + create( + :result, + component: current_component, + taxonomies: [taxonomy], + parent: nil, + progress: 40 + ) + end + let!(:result2) do + create( + :result, + component: current_component, + taxonomies: [taxonomy, sub_taxonomy], + parent: nil, + progress: 20 + ) + end + let!(:result3) do + create( + :result, + component: current_component, + taxonomies: [sub_taxonomy], + parent: nil, + progress: nil + ) + end + let!(:result4) do + create( + :result, + component: current_component, + parent: nil, + progress: 50 + ) + end + + before do + allow(helper).to receive(:current_component).and_return(current_component) + end + + describe "#progress_calculator" do + it "calculates the average progress for all results when no taxonomy_id is given" do + expect(helper.progress_calculator(nil)).to eq(27.5) + end + + it "calculates the average progress for a specific taxonomy (including children)" do + expect(helper.progress_calculator(taxonomy.id)).to eq(20) + end + + it "handles taxonomy with no results gracefully" do + other_taxonomy = create(:taxonomy, organization: current_component.organization) + expect(helper.progress_calculator(other_taxonomy.id)).to be_nil + end + end + + describe "#count_calculator" do + it "counts all results when no taxonomy_id is given" do + expect(helper.count_calculator(nil)).to eq(4) + end + + it "counts results for a specific taxonomy (including children)" do + expect(helper.count_calculator(taxonomy.id)).to eq(3) + end + + it "handles taxonomy with no results" do + other_taxonomy = create(:taxonomy, organization: current_component.organization) + expect(helper.count_calculator(other_taxonomy.id)).to eq(0) + end + end + end +end diff --git a/decidim-accountability/spec/system/admin/admin_manages_component_publication_spec.rb b/decidim-accountability/spec/system/admin/admin_manages_component_publication_spec.rb new file mode 100644 index 0000000000000..101cd561bc080 --- /dev/null +++ b/decidim-accountability/spec/system/admin/admin_manages_component_publication_spec.rb @@ -0,0 +1,52 @@ +# frozen_string_literal: true + +require "spec_helper" + +describe "Admin manages component publication" do + include_context "when managing a component as an admin" do + context "when there are no children" do + let!(:resource) { create(:result, component:) } + + context "when cycling through publication states" do + let!(:component) { create(:accountability_component, participatory_space:) } + + include_examples "cycling through publication states" + end + + context "when component is unpublished, and admin publishes" do + let!(:component) { create(:accountability_component, :unpublished, participatory_space:) } + + include_examples "add component resources to search index" + end + + context "when component is published, and admin unpublishes" do + let!(:component) { create(:accountability_component, :published, participatory_space:) } + + include_examples "removes component resources from search index" + end + end + + context "when there are children" do + let!(:resource) { create(:result, component:) } + let!(:children) { create(:result, component:, parent: resource) } + + context "when cycling through publication states" do + let!(:component) { create(:accountability_component, participatory_space:) } + + include_examples "cycling through publication states" + end + + context "when component is unpublished, and admin publishes" do + let!(:component) { create(:accountability_component, :unpublished, participatory_space:) } + + include_examples "add component resources to search index" + end + + context "when component is published, and admin unpublishes" do + let!(:component) { create(:accountability_component, :published, participatory_space:) } + + include_examples "removes component resources from search index" + end + end + end +end diff --git a/decidim-accountability/spec/system/admin/admin_publishes_component_spec.rb b/decidim-accountability/spec/system/admin/admin_publishes_component_spec.rb deleted file mode 100644 index df961d66c13d1..0000000000000 --- a/decidim-accountability/spec/system/admin/admin_publishes_component_spec.rb +++ /dev/null @@ -1,11 +0,0 @@ -# frozen_string_literal: true - -require "spec_helper" - -describe "Admin publishes component" do - let(:manifest_name) { "accountability" } - let!(:resource) { create(:result, component:) } - - include_context "when publishing and unpublishing the component" - include_context "when cycling through publication states" -end diff --git a/decidim-admin/app/cells/decidim/admin/content_block/show.erb b/decidim-admin/app/cells/decidim/admin/content_block/show.erb index 33489bbad5023..180f89352c6b0 100644 --- a/decidim-admin/app/cells/decidim/admin/content_block/show.erb +++ b/decidim-admin/app/cells/decidim/admin/content_block/show.erb @@ -12,7 +12,7 @@ <%= icon "delete-bin-line", role: "img", "aria-hidden": true %> <% end %> <% end %> - <%= icon "menu-line", role: "img", "aria-hidden": true %> + <%= icon("draggable", class: "dragger hover:cursor-grab") %> diff --git a/decidim-admin/app/commands/decidim/admin/content_blocks/reorder_content_blocks.rb b/decidim-admin/app/commands/decidim/admin/content_blocks/reorder_content_blocks.rb index f61eb5f570c13..6036f63b5ef6a 100644 --- a/decidim-admin/app/commands/decidim/admin/content_blocks/reorder_content_blocks.rb +++ b/decidim-admin/app/commands/decidim/admin/content_blocks/reorder_content_blocks.rb @@ -59,7 +59,7 @@ def set_new_weights data.each do |id, weight| content_block = collection.find_by(id:) - content_block.update!(weight:) if content_block.present? + (content_block.presence&.update!(weight:)) end end diff --git a/decidim-admin/app/commands/decidim/admin/participatory_space/create_member.rb b/decidim-admin/app/commands/decidim/admin/participatory_space/create_member.rb index 32ad418fa1f7f..8e62d3c06e215 100644 --- a/decidim-admin/app/commands/decidim/admin/participatory_space/create_member.rb +++ b/decidim-admin/app/commands/decidim/admin/participatory_space/create_member.rb @@ -52,12 +52,11 @@ def create_member title: user.name } ) do - Decidim::ParticipatorySpace::Member.find_or_create_by!( - user:, - participatory_space: @member_to, - role: form.role, - published: form.published - ) + member = Decidim::ParticipatorySpace::Member.where(user:, participatory_space: @member_to).first_or_initialize + member.role = form.role + member.published = form.published + member.save! + member end end diff --git a/decidim-admin/app/commands/decidim/admin/reorder_components.rb b/decidim-admin/app/commands/decidim/admin/reorder_components.rb index b15816194a560..abbf08ce77b32 100644 --- a/decidim-admin/app/commands/decidim/admin/reorder_components.rb +++ b/decidim-admin/app/commands/decidim/admin/reorder_components.rb @@ -38,7 +38,7 @@ def reorder_components transaction do order.each_with_index do |id, index| component = components.find_by(id:) - component.update!(weight: index + 1) if component.present? + (component.presence&.update!(weight: index + 1)) end end end diff --git a/decidim-admin/app/commands/decidim/admin/reorder_taxonomies.rb b/decidim-admin/app/commands/decidim/admin/reorder_taxonomies.rb index 9a4d0fdd5ce6b..b86e4eb113176 100644 --- a/decidim-admin/app/commands/decidim/admin/reorder_taxonomies.rb +++ b/decidim-admin/app/commands/decidim/admin/reorder_taxonomies.rb @@ -54,7 +54,7 @@ def set_new_weights data.each do |id, weight| item = collection.find_by(id:) - item.update!(weight:) if item.present? + (item.presence&.update!(weight:)) end end diff --git a/decidim-admin/app/controllers/concerns/decidim/admin/content_blocks/landing_page.rb b/decidim-admin/app/controllers/concerns/decidim/admin/content_blocks/landing_page.rb index ca2606884bf47..4ef394de1ba6d 100644 --- a/decidim-admin/app/controllers/concerns/decidim/admin/content_blocks/landing_page.rb +++ b/decidim-admin/app/controllers/concerns/decidim/admin/content_blocks/landing_page.rb @@ -5,6 +5,7 @@ module Admin module ContentBlocks module LandingPage extend ActiveSupport::Concern + included do helper_method :active_blocks, :active_content_blocks_title, :add_content_block_text, :available_manifests, :content_block_destroy_confirmation_text, :content_blocks_title, :inactive_blocks, diff --git a/decidim-admin/app/controllers/concerns/decidim/admin/content_blocks/landing_page_content_blocks.rb b/decidim-admin/app/controllers/concerns/decidim/admin/content_blocks/landing_page_content_blocks.rb index 442455b728e78..bc5d5feecd4db 100644 --- a/decidim-admin/app/controllers/concerns/decidim/admin/content_blocks/landing_page_content_blocks.rb +++ b/decidim-admin/app/controllers/concerns/decidim/admin/content_blocks/landing_page_content_blocks.rb @@ -5,6 +5,7 @@ module Admin module ContentBlocks module LandingPageContentBlocks extend ActiveSupport::Concern + included do helper_method :content_block, :resource_landing_page_content_block_path, :scoped_resource, :submit_button_text @@ -55,7 +56,7 @@ def update redirect_to edit_resource_landing_page_path end on(:invalid) do - render "decidim/admin/shared/landing_page_content_blocks/edit", status: :unprocessable_entity + render "decidim/admin/shared/landing_page_content_blocks/edit", status: :unprocessable_content end end end diff --git a/decidim-admin/app/controllers/concerns/decidim/admin/filterable.rb b/decidim-admin/app/controllers/concerns/decidim/admin/filterable.rb index 0a6efac8893d5..6061e771fc266 100644 --- a/decidim-admin/app/controllers/concerns/decidim/admin/filterable.rb +++ b/decidim-admin/app/controllers/concerns/decidim/admin/filterable.rb @@ -77,7 +77,7 @@ def session_filtered_collection # the query def adjacent_items(item) query = - <<-SQL.squish + <<~SQL.squish WITH collection AS (#{session_filtered_collection.select(:id).to_sql}), successors AS ( @@ -198,8 +198,8 @@ def taxonomy_ids_hash(taxonomies) filtered_taxonomies = taxonomies.roots.or(taxonomies.where(id: available_taxonomy_ids)) return nil if filtered_taxonomies.blank? - filtered_taxonomies.each_with_object({}) do |taxonomy, hash| - hash[taxonomy.id] = taxonomy_ids_hash(taxonomy.children) + filtered_taxonomies.to_h do |taxonomy| + [taxonomy.id, taxonomy_ids_hash(taxonomy.children)] end end diff --git a/decidim-admin/app/controllers/concerns/decidim/admin/participatory_space_admin_context.rb b/decidim-admin/app/controllers/concerns/decidim/admin/participatory_space_admin_context.rb index 330814cd27dad..b29432c6087f3 100644 --- a/decidim-admin/app/controllers/concerns/decidim/admin/participatory_space_admin_context.rb +++ b/decidim-admin/app/controllers/concerns/decidim/admin/participatory_space_admin_context.rb @@ -25,6 +25,7 @@ def participatory_space_admin_layout(options = {}) included do include Decidim::NeedsOrganization include Decidim::Admin::ParticipatorySpaceAdminBreadcrumb + helper ParticipatorySpaceHelpers helper_method :current_participatory_space diff --git a/decidim-admin/app/controllers/concerns/decidim/admin/participatory_space_export.rb b/decidim-admin/app/controllers/concerns/decidim/admin/participatory_space_export.rb index 00d40c785bd59..eb4f2fa227446 100644 --- a/decidim-admin/app/controllers/concerns/decidim/admin/participatory_space_export.rb +++ b/decidim-admin/app/controllers/concerns/decidim/admin/participatory_space_export.rb @@ -17,7 +17,7 @@ def create flash[:notice] = t("decidim.admin.exports.notice") - redirect_back(fallback_location: after_export_path) + redirect_back_or_to(after_export_path) end # Public: To be implemented at the controller. You need to diff --git a/decidim-admin/app/controllers/decidim/admin/area_types_controller.rb b/decidim-admin/app/controllers/decidim/admin/area_types_controller.rb index 58e292449eddd..236cf11ee5caa 100644 --- a/decidim-admin/app/controllers/decidim/admin/area_types_controller.rb +++ b/decidim-admin/app/controllers/decidim/admin/area_types_controller.rb @@ -34,7 +34,7 @@ def create on(:invalid) do flash.now[:alert] = I18n.t("area_types.create.error", scope: "decidim.admin") - render :new, status: :unprocessable_entity + render :new, status: :unprocessable_content end end end @@ -56,7 +56,7 @@ def update on(:invalid) do flash.now[:alert] = I18n.t("area_types.update.error", scope: "decidim.admin") - render :edit, status: :unprocessable_entity + render :edit, status: :unprocessable_content end end end diff --git a/decidim-admin/app/controllers/decidim/admin/areas_controller.rb b/decidim-admin/app/controllers/decidim/admin/areas_controller.rb index 633128e18fc6b..d5c9b09891126 100644 --- a/decidim-admin/app/controllers/decidim/admin/areas_controller.rb +++ b/decidim-admin/app/controllers/decidim/admin/areas_controller.rb @@ -6,6 +6,7 @@ module Admin # class AreasController < Decidim::Admin::ApplicationController include Decidim::Admin::Concerns::HasTabbedMenu + helper Decidim::Admin::AreasHelper layout "decidim/admin/settings" @@ -35,7 +36,7 @@ def create on(:invalid) do flash.now[:alert] = I18n.t("areas.create.error", scope: "decidim.admin") - render :new, status: :unprocessable_entity + render :new, status: :unprocessable_content end end end @@ -57,7 +58,7 @@ def update on(:invalid) do flash.now[:alert] = I18n.t("areas.update.error", scope: "decidim.admin") - render :edit, status: :unprocessable_entity + render :edit, status: :unprocessable_content end end end diff --git a/decidim-admin/app/controllers/decidim/admin/block_user_controller.rb b/decidim-admin/app/controllers/decidim/admin/block_user_controller.rb index 4cc2cf264069e..ccc9825a8ec85 100644 --- a/decidim-admin/app/controllers/decidim/admin/block_user_controller.rb +++ b/decidim-admin/app/controllers/decidim/admin/block_user_controller.rb @@ -27,7 +27,7 @@ def create on(:invalid) do flash[:alert] = I18n.t("officializations.block.error", scope: "decidim.admin") - render :new, status: :unprocessable_entity + render :new, status: :unprocessable_content end end end @@ -65,7 +65,7 @@ def bulk_create on(:invalid) do flash.now[:alert] = I18n.t("officializations.bulk_action.block.invalid", scope: "decidim.admin") - render :bulk_new, status: :unprocessable_entity + render :bulk_new, status: :unprocessable_content end end end diff --git a/decidim-admin/app/controllers/decidim/admin/component_permissions_controller.rb b/decidim-admin/app/controllers/decidim/admin/component_permissions_controller.rb index 5b795d9531d56..5a32bf3a4ce45 100644 --- a/decidim-admin/app/controllers/decidim/admin/component_permissions_controller.rb +++ b/decidim-admin/app/controllers/decidim/admin/component_permissions_controller.rb @@ -26,7 +26,7 @@ def update on(:invalid) do flash.now[:alert] = t("component_permissions.update.error", scope: "decidim.admin") - render action: :edit, status: :unprocessable_entity + render action: :edit, status: :unprocessable_content end end end diff --git a/decidim-admin/app/controllers/decidim/admin/components/base_controller.rb b/decidim-admin/app/controllers/decidim/admin/components/base_controller.rb index f2dd0a5b924ad..956bc922c6223 100644 --- a/decidim-admin/app/controllers/decidim/admin/components/base_controller.rb +++ b/decidim-admin/app/controllers/decidim/admin/components/base_controller.rb @@ -10,6 +10,7 @@ class BaseController < Decidim::Admin::ApplicationController include Decidim::Admin::ParticipatorySpaceAdminContext include Decidim::NeedsPermission + participatory_space_admin_layout helper Decidim::ResourceHelper diff --git a/decidim-admin/app/controllers/decidim/admin/components_controller.rb b/decidim-admin/app/controllers/decidim/admin/components_controller.rb index a25e5e55d0b26..87acf4df5ec4a 100644 --- a/decidim-admin/app/controllers/decidim/admin/components_controller.rb +++ b/decidim-admin/app/controllers/decidim/admin/components_controller.rb @@ -7,6 +7,7 @@ module Admin # class ComponentsController < Decidim::Admin::ApplicationController include Decidim::Admin::HasTrashableResources + helper_method :manifest def index @@ -47,7 +48,7 @@ def create on(:invalid) do flash.now[:alert] = I18n.t("components.create.error", scope: "decidim.admin") - render action: "new", status: :unprocessable_entity + render action: "new", status: :unprocessable_content end end end @@ -74,7 +75,7 @@ def update on(:invalid) do flash[:alert] = I18n.t("components.update.error", scope: "decidim.admin") - render action: :edit, status: :unprocessable_entity + render action: :edit, status: :unprocessable_content end end end diff --git a/decidim-admin/app/controllers/decidim/admin/concerns/has_attachment_collections.rb b/decidim-admin/app/controllers/decidim/admin/concerns/has_attachment_collections.rb index 9fcb4f605ece9..5c194971506ce 100644 --- a/decidim-admin/app/controllers/decidim/admin/concerns/has_attachment_collections.rb +++ b/decidim-admin/app/controllers/decidim/admin/concerns/has_attachment_collections.rb @@ -39,7 +39,7 @@ def create on(:invalid) do flash.now[:alert] = I18n.t("attachment_collections.create.error", scope: "decidim.admin") - render template: "decidim/admin/attachment_collections/new", status: :unprocessable_entity + render template: "decidim/admin/attachment_collections/new", status: :unprocessable_content end end end @@ -64,7 +64,7 @@ def update on(:invalid) do flash.now[:alert] = I18n.t("attachment_collections.update.error", scope: "decidim.admin") - render template: "decidim/admin/attachment_collections/edit", status: :unprocessable_entity + render template: "decidim/admin/attachment_collections/edit", status: :unprocessable_content end end end diff --git a/decidim-admin/app/controllers/decidim/admin/concerns/has_attachments.rb b/decidim-admin/app/controllers/decidim/admin/concerns/has_attachments.rb index 09e6258cd5cff..27170ed202fb9 100644 --- a/decidim-admin/app/controllers/decidim/admin/concerns/has_attachments.rb +++ b/decidim-admin/app/controllers/decidim/admin/concerns/has_attachments.rb @@ -39,7 +39,7 @@ def create on(:invalid) do flash.now[:alert] = I18n.t("attachments.create.error", scope: "decidim.admin") - render template: "decidim/admin/attachments/new", status: :unprocessable_entity + render template: "decidim/admin/attachments/new", status: :unprocessable_content end end end @@ -64,7 +64,7 @@ def update on(:invalid) do flash.now[:alert] = I18n.t("attachments.update.error", scope: "decidim.admin") - render template: "decidim/admin/attachments/edit", status: :unprocessable_entity + render template: "decidim/admin/attachments/edit", status: :unprocessable_content end end end diff --git a/decidim-admin/app/controllers/decidim/admin/conflicts_controller.rb b/decidim-admin/app/controllers/decidim/admin/conflicts_controller.rb index df31593a8fa03..d29163c060bff 100644 --- a/decidim-admin/app/controllers/decidim/admin/conflicts_controller.rb +++ b/decidim-admin/app/controllers/decidim/admin/conflicts_controller.rb @@ -47,7 +47,7 @@ def update on(:invalid) do flash.now[:alert] = I18n.t("error", scope: "decidim.admin.conflicts.transfer") - render action: "edit", status: :unprocessable_entity + render action: "edit", status: :unprocessable_content end end end diff --git a/decidim-admin/app/controllers/decidim/admin/exports_controller.rb b/decidim-admin/app/controllers/decidim/admin/exports_controller.rb index f2ee8459aaad8..7bac95186c120 100644 --- a/decidim-admin/app/controllers/decidim/admin/exports_controller.rb +++ b/decidim-admin/app/controllers/decidim/admin/exports_controller.rb @@ -15,7 +15,7 @@ def create flash[:notice] = t("decidim.admin.exports.notice") - redirect_back(fallback_location: manage_component_path(component)) + redirect_back_or_to(manage_component_path(component)) end private diff --git a/decidim-admin/app/controllers/decidim/admin/impersonations_controller.rb b/decidim-admin/app/controllers/decidim/admin/impersonations_controller.rb index 1e652ec6d8a09..f973704e1d324 100644 --- a/decidim-admin/app/controllers/decidim/admin/impersonations_controller.rb +++ b/decidim-admin/app/controllers/decidim/admin/impersonations_controller.rb @@ -46,7 +46,7 @@ def create on(:invalid) do flash.now[:alert] = I18n.t("impersonations.create.error", scope: "decidim.admin") - render :new, status: :unprocessable_entity + render :new, status: :unprocessable_content end end end diff --git a/decidim-admin/app/controllers/decidim/admin/imports_controller.rb b/decidim-admin/app/controllers/decidim/admin/imports_controller.rb index 1bf139e13f007..fd1a96317f7e5 100644 --- a/decidim-admin/app/controllers/decidim/admin/imports_controller.rb +++ b/decidim-admin/app/controllers/decidim/admin/imports_controller.rb @@ -5,6 +5,7 @@ module Admin # This controller allows admins to import resources from a file. class ImportsController < Decidim::Admin::ApplicationController include Decidim::ComponentPathHelper + before_action :set_import_breadcrumb_item helper_method :import_manifest @@ -39,7 +40,7 @@ def create on(:invalid) do flash.now[:alert] = t("decidim.admin.imports.error") - render :new, status: :unprocessable_entity + render :new, status: :unprocessable_content end end end diff --git a/decidim-admin/app/controllers/decidim/admin/managed_users/promotions_controller.rb b/decidim-admin/app/controllers/decidim/admin/managed_users/promotions_controller.rb index 822d147855d4f..a1dd1e6ccbda3 100644 --- a/decidim-admin/app/controllers/decidim/admin/managed_users/promotions_controller.rb +++ b/decidim-admin/app/controllers/decidim/admin/managed_users/promotions_controller.rb @@ -25,7 +25,7 @@ def create on(:invalid) do flash.now[:alert] = I18n.t("managed_users.promotion.error", scope: "decidim.admin") - render :new, status: :unprocessable_entity + render :new, status: :unprocessable_content end end end diff --git a/decidim-admin/app/controllers/decidim/admin/newsletters_controller.rb b/decidim-admin/app/controllers/decidim/admin/newsletters_controller.rb index 2112c9528b1dc..95b84382b8968 100644 --- a/decidim-admin/app/controllers/decidim/admin/newsletters_controller.rb +++ b/decidim-admin/app/controllers/decidim/admin/newsletters_controller.rb @@ -7,6 +7,7 @@ class NewslettersController < Decidim::Admin::ApplicationController include Decidim::NewslettersHelper include Decidim::Admin::NewslettersHelper include Paginable + helper_method :newsletter, :recipients_count_query, :content_block, :selected_options, :newsletter_params def index @@ -31,7 +32,7 @@ def send_to_user NewsletterMailer.newsletter(current_user, newsletter).deliver_later flash[:notice] = I18n.t("newsletters.send_to_user.sent_successfully", scope: "decidim.admin", email: current_user.email) - redirect_back fallback_location: newsletters_path + redirect_back_or_to(newsletters_path) end def preview @@ -56,7 +57,7 @@ def create on(:invalid) do |newsletter| @newsletter = newsletter flash.now[:error] = I18n.t("newsletters.create.error", scope: "decidim.admin") - render action: :new, status: :unprocessable_entity + render action: :new, status: :unprocessable_content end end end @@ -80,7 +81,7 @@ def update on(:invalid) do |newsletter| @newsletter = newsletter flash.now[:error] = I18n.t("newsletters.update.error", scope: "decidim.admin") - render action: :edit, status: :unprocessable_entity + render action: :edit, status: :unprocessable_content end end end @@ -128,12 +129,12 @@ def deliver on(:invalid) do flash.now[:error] = I18n.t("newsletters.deliver.error", scope: "decidim.admin") - render action: :select_recipients_to_deliver, status: :unprocessable_entity + render action: :select_recipients_to_deliver, status: :unprocessable_content end on(:no_recipients) do flash.now[:error] = I18n.t("newsletters.send.no_recipients", scope: "decidim.admin") - render action: :select_recipients_to_deliver, status: :unprocessable_entity + render action: :select_recipients_to_deliver, status: :unprocessable_content end end end diff --git a/decidim-admin/app/controllers/decidim/admin/organization_appearance_controller.rb b/decidim-admin/app/controllers/decidim/admin/organization_appearance_controller.rb index 79f2adcf8d852..acaf3f53b2280 100644 --- a/decidim-admin/app/controllers/decidim/admin/organization_appearance_controller.rb +++ b/decidim-admin/app/controllers/decidim/admin/organization_appearance_controller.rb @@ -25,7 +25,7 @@ def update on(:invalid) do flash.now[:alert] = I18n.t("organization.update.error", scope: "decidim.admin") - render :edit, status: :unprocessable_entity + render :edit, status: :unprocessable_content end end end diff --git a/decidim-admin/app/controllers/decidim/admin/organization_controller.rb b/decidim-admin/app/controllers/decidim/admin/organization_controller.rb index c49e5edcca701..217f3b2963f7d 100644 --- a/decidim-admin/app/controllers/decidim/admin/organization_controller.rb +++ b/decidim-admin/app/controllers/decidim/admin/organization_controller.rb @@ -29,7 +29,7 @@ def update on(:invalid) do flash.now[:alert] = I18n.t("organization.update.error", scope: "decidim.admin") - render :edit, status: :unprocessable_entity + render :edit, status: :unprocessable_content end end end diff --git a/decidim-admin/app/controllers/decidim/admin/organization_external_domain_allowlist_controller.rb b/decidim-admin/app/controllers/decidim/admin/organization_external_domain_allowlist_controller.rb index d986fbb8f6f5f..fb8c7eabf59ae 100644 --- a/decidim-admin/app/controllers/decidim/admin/organization_external_domain_allowlist_controller.rb +++ b/decidim-admin/app/controllers/decidim/admin/organization_external_domain_allowlist_controller.rb @@ -25,7 +25,7 @@ def update end on(:invalid) do flash[:notice] = t("domain_allowlist.update.error", scope: "decidim.admin") - render action: "edit", status: :unprocessable_entity + render action: "edit", status: :unprocessable_content end end end diff --git a/decidim-admin/app/controllers/decidim/admin/participatory_space/concerns/has_members.rb b/decidim-admin/app/controllers/decidim/admin/participatory_space/concerns/has_members.rb index 4d0e713998dd4..c3ddbe8234f9b 100644 --- a/decidim-admin/app/controllers/decidim/admin/participatory_space/concerns/has_members.rb +++ b/decidim-admin/app/controllers/decidim/admin/participatory_space/concerns/has_members.rb @@ -15,6 +15,7 @@ module HasMembers included do include Decidim::Admin::ParticipatorySpace::Concerns::MembersFilterable + helper PaginateHelper helper_method :members @@ -52,7 +53,7 @@ def update on(:invalid) do flash.now[:alert] = I18n.t("members.update.error", scope: "decidim.admin") - render template: "decidim/admin/members/edit", status: :unprocessable_entity + render template: "decidim/admin/members/edit", status: :unprocessable_content end end end @@ -69,7 +70,7 @@ def create on(:invalid) do flash.now[:alert] = I18n.t("members.create.error", scope: "decidim.admin") - render template: "decidim/admin/members/new", status: :unprocessable_entity + render template: "decidim/admin/members/new", status: :unprocessable_content end end end @@ -85,7 +86,7 @@ def destroy on(:invalid) do flash.now[:alert] = I18n.t("members.destroy.error", scope: "decidim.admin") - render template: "decidim/admin/members/index", status: :unprocessable_entity + render template: "decidim/admin/members/index", status: :unprocessable_content end end end diff --git a/decidim-admin/app/controllers/decidim/admin/participatory_space/concerns/has_members_csv_import.rb b/decidim-admin/app/controllers/decidim/admin/participatory_space/concerns/has_members_csv_import.rb index f8e2e45f0bdb5..ac30472cabccf 100644 --- a/decidim-admin/app/controllers/decidim/admin/participatory_space/concerns/has_members_csv_import.rb +++ b/decidim-admin/app/controllers/decidim/admin/participatory_space/concerns/has_members_csv_import.rb @@ -35,7 +35,7 @@ def create on(:invalid) do flash[:alert] = I18n.t("members_csv_imports.create.invalid", scope: "decidim.admin") - render template: "decidim/admin/members_csv_imports/new", status: :unprocessable_entity + render template: "decidim/admin/members_csv_imports/new", status: :unprocessable_content end end end diff --git a/decidim-admin/app/controllers/decidim/admin/participatory_space/user_role_controller.rb b/decidim-admin/app/controllers/decidim/admin/participatory_space/user_role_controller.rb index 2f0f0d368e06b..cf88119cc0db3 100644 --- a/decidim-admin/app/controllers/decidim/admin/participatory_space/user_role_controller.rb +++ b/decidim-admin/app/controllers/decidim/admin/participatory_space/user_role_controller.rb @@ -38,7 +38,7 @@ def create on(:invalid) do flash[:alert] = I18n.t("create.error", scope: i18n_scope) - render :new, status: :unprocessable_entity + render :new, status: :unprocessable_content end end end @@ -56,7 +56,7 @@ def update on(:invalid) do flash.now[:alert] = I18n.t("update.error", scope: i18n_scope) - render :edit, status: :unprocessable_entity + render :edit, status: :unprocessable_content end end end diff --git a/decidim-admin/app/controllers/decidim/admin/reminders_controller.rb b/decidim-admin/app/controllers/decidim/admin/reminders_controller.rb index d6ef2f64d413e..621eac3f42f73 100644 --- a/decidim-admin/app/controllers/decidim/admin/reminders_controller.rb +++ b/decidim-admin/app/controllers/decidim/admin/reminders_controller.rb @@ -27,7 +27,7 @@ def create on(:invalid) do flash.now[:alert] = t("decidim.admin.reminders.create.error") - render :new, status: :unprocessable_entity + render :new, status: :unprocessable_content end end end diff --git a/decidim-admin/app/controllers/decidim/admin/resource_permissions_controller.rb b/decidim-admin/app/controllers/decidim/admin/resource_permissions_controller.rb index 4c7c876082d3f..21da15bb3aa09 100644 --- a/decidim-admin/app/controllers/decidim/admin/resource_permissions_controller.rb +++ b/decidim-admin/app/controllers/decidim/admin/resource_permissions_controller.rb @@ -25,7 +25,7 @@ def update end on(:invalid) do - render action: :edit, status: :unprocessable_entity + render action: :edit, status: :unprocessable_content end end end diff --git a/decidim-admin/app/controllers/decidim/admin/scope_types_controller.rb b/decidim-admin/app/controllers/decidim/admin/scope_types_controller.rb index 8ad8270a73dae..6d4f17c3c5d89 100644 --- a/decidim-admin/app/controllers/decidim/admin/scope_types_controller.rb +++ b/decidim-admin/app/controllers/decidim/admin/scope_types_controller.rb @@ -34,7 +34,7 @@ def create on(:invalid) do flash.now[:alert] = I18n.t("scope_types.create.error", scope: "decidim.admin") - render :new, status: :unprocessable_entity + render :new, status: :unprocessable_content end end end @@ -56,7 +56,7 @@ def update on(:invalid) do flash.now[:alert] = I18n.t("scope_types.update.error", scope: "decidim.admin") - render :edit, status: :unprocessable_entity + render :edit, status: :unprocessable_content end end end diff --git a/decidim-admin/app/controllers/decidim/admin/scopes_controller.rb b/decidim-admin/app/controllers/decidim/admin/scopes_controller.rb index 635a3f5a0cf9b..efbfa38744a6b 100644 --- a/decidim-admin/app/controllers/decidim/admin/scopes_controller.rb +++ b/decidim-admin/app/controllers/decidim/admin/scopes_controller.rb @@ -6,6 +6,7 @@ module Admin # class ScopesController < Decidim::Admin::ApplicationController include Decidim::Admin::Concerns::HasTabbedMenu + helper Decidim::Admin::ScopesHelper layout "decidim/admin/settings" @@ -36,7 +37,7 @@ def create on(:invalid) do flash.now[:alert] = I18n.t("scopes.create.error", scope: "decidim.admin") - render :new, status: :unprocessable_entity + render :new, status: :unprocessable_content end end end @@ -58,7 +59,7 @@ def update on(:invalid) do flash.now[:alert] = I18n.t("scopes.update.error", scope: "decidim.admin") - render :edit, status: :unprocessable_entity + render :edit, status: :unprocessable_content end end end diff --git a/decidim-admin/app/controllers/decidim/admin/share_tokens_controller.rb b/decidim-admin/app/controllers/decidim/admin/share_tokens_controller.rb index 8f3b8c4b2d990..e2f152a259094 100644 --- a/decidim-admin/app/controllers/decidim/admin/share_tokens_controller.rb +++ b/decidim-admin/app/controllers/decidim/admin/share_tokens_controller.rb @@ -31,7 +31,7 @@ def create on(:invalid) do flash.now[:alert] = I18n.t("share_tokens.create.invalid", scope: "decidim.admin") - render action: "new", status: :unprocessable_entity + render action: "new", status: :unprocessable_content end end end @@ -53,7 +53,7 @@ def update on(:invalid) do flash.now[:alert] = I18n.t("share_tokens.update.error", scope: "decidim.admin") - render :edit, status: :unprocessable_entity + render :edit, status: :unprocessable_content end end end diff --git a/decidim-admin/app/controllers/decidim/admin/space_publications_controller.rb b/decidim-admin/app/controllers/decidim/admin/space_publications_controller.rb index eefb3c10e4f8f..6a669affdbd18 100644 --- a/decidim-admin/app/controllers/decidim/admin/space_publications_controller.rb +++ b/decidim-admin/app/controllers/decidim/admin/space_publications_controller.rb @@ -17,7 +17,7 @@ def create flash.now[:alert] = I18n.t("create.error", scope: i18n_scope) end - redirect_back(fallback_location:) + redirect_back_or_to(fallback_location) end end @@ -33,7 +33,7 @@ def destroy flash.now[:alert] = I18n.t("destroy.error", scope: i18n_scope) end - redirect_back(fallback_location:) + redirect_back_or_to(fallback_location) end end diff --git a/decidim-admin/app/controllers/decidim/admin/static_page_topics_controller.rb b/decidim-admin/app/controllers/decidim/admin/static_page_topics_controller.rb index d9b7557864be4..a61a77004f14a 100644 --- a/decidim-admin/app/controllers/decidim/admin/static_page_topics_controller.rb +++ b/decidim-admin/app/controllers/decidim/admin/static_page_topics_controller.rb @@ -30,7 +30,7 @@ def create on(:invalid) do flash.now[:alert] = I18n.t("static_page_topics.create.error", scope: "decidim.admin") - render :new, status: :unprocessable_entity + render :new, status: :unprocessable_content end end end @@ -52,7 +52,7 @@ def update on(:invalid) do flash.now[:alert] = I18n.t("static_page_topics.update.error", scope: "decidim.admin") - render :edit, status: :unprocessable_entity + render :edit, status: :unprocessable_content end end end diff --git a/decidim-admin/app/controllers/decidim/admin/static_pages_controller.rb b/decidim-admin/app/controllers/decidim/admin/static_pages_controller.rb index eac4dca23ebd0..007369100921e 100644 --- a/decidim-admin/app/controllers/decidim/admin/static_pages_controller.rb +++ b/decidim-admin/app/controllers/decidim/admin/static_pages_controller.rb @@ -62,7 +62,7 @@ def create on(:invalid) do flash.now[:alert] = I18n.t("static_pages.create.error", scope: "decidim.admin") - render :new, status: :unprocessable_entity + render :new, status: :unprocessable_content end end end @@ -85,7 +85,7 @@ def update on(:invalid) do flash.now[:alert] = I18n.t("static_pages.update.error", scope: "decidim.admin") - render :edit, status: :unprocessable_entity + render :edit, status: :unprocessable_content end end end diff --git a/decidim-admin/app/controllers/decidim/admin/taxonomies_controller.rb b/decidim-admin/app/controllers/decidim/admin/taxonomies_controller.rb index a4451b9f4dbfc..792847558b8bf 100644 --- a/decidim-admin/app/controllers/decidim/admin/taxonomies_controller.rb +++ b/decidim-admin/app/controllers/decidim/admin/taxonomies_controller.rb @@ -39,7 +39,7 @@ def create on(:invalid) do flash.now[:alert] = I18n.t("create.invalid", scope: "decidim.admin.taxonomies") - render action: "new", status: :unprocessable_entity + render action: "new", status: :unprocessable_content end end end @@ -66,7 +66,7 @@ def update on(:invalid) do flash.now[:alert] = I18n.t("update.invalid", scope: "decidim.admin.taxonomies") - render action: "edit", status: :unprocessable_entity + render action: "edit", status: :unprocessable_content end end end @@ -83,7 +83,7 @@ def destroy flash.now[:alert] = I18n.t("destroy.invalid", scope: "decidim.admin.taxonomies") end end - redirect_back(fallback_location: taxonomies_path) + redirect_back_or_to(taxonomies_path) end def reorder diff --git a/decidim-admin/app/controllers/decidim/admin/taxonomy_filters_controller.rb b/decidim-admin/app/controllers/decidim/admin/taxonomy_filters_controller.rb index b69bf5b09b676..ac4ddb2391ee7 100644 --- a/decidim-admin/app/controllers/decidim/admin/taxonomy_filters_controller.rb +++ b/decidim-admin/app/controllers/decidim/admin/taxonomy_filters_controller.rb @@ -41,7 +41,7 @@ def create on(:invalid) do flash.now[:alert] = I18n.t("create.error", scope: "decidim.admin.taxonomy_filters") - render :new, status: :unprocessable_entity + render :new, status: :unprocessable_content end end end @@ -63,7 +63,7 @@ def update end on(:invalid) do flash.now[:alert] = I18n.t("update.error", scope: "decidim.admin.taxonomy_filters") - render :edit, status: :unprocessable_entity + render :edit, status: :unprocessable_content end end end @@ -78,7 +78,7 @@ def destroy flash[:alert] = I18n.t("destroy.error", scope: "decidim.admin.taxonomy_filters") end end - redirect_back(fallback_location: decidim_admin.taxonomy_filters_path(root_taxonomy)) + redirect_back_or_to(decidim_admin.taxonomy_filters_path(root_taxonomy)) end private diff --git a/decidim-admin/app/controllers/decidim/admin/taxonomy_items_controller.rb b/decidim-admin/app/controllers/decidim/admin/taxonomy_items_controller.rb index 573c71f3bac1d..5696daac07940 100644 --- a/decidim-admin/app/controllers/decidim/admin/taxonomy_items_controller.rb +++ b/decidim-admin/app/controllers/decidim/admin/taxonomy_items_controller.rb @@ -9,7 +9,7 @@ class TaxonomyItemsController < Decidim::Admin::ApplicationController before_action do if taxonomy_item && taxonomy_item.parent_ids.exclude?(taxonomy.id) flash[:alert] = I18n.t("update.invalid", scope: "decidim.admin.taxonomies") - render plain: I18n.t("update.invalid", scope: "decidim.admin.taxonomies"), status: :unprocessable_entity + render plain: I18n.t("update.invalid", scope: "decidim.admin.taxonomies"), status: :unprocessable_content end end @@ -29,7 +29,7 @@ def create on(:invalid) do flash.now[:alert] = I18n.t("create.invalid", scope: "decidim.admin.taxonomies") - render action: "new", status: :unprocessable_entity + render action: "new", status: :unprocessable_content end end end @@ -50,7 +50,7 @@ def update on(:invalid) do flash.now[:alert] = I18n.t("update.invalid", scope: "decidim.admin.taxonomies") - render action: "edit", status: :unprocessable_entity + render action: "edit", status: :unprocessable_content end end end diff --git a/decidim-admin/app/controllers/decidim/admin/users_controller.rb b/decidim-admin/app/controllers/decidim/admin/users_controller.rb index 4146bf6d67137..47d234191024a 100644 --- a/decidim-admin/app/controllers/decidim/admin/users_controller.rb +++ b/decidim-admin/app/controllers/decidim/admin/users_controller.rb @@ -38,7 +38,7 @@ def create on(:invalid) do flash.now[:alert] = I18n.t("users.create.error", scope: "decidim.admin") - render :new, status: :unprocessable_entity + render :new, status: :unprocessable_content end end end diff --git a/decidim-admin/app/forms/decidim/admin/taxonomy_filter_form.rb b/decidim-admin/app/forms/decidim/admin/taxonomy_filter_form.rb index a0eacb5de4632..da3ff1c8ae269 100644 --- a/decidim-admin/app/forms/decidim/admin/taxonomy_filter_form.rb +++ b/decidim-admin/app/forms/decidim/admin/taxonomy_filter_form.rb @@ -5,6 +5,7 @@ module Admin # A form object to create or update areas. class TaxonomyFilterForm < Form include TranslatableAttributes + Item = Struct.new(:name, :value, :children) Manifest = Struct.new(:id, :name) diff --git a/decidim-admin/app/helpers/decidim/admin/settings_helper.rb b/decidim-admin/app/helpers/decidim/admin/settings_helper.rb index fcf8725e2a3ca..076d95d7811c6 100644 --- a/decidim-admin/app/helpers/decidim/admin/settings_helper.rb +++ b/decidim-admin/app/helpers/decidim/admin/settings_helper.rb @@ -108,7 +108,8 @@ def render_select_form_field(form, attribute, name, i18n_scope, options) html = form.select( name, choices, - { include_blank: attribute.include_blank, label: options[:label] } + { include_blank: attribute.include_blank, label: options[:label] }, + { disabled: options[:readonly] || false } ) html << content_tag(:p, options[:help_text], class: "help-text") if options[:help_text] html @@ -227,6 +228,8 @@ def integer_with_units(form, attribute, name, i18n_scope, options) # @param i18n_scope (see #settings_attribute_input) # @param [Object] form def taxonomy_filters(form, name, i18n_scope) + return disabled_taxonomy_filters(name, i18n_scope) if @component&.new_record? + current_filters = content_tag(:div, class: "js-current-filters") do render partial: "decidim/admin/taxonomy_filters_selector/component_table", locals: { field_name: "#{form.object_name}[#{name}][]", component: @component } @@ -250,6 +253,15 @@ def taxonomy_filters(form, name, i18n_scope) label_tag(name, t(name, scope: i18n_scope)) + container + drawer end + + def disabled_taxonomy_filters(name, i18n_scope) + container = content_tag(:div) do + message = t("taxonomy_filters_unavailable", scope: "decidim.components.settings.global") + content_tag(:p, message, class: "help-text") + end + + label_tag(name, t(name, scope: i18n_scope)) + container + end end end end diff --git a/decidim-admin/app/jobs/decidim/admin/newsletter_job.rb b/decidim-admin/app/jobs/decidim/admin/newsletter_job.rb index fda13b1410b60..28834cff4edd9 100644 --- a/decidim-admin/app/jobs/decidim/admin/newsletter_job.rb +++ b/decidim-admin/app/jobs/decidim/admin/newsletter_job.rb @@ -6,7 +6,7 @@ module Admin # class NewsletterJob < ApplicationJob queue_as :newsletter - self.enqueue_after_transaction_commit = :never + self.enqueue_after_transaction_commit = false def perform(newsletter, form, recipients_ids) @newsletter = newsletter diff --git a/decidim-admin/app/packs/stylesheets/decidim/admin/_datepicker.scss b/decidim-admin/app/packs/stylesheets/decidim/admin/_datepicker.scss index b76d31889ed95..975500a8ba8a0 100644 --- a/decidim-admin/app/packs/stylesheets/decidim/admin/_datepicker.scss +++ b/decidim-admin/app/packs/stylesheets/decidim/admin/_datepicker.scss @@ -22,10 +22,6 @@ @apply top-2; } - &__pick-calendar { - @apply z-[3]; - } - &__close-calendar { @apply z-[3]; } diff --git a/decidim-admin/app/packs/stylesheets/decidim/admin/_forms.scss b/decidim-admin/app/packs/stylesheets/decidim/admin/_forms.scss index 177d7990713a9..4662dd50e3d61 100644 --- a/decidim-admin/app/packs/stylesheets/decidim/admin/_forms.scss +++ b/decidim-admin/app/packs/stylesheets/decidim/admin/_forms.scss @@ -54,7 +54,6 @@ transition: all 0.2s ease; svg[role="img"] { - cursor: default !important; transition: color 0.2s ease; } diff --git a/decidim-admin/app/packs/stylesheets/decidim/admin/_sidebar-menu.scss b/decidim-admin/app/packs/stylesheets/decidim/admin/_sidebar-menu.scss index 1680ab240534d..4db16bb3b817b 100644 --- a/decidim-admin/app/packs/stylesheets/decidim/admin/_sidebar-menu.scss +++ b/decidim-admin/app/packs/stylesheets/decidim/admin/_sidebar-menu.scss @@ -4,7 +4,7 @@ &__item { a, &-disabled { - @apply gap-x-2 p-2 flex items-center text-sm truncate border border-gray-5 rounded; + @apply gap-x-2 p-2 flex items-center text-sm border border-gray-5 rounded; > svg { @apply w-4 h-4 flex-none text-gray fill-current; @@ -25,7 +25,11 @@ } & .component-counter { - @apply ml-auto inline-flex items-center justify-center w-5 h-5 text-xs font-semibold rounded-full bg-background-4 border-secondary; + @apply flex-shrink-0 ml-auto inline-flex items-center justify-center w-5 h-5 text-xs font-semibold rounded-full bg-background-4 border-secondary; + } + + a > span:first-child { + @apply min-w-0 whitespace-normal break-words; } ul { diff --git a/decidim-admin/app/packs/stylesheets/decidim/admin/_table-list.scss b/decidim-admin/app/packs/stylesheets/decidim/admin/_table-list.scss index 1f4a3820de00f..6f3e3e703236d 100644 --- a/decidim-admin/app/packs/stylesheets/decidim/admin/_table-list.scss +++ b/decidim-admin/app/packs/stylesheets/decidim/admin/_table-list.scss @@ -141,7 +141,7 @@ } .dragging-handle { - @apply cursor-ns-resize align-top p-3; + @apply cursor-grab align-top p-3; .dragger { @apply text-2xl; diff --git a/decidim-admin/app/packs/stylesheets/decidim/admin/_taxonomies.scss b/decidim-admin/app/packs/stylesheets/decidim/admin/_taxonomies.scss index 170141d6365eb..d91cb4a52b95e 100644 --- a/decidim-admin/app/packs/stylesheets/decidim/admin/_taxonomies.scss +++ b/decidim-admin/app/packs/stylesheets/decidim/admin/_taxonomies.scss @@ -14,7 +14,7 @@ } td { - @apply align-top cursor-ns-resize; + @apply align-top cursor-grab; &.js-drag-handle .dragger { @apply mt-1; diff --git a/decidim-admin/app/views/decidim/admin/admin_terms/show.html.erb b/decidim-admin/app/views/decidim/admin/admin_terms/show.html.erb index f6183f5ce914f..dd41c982b3f7b 100644 --- a/decidim-admin/app/views/decidim/admin/admin_terms/show.html.erb +++ b/decidim-admin/app/views/decidim/admin/admin_terms/show.html.erb @@ -1,8 +1,10 @@ +<% add_decidim_page_title(t(".title")) %> + <%= cell("decidim/announcement", announcement_body, callout_class: current_user.admin_terms_accepted? ? "success" : "warning" ) %>