diff --git a/.env-example b/.env-example index f322eca..9d3b91a 100644 --- a/.env-example +++ b/.env-example @@ -39,3 +39,4 @@ TRANSLATION_SWITCH_REGEXP= TWILIO_ACCOUNT_SID= TWILIO_AUTH_TOKEN= TWILIO_SENDER= +HALF_SIGNUP_TOS=false \ No newline at end of file diff --git a/Gemfile b/Gemfile index b170264..8886f04 100644 --- a/Gemfile +++ b/Gemfile @@ -21,6 +21,11 @@ gem "decidim-slider", git: "https://github.com/alecslupu-pfa/decidim-module-slid gem "decidim-spam_detection" gem "decidim-term_customizer", git: "https://github.com/opensourcepolitics/decidim-module-term_customizer.git", branch: "fix/multi-threading-compliant-0.26" +# PTP_MODULE_VERSION = { github: "Pipeline-to-Power/decidim-module-ptp", branch: "feature/0.26/zip-code-voting" } +gem "decidim-budgets_booth", github: "OpenSourcePolitics/decidim-module-ptp", branch: "feature/0.26/zip-code-voting" +gem "decidim-smsauth", github: "OpenSourcePolitics/decidim-module-ptp", branch: "feature/0.26/zip-code-voting" +gem "decidim-sms-twilio", github: "OpenSourcePolitics/decidim-module-ptp", branch: "feature/0.26/zip-code-voting" + # NOTE: Custom proposal states must be before simple_proposal gem "decidim-custom_proposal_states", git: "https://github.com/alecslupu-pfa/decidim-module-custom_proposal_states", branch: "chore/fix-module-dependency" gem "decidim-simple_proposal", git: "https://github.com/mainio/decidim-module-simple_proposal", branch: DECIDIM_BRANCH @@ -36,7 +41,9 @@ gem "uglifier", "~> 4.1" gem "faker", "~> 2.14" +gem "net-http" gem "nokogiri", "1.13.4" +gem "uri", "0.10.0" gem "activejob-uniqueness", require: "active_job/uniqueness/sidekiq_patch" gem "aws-sdk-s3", require: false @@ -46,11 +53,6 @@ gem "sys-filesystem" gem "omniauth-rails_csrf_protection" gem "omniauth-saml" -# PTP_MODULE_VERSION = { github: "Pipeline-to-Power/decidim-module-ptp", branch: "feature/0.26/zip-code-voting" } -gem "decidim-budgets_booth", github: "Pipeline-to-Power/decidim-module-ptp", branch: "feature/0.26/zip-code-voting" -gem "decidim-smsauth", github: "Pipeline-to-Power/decidim-module-ptp", branch: "feature/0.26/zip-code-voting" -gem "decidim-sms-twilio", github: "Pipeline-to-Power/decidim-module-ptp", branch: "feature/0.26/zip-code-voting" - group :development, :test do gem "brakeman", "~> 5.1" gem "byebug", "~> 11.0", platform: :mri diff --git a/Gemfile.lock b/Gemfile.lock index 731cfe7..89c336e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -20,16 +20,8 @@ GIT rgeo-proj4 (~> 3.1) GIT - remote: https://github.com/OpenSourcePolitics/decidim-module_phone_authorization_handler - revision: 488cc8827845ec1c5266aa499df2ebf9b20e02a3 - branch: release/0.26-stable - specs: - decidim-phone_authorization_handler (1.0.0) - decidim-core (~> 0.26) - -GIT - remote: https://github.com/Pipeline-to-Power/decidim-module-ptp.git - revision: 79f07fee09671661ab23e8a8c18e464a78d29966 + remote: https://github.com/OpenSourcePolitics/decidim-module-ptp.git + revision: 6148a817251256d6f536f1f3478c8be895a518b0 branch: feature/0.26/zip-code-voting specs: decidim-budgets_booth (0.26.0) @@ -42,9 +34,17 @@ GIT countries (~> 5.1, >= 5.1.2) decidim-core (~> 0.26.0) +GIT + remote: https://github.com/OpenSourcePolitics/decidim-module_phone_authorization_handler + revision: 488cc8827845ec1c5266aa499df2ebf9b20e02a3 + branch: release/0.26-stable + specs: + decidim-phone_authorization_handler (1.0.0) + decidim-core (~> 0.26) + GIT remote: https://github.com/alecslupu-pfa/decidim-module-custom_proposal_states - revision: 92b02c1ed2311547b9b4688d16411b4d9be99af6 + revision: 5a01dcd0c61f7760adb929d53a6ccdbe6af5b050 branch: chore/fix-module-dependency specs: decidim-custom_proposal_states (0.26.8) @@ -62,7 +62,7 @@ GIT GIT remote: https://github.com/alecslupu-pfa/decidim-module_homepage_proposals - revision: 498631e9a5c2fa1628b25c6d6fecbedd8fc507f9 + revision: 1e5753b2db6caaba5b38c7de7865de8cf22c11db branch: feature/reset-filters specs: decidim-homepage_proposals (1.0.2) @@ -642,6 +642,8 @@ GEM multi_json (1.15.0) multi_xml (0.6.0) mustache (1.1.1) + net-http (0.4.1) + uri net-imap (0.3.4) date net-protocol @@ -933,6 +935,7 @@ GEM execjs (>= 0.3.0, < 3) unaccent (0.4.0) unicode-display_width (1.8.0) + uri (0.10.0) valid_email2 (2.3.1) activemodel (>= 3.2) mail (~> 2.5) @@ -1014,6 +1017,7 @@ DEPENDENCIES letter_opener_web (~> 1.3) listen (~> 3.1) lograge + net-http nokogiri (= 1.13.4) omniauth-rails_csrf_protection omniauth-saml @@ -1032,10 +1036,11 @@ DEPENDENCIES spring-watcher-listen (~> 2.0) sys-filesystem uglifier (~> 4.1) + uri (= 0.10.0) web-console (= 4.0.4) RUBY VERSION ruby 2.7.7p221 BUNDLED WITH - 2.3.4 + 2.4.22 diff --git a/app/cells/decidim/budgets/project_vote_button/show.erb b/app/cells/decidim/budgets/project_vote_button/show.erb new file mode 100644 index 0000000..0179922 --- /dev/null +++ b/app/cells/decidim/budgets/project_vote_button/show.erb @@ -0,0 +1,20 @@ +<%= action_authorized_button_to( + "vote", + budget_order_line_item_path(model.budget, project_id: model), + method: vote_button_method, + remote: true, + class: "button #{scale_up} #{selected_budget} customized-budget display-block project-vote-button", + data: { + add: !resource_added?, + disable: true, + budget: model.budget_amount, + project_id: model.id, + allocation: resource_allocation, + "redirect-url": budget_voting_index_path + }, + disabled: vote_button_disabled?, + title: vote_button_label + ) do %> + <%= resource_added? ? t("remove_from_vote", scope: "decidim.budgets.project_vote_button") :t("add_to_vote", scope: "decidim.budgets.project_vote_button") %> +<% end %> + diff --git a/app/views/layouts/decidim/_head_extra.html.erb b/app/views/layouts/decidim/_head_extra.html.erb index 0e63e07..fa644a6 100644 --- a/app/views/layouts/decidim/_head_extra.html.erb +++ b/app/views/layouts/decidim/_head_extra.html.erb @@ -6,6 +6,7 @@ }); <% end %> + <% if translation_mode?(:google) %> diff --git a/config/initializers/half_signup.rb b/config/initializers/half_signup.rb new file mode 100644 index 0000000..602439a --- /dev/null +++ b/config/initializers/half_signup.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +Decidim::HalfSignup.configure do |config| + config.show_tos_page_after_signup = Rails.application.secrets.dig(:decidim, :module, :half_signup, :show_tos_page_after_signup) +end diff --git a/config/secrets.yml b/config/secrets.yml index 7f4bb02..6a1106b 100644 --- a/config/secrets.yml +++ b/config/secrets.yml @@ -19,6 +19,9 @@ default: &default google_tag_manager_id: <%= ENV["GOOGLE_TAG_MANAGER_ID"] %> decidim: currency: <%= ENV["CURRENCY"] || "€" %> + module: + half_signup: + show_tos_page_after_signup: <%= ENV["HALF_SIGNUP_TOS"] == "true" %> throttling_max_requests: <%= ENV["THROTTLING_MAX_REQUESTS"] || 100 %> throttling_period: <%= ENV["THROTTLING_PERIOD"] || 1 %> translation_mode: <%= ENV["TRANSLATION_MODE"] || "none" %> diff --git a/db/migrate/20240103110734_change_default_value_for_decidim_endorsements.decidim.rb b/db/migrate/20240103110734_change_default_value_for_decidim_endorsements.decidim.rb new file mode 100644 index 0000000..be91c9d --- /dev/null +++ b/db/migrate/20240103110734_change_default_value_for_decidim_endorsements.decidim.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +# This migration comes from decidim (originally 20231027142329) + +class ChangeDefaultValueForDecidimEndorsements < ActiveRecord::Migration[6.0] + def up + change_column_default :decidim_endorsements, :decidim_user_group_id, 0 + end + + def down + change_column_default :decidim_endorsements, :decidim_user_group_id, nil + end +end diff --git a/db/migrate/20240103110735_create_decidim_awesome_vote_weights.decidim_decidim_awesome.rb b/db/migrate/20240103110735_create_decidim_awesome_vote_weights.decidim_decidim_awesome.rb new file mode 100644 index 0000000..e23875c --- /dev/null +++ b/db/migrate/20240103110735_create_decidim_awesome_vote_weights.decidim_decidim_awesome.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +# This migration comes from decidim_decidim_awesome (originally 20231006113837) + +class CreateDecidimAwesomeVoteWeights < ActiveRecord::Migration[6.0] + def change + create_table :decidim_awesome_vote_weights do |t| + # this might be polymorphic in the future (if other types of votes are supported) + t.references :proposal_vote, null: false, index: { name: "decidim_awesome_proposals_weights_vote" } + + t.integer :weight, null: false, default: 1 + t.timestamps + end + end +end diff --git a/db/migrate/20240103110736_create_decidim_awesome_proposal_extra_fields.decidim_decidim_awesome.rb b/db/migrate/20240103110736_create_decidim_awesome_proposal_extra_fields.decidim_decidim_awesome.rb new file mode 100644 index 0000000..76a1d2e --- /dev/null +++ b/db/migrate/20240103110736_create_decidim_awesome_proposal_extra_fields.decidim_decidim_awesome.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +# This migration comes from decidim_decidim_awesome (originally 20231006113841) + +class CreateDecidimAwesomeProposalExtraFields < ActiveRecord::Migration[6.0] + def change + create_table :decidim_awesome_proposal_extra_fields do |t| + # this might be polymorphic in the future (if other types of votes are supported) + t.references :decidim_proposal, null: false, index: { name: "decidim_awesome_extra_fields_on_proposal" } + + t.jsonb :vote_weight_totals + t.integer :weight_total, default: 0 + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 38df89b..ccaad8a 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: 2023_12_21_231806) do +ActiveRecord::Schema.define(version: 2024_01_03_110736) do # These are extensions that must be enabled in order to support this database enable_extension "ltree" @@ -315,6 +315,23 @@ t.index ["decidim_organization_id"], name: "decidim_awesome_editor_images_constraint_organization" end + create_table "decidim_awesome_proposal_extra_fields", force: :cascade do |t| + t.bigint "decidim_proposal_id", null: false + t.jsonb "vote_weight_totals" + t.integer "weight_total", default: 0 + t.datetime "created_at", precision: 6, null: false + t.datetime "updated_at", precision: 6, null: false + t.index ["decidim_proposal_id"], name: "decidim_awesome_extra_fields_on_proposal" + end + + create_table "decidim_awesome_vote_weights", force: :cascade do |t| + t.bigint "proposal_vote_id", null: false + t.integer "weight", default: 1, null: false + t.datetime "created_at", precision: 6, null: false + t.datetime "updated_at", precision: 6, null: false + t.index ["proposal_vote_id"], name: "decidim_awesome_proposals_weights_vote" + end + create_table "decidim_blogs_posts", id: :serial, force: :cascade do |t| t.jsonb "title" t.jsonb "body" @@ -731,7 +748,7 @@ t.bigint "resource_id" t.string "decidim_author_type" t.bigint "decidim_author_id" - t.integer "decidim_user_group_id" + t.integer "decidim_user_group_id", default: 0 t.datetime "created_at", null: false t.datetime "updated_at", null: false t.index ["decidim_author_type", "decidim_author_id"], name: "idx_endorsements_authors"