From 44cfc4521ef6b4cb6149cbe3851e4e4038779db5 Mon Sep 17 00:00:00 2001 From: Quentin Champenois <26109239+Quentinchampenois@users.noreply.github.com> Date: Mon, 10 Jun 2024 16:19:20 +0200 Subject: [PATCH] feat: Add module budget booth (#81) * feat: Add module budget booth * bump: modules * ci: Add x86_64 linux support * test: Explore projects index --- Gemfile | 2 + Gemfile.lock | 238 +++++++++--------- ...m_budgets_budgets.decidim_budgets_booth.rb | 8 + ...budgets_user_data.decidim_budgets_booth.rb | 17 ++ db/schema.rb | 15 +- spec/system/explore_projects_spec.rb | 27 -- 6 files changed, 167 insertions(+), 140 deletions(-) create mode 100644 db/migrate/20240605102502_add_main_image_to_decidim_budgets_budgets.decidim_budgets_booth.rb create mode 100644 db/migrate/20240605102503_create_decidim_budgets_user_data.decidim_budgets_booth.rb diff --git a/Gemfile b/Gemfile index 4155de0..652343c 100644 --- a/Gemfile +++ b/Gemfile @@ -14,6 +14,8 @@ gem "dotenv-rails", require: "dotenv/rails-now" gem "decidim", "~> #{DECIDIM_VERSION}.0" # External Decidim gems +gem "decidim-budgets_booth", github: "OpenSourcePolitics/decidim-module-ptp" + gem "decidim-cache_cleaner" gem "decidim-custom_proposal_states", git: "https://github.com/alecslupu-pfa/decidim-module-custom_proposal_states", branch: DECIDIM_BRANCH gem "decidim-decidim_awesome", "~> 0.9.1" diff --git a/Gemfile.lock b/Gemfile.lock index 7e8326b..675cf14 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -10,23 +10,31 @@ GIT GIT remote: https://github.com/OpenSourcePolitics/decidim-module-friendly_signup.git - revision: 9bc2c4928185b9e775b3bad3921f9ae00b49acca + revision: 1c91e024ae4467c097b39673e5d78b06afd206d1 specs: decidim-friendly_signup (0.4.5) decidim-core (~> 0.27) GIT remote: https://github.com/OpenSourcePolitics/decidim-module-homepage_interactive_map.git - revision: dd685166fdf953a11bd6a9e0dac56feca3bd0708 + revision: 1ff222533cb3e7c30c8112a56c09c217c0530dbc branch: release/0.27-stable specs: - decidim-homepage_interactive_map (2.0.0) + decidim-homepage_interactive_map (2.0.1) decidim-admin (>= 0.25.0, < 0.28) decidim-core (>= 0.25.0, < 0.28) decidim-dev (>= 0.25.0, < 0.28) rgeo (~> 2.4) rgeo-proj4 (~> 3.1) +GIT + remote: https://github.com/OpenSourcePolitics/decidim-module-ptp.git + revision: 32b0f9a29499768cf6783a0026badaed33f025ab + specs: + decidim-budgets_booth (0.27.0) + decidim-budgets (~> 0.27.0) + decidim-core (~> 0.27.0) + GIT remote: https://github.com/OpenSourcePolitics/decidim-module-slider revision: 776378746abd5a637d654fbe068ca98f5bde2371 @@ -45,7 +53,7 @@ GIT GIT remote: https://github.com/alecslupu-pfa/decidim-module-custom_proposal_states - revision: 4e8f8e9a92a8967ae42b2793dd39c00f57f4e2aa + revision: 42121174bd24209421de1282c6a14588db6c1d6d branch: release/0.27-stable specs: decidim-custom_proposal_states (0.27.5) @@ -75,40 +83,40 @@ GIT GEM remote: https://rubygems.org/ specs: - actioncable (6.1.7.7) - actionpack (= 6.1.7.7) - activesupport (= 6.1.7.7) + actioncable (6.1.7.8) + actionpack (= 6.1.7.8) + activesupport (= 6.1.7.8) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (6.1.7.7) - actionpack (= 6.1.7.7) - activejob (= 6.1.7.7) - activerecord (= 6.1.7.7) - activestorage (= 6.1.7.7) - activesupport (= 6.1.7.7) + actionmailbox (6.1.7.8) + actionpack (= 6.1.7.8) + activejob (= 6.1.7.8) + activerecord (= 6.1.7.8) + activestorage (= 6.1.7.8) + activesupport (= 6.1.7.8) mail (>= 2.7.1) - actionmailer (6.1.7.7) - actionpack (= 6.1.7.7) - actionview (= 6.1.7.7) - activejob (= 6.1.7.7) - activesupport (= 6.1.7.7) + actionmailer (6.1.7.8) + actionpack (= 6.1.7.8) + actionview (= 6.1.7.8) + activejob (= 6.1.7.8) + activesupport (= 6.1.7.8) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (6.1.7.7) - actionview (= 6.1.7.7) - activesupport (= 6.1.7.7) + actionpack (6.1.7.8) + actionview (= 6.1.7.8) + activesupport (= 6.1.7.8) rack (~> 2.0, >= 2.0.9) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (6.1.7.7) - actionpack (= 6.1.7.7) - activerecord (= 6.1.7.7) - activestorage (= 6.1.7.7) - activesupport (= 6.1.7.7) + actiontext (6.1.7.8) + actionpack (= 6.1.7.8) + activerecord (= 6.1.7.8) + activestorage (= 6.1.7.8) + activesupport (= 6.1.7.8) nokogiri (>= 1.8.5) - actionview (6.1.7.7) - activesupport (= 6.1.7.7) + actionview (6.1.7.8) + activesupport (= 6.1.7.8) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) @@ -116,25 +124,25 @@ GEM active_link_to (1.0.5) actionpack addressable - activejob (6.1.7.7) - activesupport (= 6.1.7.7) + activejob (6.1.7.8) + activesupport (= 6.1.7.8) globalid (>= 0.3.6) activejob-uniqueness (0.3.1) activejob (>= 4.2, < 7.2) redlock (>= 2.0, < 3) - activemodel (6.1.7.7) - activesupport (= 6.1.7.7) - activerecord (6.1.7.7) - activemodel (= 6.1.7.7) - activesupport (= 6.1.7.7) - activestorage (6.1.7.7) - actionpack (= 6.1.7.7) - activejob (= 6.1.7.7) - activerecord (= 6.1.7.7) - activesupport (= 6.1.7.7) + activemodel (6.1.7.8) + activesupport (= 6.1.7.8) + activerecord (6.1.7.8) + activemodel (= 6.1.7.8) + activesupport (= 6.1.7.8) + activestorage (6.1.7.8) + actionpack (= 6.1.7.8) + activejob (= 6.1.7.8) + activerecord (= 6.1.7.8) + activesupport (= 6.1.7.8) marcel (~> 1.0) mini_mime (>= 1.1.0) - activesupport (6.1.7.7) + activesupport (6.1.7.8) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) @@ -146,22 +154,22 @@ GEM public_suffix (>= 2.0.2, < 6.0) ast (2.4.2) aws-eventstream (1.3.0) - aws-partitions (1.905.0) - aws-sdk-core (3.191.5) + aws-partitions (1.941.0) + aws-sdk-core (3.197.0) aws-eventstream (~> 1, >= 1.3.0) aws-partitions (~> 1, >= 1.651.0) aws-sigv4 (~> 1.8) jmespath (~> 1, >= 1.6.1) - aws-sdk-kms (1.78.0) - aws-sdk-core (~> 3, >= 3.191.0) + aws-sdk-kms (1.83.0) + aws-sdk-core (~> 3, >= 3.197.0) aws-sigv4 (~> 1.1) - aws-sdk-s3 (1.146.1) - aws-sdk-core (~> 3, >= 3.191.0) + aws-sdk-s3 (1.152.0) + aws-sdk-core (~> 3, >= 3.197.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.8) aws-sigv4 (1.8.0) aws-eventstream (~> 1, >= 1.0.2) - axe-core-api (4.9.0) + axe-core-api (4.9.1) dumb_delegator virtus axe-core-rspec (4.1.0) @@ -183,13 +191,13 @@ GEM html_tokenizer (~> 0.0.6) parser (>= 2.4) smart_properties - bigdecimal (3.1.7) + bigdecimal (3.1.8) bindex (0.8.1) bootsnap (1.18.3) msgpack (~> 1.2) brakeman (5.4.1) browser (2.7.1) - builder (3.2.4) + builder (3.3.0) byebug (11.1.3) capybara (3.40.0) addressable @@ -234,9 +242,9 @@ GEM execjs coffee-script-source (1.12.2) commonmarker (0.23.10) - concurrent-ruby (1.2.3) + concurrent-ruby (1.3.3) connection_pool (2.4.1) - countries (6.0.0) + countries (6.0.1) unaccent (~> 0.3) country_select (9.0.0) countries (> 5.0, < 7.0) @@ -244,8 +252,9 @@ GEM bigdecimal rexml crass (1.0.6) - css_parser (1.16.0) + css_parser (1.17.1) addressable + csv (3.3.0) dalli (3.2.8) date (3.3.4) date_validator (0.12.0) @@ -440,13 +449,13 @@ GEM rainbow (>= 2.1.0) descendants_tracker (0.0.4) thread_safe (~> 0.3, >= 0.3.1) - devise (4.9.3) + devise (4.9.4) bcrypt (~> 3.0) orm_adapter (~> 0.1) railties (>= 4.1.0) responders warden (~> 1.2.3) - devise-i18n (1.12.0) + devise-i18n (1.12.1) devise (>= 4.9.0) devise_invitable (2.0.9) actionmailer (>= 5.0) @@ -457,12 +466,12 @@ GEM nokogiri (>= 1.13.2, < 1.17.0) rubyzip (~> 2.3.0) docile (1.4.0) - doorkeeper (5.6.9) + doorkeeper (5.7.0) railties (>= 5) doorkeeper-i18n (4.0.1) - dotenv (3.1.0) - dotenv-rails (3.1.0) - dotenv (= 3.1.0) + dotenv (3.1.2) + dotenv-rails (3.1.2) + dotenv (= 3.1.2) railties (>= 6.1) dumb_delegator (1.0.0) erb_lint (0.0.37) @@ -490,11 +499,11 @@ GEM railties (>= 3.0.0) faker (2.23.0) i18n (>= 1.8.11, < 2) - faraday (2.9.0) + faraday (2.9.1) faraday-net_http (>= 2.0, < 3.2) faraday-net_http (3.1.0) net-http - ffi (1.16.3) + ffi (1.17.0) file_validators (3.0.0) activemodel (>= 3.2) mime-types (>= 1.0) @@ -516,11 +525,13 @@ GEM fog-core nokogiri (>= 1.5.11, < 2.0.0) formatador (1.1.0) - fugit (1.10.1) - et-orbi (~> 1, >= 1.2.7) + fugit (1.11.0) + et-orbi (~> 1, >= 1.2.11) raabro (~> 1.4) gemoji (3.0.1) - geocoder (1.8.2) + geocoder (1.8.3) + base64 (>= 0.1.0) + csv (>= 3.0.0) globalid (1.2.1) activesupport (>= 6.1) graphql (1.12.24) @@ -544,7 +555,7 @@ GEM nokogiri (>= 1.4) html_tokenizer (0.0.8) htmlentities (4.3.4) - i18n (1.14.4) + i18n (1.14.5) concurrent-ruby (~> 1.0) i18n-tasks (0.9.37) activesupport (>= 4.0.2) @@ -566,7 +577,7 @@ GEM invisible_captcha (0.13.0) rails (>= 3.2.0) jmespath (1.6.2) - json (2.7.1) + json (2.7.2) jwt (2.8.1) base64 kaminari (1.2.2) @@ -617,13 +628,13 @@ GEM mixlib-cli (~> 2.1, >= 2.1.1) mixlib-config (>= 2.2.1, < 4) mixlib-shellout - method_source (1.0.0) + method_source (1.1.0) mime-types (3.5.2) mime-types-data (~> 3.2015) - mime-types-data (3.2024.0305) + mime-types-data (3.2024.0604) mini_magick (4.12.0) mini_mime (1.1.5) - minitest (5.22.3) + minitest (5.23.1) mixlib-cli (2.1.8) mixlib-config (3.0.27) tomlrb @@ -635,7 +646,7 @@ GEM mustache (1.1.1) net-http (0.4.1) uri - net-imap (0.4.10) + net-imap (0.4.12) date net-protocol net-pop (0.1.2) @@ -644,7 +655,7 @@ GEM timeout net-smtp (0.5.0) net-protocol - nio4r (2.7.1) + nio4r (2.7.3) nokogiri (1.13.4-arm64-darwin) racc (~> 1.4) nokogiri (1.13.4-x86_64-linux) @@ -679,7 +690,7 @@ GEM omniauth-oauth2 (1.8.0) oauth2 (>= 1.4, < 3) omniauth (~> 2.0) - omniauth-rails_csrf_protection (1.0.1) + omniauth-rails_csrf_protection (1.0.2) actionpack (>= 4.2) omniauth (~> 2.0) omniauth-twitter (1.4.0) @@ -689,10 +700,10 @@ GEM paper_trail (12.3.0) activerecord (>= 5.2) request_store (~> 1.1) - parallel (1.24.0) + parallel (1.25.1) parallel_tests (3.13.0) parallel - parser (3.3.0.5) + parser (3.3.2.0) ast (~> 2.4.1) racc pg (1.1.4) @@ -712,7 +723,7 @@ GEM puma (5.6.8) nio4r (~> 2.0) raabro (1.4.0) - racc (1.7.3) + racc (1.8.0) rack (2.2.9) rack-attack (6.7.0) rack (>= 1.0, < 4) @@ -725,20 +736,20 @@ GEM rack rack-test (2.1.0) rack (>= 1.3) - rails (6.1.7.7) - actioncable (= 6.1.7.7) - actionmailbox (= 6.1.7.7) - actionmailer (= 6.1.7.7) - actionpack (= 6.1.7.7) - actiontext (= 6.1.7.7) - actionview (= 6.1.7.7) - activejob (= 6.1.7.7) - activemodel (= 6.1.7.7) - activerecord (= 6.1.7.7) - activestorage (= 6.1.7.7) - activesupport (= 6.1.7.7) + rails (6.1.7.8) + actioncable (= 6.1.7.8) + actionmailbox (= 6.1.7.8) + actionmailer (= 6.1.7.8) + actionpack (= 6.1.7.8) + actiontext (= 6.1.7.8) + actionview (= 6.1.7.8) + activejob (= 6.1.7.8) + activemodel (= 6.1.7.8) + activerecord (= 6.1.7.8) + activestorage (= 6.1.7.8) + activesupport (= 6.1.7.8) bundler (>= 1.15.0) - railties (= 6.1.7.7) + railties (= 6.1.7.8) sprockets-rails (>= 2.0.0) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) @@ -753,34 +764,35 @@ GEM rails-i18n (6.0.0) i18n (>= 0.7, < 2) railties (>= 6.0.0, < 7) - railties (6.1.7.7) - actionpack (= 6.1.7.7) - activesupport (= 6.1.7.7) + railties (6.1.7.8) + actionpack (= 6.1.7.8) + activesupport (= 6.1.7.8) method_source rake (>= 12.2) thor (~> 1.0) rainbow (3.1.1) - rake (13.2.0) + rake (13.2.1) ransack (2.4.2) activerecord (>= 5.2.4) activesupport (>= 5.2.4) i18n rb-fsevent (0.11.2) - rb-inotify (0.10.1) + rb-inotify (0.11.1) ffi (~> 1.0) redcarpet (3.6.0) redis (4.8.1) - redis-client (0.21.1) + redis-client (0.22.2) connection_pool redlock (2.0.6) redis-client (>= 0.14.1, < 1.0.0) - regexp_parser (2.9.0) + regexp_parser (2.9.2) request_store (1.5.1) rack (>= 1.4) responders (3.1.1) actionpack (>= 5.2) railties (>= 5.2) - rexml (3.2.6) + rexml (3.2.9) + strscan rgeo (2.4.0) rgeo-proj4 (3.1.1) rgeo (~> 2.0) @@ -799,7 +811,7 @@ GEM rspec-html-matchers (0.9.4) nokogiri (~> 1) rspec (>= 3.0.0.a, < 4) - rspec-mocks (3.13.0) + rspec-mocks (3.13.1) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) rspec-rails (4.1.2) @@ -824,8 +836,8 @@ GEM rubocop-ast (>= 1.17.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 3.0) - rubocop-ast (1.31.2) - parser (>= 3.3.0.4) + rubocop-ast (1.31.3) + parser (>= 3.3.1.0) rubocop-faker (1.1.0) faker (>= 2.12.0) rubocop (>= 0.82.0) @@ -838,7 +850,7 @@ GEM ruby-progressbar (1.13.0) ruby-vips (2.2.1) ffi (~> 1.12) - rubyXL (3.4.26) + rubyXL (3.4.27) nokogiri (>= 1.10.8) rubyzip (>= 1.3.0) ruby_http_client (3.5.5) @@ -859,14 +871,14 @@ GEM semantic_range (3.0.0) sendgrid-ruby (6.7.0) ruby_http_client (~> 3.4) - sentry-rails (5.17.1) + sentry-rails (5.17.3) railties (>= 5.0) - sentry-ruby (~> 5.17.1) - sentry-ruby (5.17.1) + sentry-ruby (~> 5.17.3) + sentry-ruby (5.17.3) bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) - sentry-sidekiq (5.17.1) - sentry-ruby (~> 5.17.1) + sentry-sidekiq (5.17.3) + sentry-ruby (~> 5.17.3) sidekiq (>= 3.0) seven_zip_ruby (1.3.0) sidekiq (6.5.12) @@ -902,12 +914,13 @@ GEM sprockets (4.2.1) concurrent-ruby (~> 1.0) rack (>= 2.2.4, < 4) - sprockets-rails (3.4.2) - actionpack (>= 5.2) - activesupport (>= 5.2) + sprockets-rails (3.5.1) + actionpack (>= 6.1) + activesupport (>= 6.1) sprockets (>= 3.0.0) ssrf_filter (1.1.2) - sys-filesystem (1.4.4) + strscan (3.1.0) + sys-filesystem (1.5.0) ffi (~> 1.1) temple (0.10.3) terminal-table (3.0.2) @@ -946,7 +959,7 @@ GEM activemodel (>= 6.0.0) bindex (>= 0.4.0) railties (>= 6.0.0) - webmock (3.23.0) + webmock (3.23.1) addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) @@ -965,10 +978,10 @@ GEM activesupport wisper (2.0.1) wisper-rspec (1.1.0) - wkhtmltopdf-binary (0.12.6.6) + wkhtmltopdf-binary (0.12.6.7) xpath (3.2.0) nokogiri (~> 1.8) - zeitwerk (2.6.13) + zeitwerk (2.6.15) PLATFORMS arm64-darwin-22 @@ -983,6 +996,7 @@ DEPENDENCIES climate_control (~> 1.2) dalli decidim (~> 0.27.0) + decidim-budgets_booth! decidim-cache_cleaner decidim-custom_proposal_states! decidim-decidim_awesome (~> 0.9.1) diff --git a/db/migrate/20240605102502_add_main_image_to_decidim_budgets_budgets.decidim_budgets_booth.rb b/db/migrate/20240605102502_add_main_image_to_decidim_budgets_budgets.decidim_budgets_booth.rb new file mode 100644 index 0000000..f5ce008 --- /dev/null +++ b/db/migrate/20240605102502_add_main_image_to_decidim_budgets_budgets.decidim_budgets_booth.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true +# This migration comes from decidim_budgets_booth (originally 20230301155948) + +class AddMainImageToDecidimBudgetsBudgets < ActiveRecord::Migration[6.1] + def change + add_column :decidim_budgets_budgets, :main_image, :string + end +end diff --git a/db/migrate/20240605102503_create_decidim_budgets_user_data.decidim_budgets_booth.rb b/db/migrate/20240605102503_create_decidim_budgets_user_data.decidim_budgets_booth.rb new file mode 100644 index 0000000..24a4440 --- /dev/null +++ b/db/migrate/20240605102503_create_decidim_budgets_user_data.decidim_budgets_booth.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true +# This migration comes from decidim_budgets_booth (originally 20230303144938) + +class CreateDecidimBudgetsUserData < ActiveRecord::Migration[6.1] + def change + create_table :decidim_budgets_user_data do |t| + t.jsonb :metadata + t.boolean :affirm_statements_are_correct, default: false + t.references :decidim_component, null: false, indec: true + t.references :decidim_user, null: false, index: true + + t.timestamps + end + + add_index :decidim_budgets_user_data, [:decidim_component_id, :decidim_user_id], unique: true, name: "decidim_budgets_user_data_unique_user_and_component" + end +end diff --git a/db/schema.rb b/db/schema.rb index 032ac0e..f5760a0 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2024_04_26_120518) do +ActiveRecord::Schema.define(version: 2024_06_05_102503) do # These are extensions that must be enabled in order to support this database enable_extension "ltree" @@ -372,6 +372,7 @@ t.datetime "created_at", null: false t.datetime "updated_at", null: false t.bigint "decidim_scope_id" + t.string "main_image" t.index ["decidim_component_id"], name: "index_decidim_budgets_budgets_on_decidim_component_id" t.index ["decidim_scope_id"], name: "index_decidim_budgets_budgets_on_decidim_scope_id" end @@ -416,6 +417,18 @@ t.index ["selected_at"], name: "index_decidim_budgets_projects_on_selected_at" end + create_table "decidim_budgets_user_data", force: :cascade do |t| + t.jsonb "metadata" + t.boolean "affirm_statements_are_correct", default: false + t.bigint "decidim_component_id", null: false + t.bigint "decidim_user_id", null: false + t.datetime "created_at", precision: 6, null: false + t.datetime "updated_at", precision: 6, null: false + t.index ["decidim_component_id", "decidim_user_id"], name: "decidim_budgets_user_data_unique_user_and_component", unique: true + t.index ["decidim_component_id"], name: "index_decidim_budgets_user_data_on_decidim_component_id" + t.index ["decidim_user_id"], name: "index_decidim_budgets_user_data_on_decidim_user_id" + end + create_table "decidim_calendar_external_events", force: :cascade do |t| t.jsonb "title", null: false t.datetime "start_at", null: false diff --git a/spec/system/explore_projects_spec.rb b/spec/system/explore_projects_spec.rb index f1e850e..8055bfc 100644 --- a/spec/system/explore_projects_spec.rb +++ b/spec/system/explore_projects_spec.rb @@ -76,33 +76,6 @@ end end - it "works with 'back to list' link" do - category = categories.first - project.category = category - project.save - - visit_budget - - within ".with_any_category_check_boxes_tree_filter" do - uncheck "All" - check translated(category.name) - end - - within "#projects" do - expect(page).to have_css(".budget-list__item", count: 1) - expect(page).to have_content(translated(project.title)) - end - - page.find(".budget-list__item .card__link", match: :first).click - click_link "View all projects" - - take_screenshot - within "#projects" do - expect(page).to have_css(".budget-list__item", count: 1) - expect(page).to have_content(translated(project.title)) - end - end - context "and votes are finished" do let!(:component) do create(:budgets_component,