From d717718430d732dfc6b9af4d380c181bfabd49c9 Mon Sep 17 00:00:00 2001 From: Simonas Date: Thu, 16 Nov 2023 19:39:13 +0100 Subject: [PATCH 01/13] bump homepage proposals --- Gemfile | 2 +- Gemfile.lock | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Gemfile b/Gemfile index 1ec8354..9f83023 100644 --- a/Gemfile +++ b/Gemfile @@ -15,7 +15,7 @@ gem "decidim-budgets_paper_ballots", git: "https://github.com/digidemlab/decidim gem "decidim-decidim_awesome" gem "decidim-half_signup", git: "https://github.com/OpenSourcePolitics/decidim-module-half_sign_up", branch: DECIDIM_BRANCH gem "decidim-homepage_interactive_map", git: "https://github.com/OpenSourcePolitics/decidim-module-homepage_interactive_map.git", branch: DECIDIM_BRANCH -gem "decidim-homepage_proposals", git: "https://github.com/OpenSourcePolitics/decidim-module_homepage_proposals.git", branch: DECIDIM_BRANCH +gem "decidim-homepage_proposals", git: "https://github.com/alecslupu-pfa/decidim-module_homepage_proposals", branch: "release/0.26-bulk-deploy", ref: "992ed0fcfa32e5b86479e706c71eb6523d61de2b" gem "decidim-phone_authorization_handler", git: "https://github.com/OpenSourcePolitics/decidim-module_phone_authorization_handler", branch: DECIDIM_BRANCH gem "decidim-simple_proposal", git: "https://github.com/mainio/decidim-module-simple_proposal", branch: DECIDIM_BRANCH gem "decidim-slider", git: "https://github.com/alecslupu-pfa/decidim-module-slider", branch: "main" diff --git a/Gemfile.lock b/Gemfile.lock index 7df7d72..1d9612e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -19,14 +19,6 @@ GIT rgeo (~> 2.4) rgeo-proj4 (~> 3.1) -GIT - remote: https://github.com/OpenSourcePolitics/decidim-module_homepage_proposals.git - revision: 3e17f0fe9403ea222f6c3f279a2ed264cc6109a5 - branch: release/0.26-stable - specs: - decidim-homepage_proposals (1.0.2) - decidim-core (~> 0.26) - GIT remote: https://github.com/OpenSourcePolitics/decidim-module_phone_authorization_handler revision: 488cc8827845ec1c5266aa499df2ebf9b20e02a3 @@ -58,6 +50,15 @@ GIT decidim-slider (0.0.2) decidim-core (~> 0.26.0) +GIT + remote: https://github.com/alecslupu-pfa/decidim-module_homepage_proposals + revision: 992ed0fcfa32e5b86479e706c71eb6523d61de2b + ref: 992ed0fcfa32e5b86479e706c71eb6523d61de2b + branch: release/0.26-bulk-deploy + specs: + decidim-homepage_proposals (1.0.2) + decidim-core (~> 0.26) + GIT remote: https://github.com/digidemlab/decidim-module-budgets_paper_ballots revision: 3e5d2794f43b1c353e8a3116edf6daab9e3a26a7 From 4c11bc9a221c8138de01b3b163e5c5b8e9029f45 Mon Sep 17 00:00:00 2001 From: moustachu Date: Thu, 16 Nov 2023 21:19:57 +0100 Subject: [PATCH 02/13] rubocop --- Gemfile | 3 ++- Gemfile.lock | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 9f83023..0bff286 100644 --- a/Gemfile +++ b/Gemfile @@ -15,7 +15,8 @@ gem "decidim-budgets_paper_ballots", git: "https://github.com/digidemlab/decidim gem "decidim-decidim_awesome" gem "decidim-half_signup", git: "https://github.com/OpenSourcePolitics/decidim-module-half_sign_up", branch: DECIDIM_BRANCH gem "decidim-homepage_interactive_map", git: "https://github.com/OpenSourcePolitics/decidim-module-homepage_interactive_map.git", branch: DECIDIM_BRANCH -gem "decidim-homepage_proposals", git: "https://github.com/alecslupu-pfa/decidim-module_homepage_proposals", branch: "release/0.26-bulk-deploy", ref: "992ed0fcfa32e5b86479e706c71eb6523d61de2b" +# gem "decidim-homepage_proposals", git: "https://github.com/OpenSourcePolitics/decidim-module_homepage_proposals.git", branch: DECIDIM_BRANCH +gem "decidim-homepage_proposals", git: "https://github.com/alecslupu-pfa/decidim-module_homepage_proposals", ref: "992ed0fcfa32e5b86479e706c71eb6523d61de2b" gem "decidim-phone_authorization_handler", git: "https://github.com/OpenSourcePolitics/decidim-module_phone_authorization_handler", branch: DECIDIM_BRANCH gem "decidim-simple_proposal", git: "https://github.com/mainio/decidim-module-simple_proposal", branch: DECIDIM_BRANCH gem "decidim-slider", git: "https://github.com/alecslupu-pfa/decidim-module-slider", branch: "main" diff --git a/Gemfile.lock b/Gemfile.lock index 1d9612e..9b424bd 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -54,7 +54,6 @@ GIT remote: https://github.com/alecslupu-pfa/decidim-module_homepage_proposals revision: 992ed0fcfa32e5b86479e706c71eb6523d61de2b ref: 992ed0fcfa32e5b86479e706c71eb6523d61de2b - branch: release/0.26-bulk-deploy specs: decidim-homepage_proposals (1.0.2) decidim-core (~> 0.26) From 7cb9023e66bad4f057b3d543f9285efb19cb4f59 Mon Sep 17 00:00:00 2001 From: Simonas Date: Thu, 23 Nov 2023 17:11:26 +0100 Subject: [PATCH 03/13] Update the module with the fix --- Gemfile | 2 +- Gemfile.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 0bff286..a87e762 100644 --- a/Gemfile +++ b/Gemfile @@ -16,7 +16,7 @@ gem "decidim-decidim_awesome" gem "decidim-half_signup", git: "https://github.com/OpenSourcePolitics/decidim-module-half_sign_up", branch: DECIDIM_BRANCH gem "decidim-homepage_interactive_map", git: "https://github.com/OpenSourcePolitics/decidim-module-homepage_interactive_map.git", branch: DECIDIM_BRANCH # gem "decidim-homepage_proposals", git: "https://github.com/OpenSourcePolitics/decidim-module_homepage_proposals.git", branch: DECIDIM_BRANCH -gem "decidim-homepage_proposals", git: "https://github.com/alecslupu-pfa/decidim-module_homepage_proposals", ref: "992ed0fcfa32e5b86479e706c71eb6523d61de2b" +gem "decidim-homepage_proposals", git: "https://github.com/alecslupu-pfa/decidim-module_homepage_proposals", ref: "995505d587d87fbc7cccaf94822f5f2285105afb" gem "decidim-phone_authorization_handler", git: "https://github.com/OpenSourcePolitics/decidim-module_phone_authorization_handler", branch: DECIDIM_BRANCH gem "decidim-simple_proposal", git: "https://github.com/mainio/decidim-module-simple_proposal", branch: DECIDIM_BRANCH gem "decidim-slider", git: "https://github.com/alecslupu-pfa/decidim-module-slider", branch: "main" diff --git a/Gemfile.lock b/Gemfile.lock index 9b424bd..c8e852b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -52,8 +52,8 @@ GIT GIT remote: https://github.com/alecslupu-pfa/decidim-module_homepage_proposals - revision: 992ed0fcfa32e5b86479e706c71eb6523d61de2b - ref: 992ed0fcfa32e5b86479e706c71eb6523d61de2b + revision: 995505d587d87fbc7cccaf94822f5f2285105afb + ref: 995505d587d87fbc7cccaf94822f5f2285105afb specs: decidim-homepage_proposals (1.0.2) decidim-core (~> 0.26) From bbdd0cf3a3337072f51fae01f0e84ed8157bd4e1 Mon Sep 17 00:00:00 2001 From: Simonas Date: Mon, 27 Nov 2023 10:45:13 +0100 Subject: [PATCH 04/13] fix how the bump is done --- Gemfile | 2 +- Gemfile.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index a87e762..5897a9a 100644 --- a/Gemfile +++ b/Gemfile @@ -16,7 +16,7 @@ gem "decidim-decidim_awesome" gem "decidim-half_signup", git: "https://github.com/OpenSourcePolitics/decidim-module-half_sign_up", branch: DECIDIM_BRANCH gem "decidim-homepage_interactive_map", git: "https://github.com/OpenSourcePolitics/decidim-module-homepage_interactive_map.git", branch: DECIDIM_BRANCH # gem "decidim-homepage_proposals", git: "https://github.com/OpenSourcePolitics/decidim-module_homepage_proposals.git", branch: DECIDIM_BRANCH -gem "decidim-homepage_proposals", git: "https://github.com/alecslupu-pfa/decidim-module_homepage_proposals", ref: "995505d587d87fbc7cccaf94822f5f2285105afb" +gem "decidim-homepage_proposals", git: "https://github.com/alecslupu-pfa/decidim-module_homepage_proposals", branch: "release/0.26-bulk-deploy" gem "decidim-phone_authorization_handler", git: "https://github.com/OpenSourcePolitics/decidim-module_phone_authorization_handler", branch: DECIDIM_BRANCH gem "decidim-simple_proposal", git: "https://github.com/mainio/decidim-module-simple_proposal", branch: DECIDIM_BRANCH gem "decidim-slider", git: "https://github.com/alecslupu-pfa/decidim-module-slider", branch: "main" diff --git a/Gemfile.lock b/Gemfile.lock index c8e852b..67770e6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -52,8 +52,8 @@ GIT GIT remote: https://github.com/alecslupu-pfa/decidim-module_homepage_proposals - revision: 995505d587d87fbc7cccaf94822f5f2285105afb - ref: 995505d587d87fbc7cccaf94822f5f2285105afb + revision: 6e3b7a2bfc6e531bb77a4d8ebfb7dd190acee681 + branch: release/0.26-bulk-deploy specs: decidim-homepage_proposals (1.0.2) decidim-core (~> 0.26) From 4bf08667b0dc3dcf9c9a43a2294b98d8e5081ba9 Mon Sep 17 00:00:00 2001 From: Simonas Date: Mon, 27 Nov 2023 17:15:32 +0100 Subject: [PATCH 05/13] fix: Bump module homepage proposals (#79) * Update the module with the fix * fix how the bump is done --- Gemfile | 2 +- Gemfile.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 0bff286..5897a9a 100644 --- a/Gemfile +++ b/Gemfile @@ -16,7 +16,7 @@ gem "decidim-decidim_awesome" gem "decidim-half_signup", git: "https://github.com/OpenSourcePolitics/decidim-module-half_sign_up", branch: DECIDIM_BRANCH gem "decidim-homepage_interactive_map", git: "https://github.com/OpenSourcePolitics/decidim-module-homepage_interactive_map.git", branch: DECIDIM_BRANCH # gem "decidim-homepage_proposals", git: "https://github.com/OpenSourcePolitics/decidim-module_homepage_proposals.git", branch: DECIDIM_BRANCH -gem "decidim-homepage_proposals", git: "https://github.com/alecslupu-pfa/decidim-module_homepage_proposals", ref: "992ed0fcfa32e5b86479e706c71eb6523d61de2b" +gem "decidim-homepage_proposals", git: "https://github.com/alecslupu-pfa/decidim-module_homepage_proposals", branch: "release/0.26-bulk-deploy" gem "decidim-phone_authorization_handler", git: "https://github.com/OpenSourcePolitics/decidim-module_phone_authorization_handler", branch: DECIDIM_BRANCH gem "decidim-simple_proposal", git: "https://github.com/mainio/decidim-module-simple_proposal", branch: DECIDIM_BRANCH gem "decidim-slider", git: "https://github.com/alecslupu-pfa/decidim-module-slider", branch: "main" diff --git a/Gemfile.lock b/Gemfile.lock index 9b424bd..67770e6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -52,8 +52,8 @@ GIT GIT remote: https://github.com/alecslupu-pfa/decidim-module_homepage_proposals - revision: 992ed0fcfa32e5b86479e706c71eb6523d61de2b - ref: 992ed0fcfa32e5b86479e706c71eb6523d61de2b + revision: 6e3b7a2bfc6e531bb77a4d8ebfb7dd190acee681 + branch: release/0.26-bulk-deploy specs: decidim-homepage_proposals (1.0.2) decidim-core (~> 0.26) From 9564016678cb932db56cb3d9640735414741d214 Mon Sep 17 00:00:00 2001 From: Simonas Date: Wed, 29 Nov 2023 10:45:30 +0100 Subject: [PATCH 06/13] Update of the branch for homepage proposals --- Gemfile | 2 +- Gemfile.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 5897a9a..a775264 100644 --- a/Gemfile +++ b/Gemfile @@ -16,7 +16,7 @@ gem "decidim-decidim_awesome" gem "decidim-half_signup", git: "https://github.com/OpenSourcePolitics/decidim-module-half_sign_up", branch: DECIDIM_BRANCH gem "decidim-homepage_interactive_map", git: "https://github.com/OpenSourcePolitics/decidim-module-homepage_interactive_map.git", branch: DECIDIM_BRANCH # gem "decidim-homepage_proposals", git: "https://github.com/OpenSourcePolitics/decidim-module_homepage_proposals.git", branch: DECIDIM_BRANCH -gem "decidim-homepage_proposals", git: "https://github.com/alecslupu-pfa/decidim-module_homepage_proposals", branch: "release/0.26-bulk-deploy" +gem "decidim-homepage_proposals", git: "https://github.com/alecslupu-pfa/decidim-module_homepage_proposals", branch: "release/0.26-stable" gem "decidim-phone_authorization_handler", git: "https://github.com/OpenSourcePolitics/decidim-module_phone_authorization_handler", branch: DECIDIM_BRANCH gem "decidim-simple_proposal", git: "https://github.com/mainio/decidim-module-simple_proposal", branch: DECIDIM_BRANCH gem "decidim-slider", git: "https://github.com/alecslupu-pfa/decidim-module-slider", branch: "main" diff --git a/Gemfile.lock b/Gemfile.lock index 67770e6..343e85b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -52,8 +52,8 @@ GIT GIT remote: https://github.com/alecslupu-pfa/decidim-module_homepage_proposals - revision: 6e3b7a2bfc6e531bb77a4d8ebfb7dd190acee681 - branch: release/0.26-bulk-deploy + revision: 905b8a43403b7042fab9ad7d229ef5df4c11c632 + branch: release/0.26-stable specs: decidim-homepage_proposals (1.0.2) decidim-core (~> 0.26) From 1ecadd80e4a88ea3a3043099e812414bcaeb4ef8 Mon Sep 17 00:00:00 2001 From: Simonas Date: Wed, 29 Nov 2023 12:02:25 +0100 Subject: [PATCH 07/13] Homepage proposals 2.0 fix (#80) * Update the module with the fix * fix how the bump is done * Update of the branch for homepage proposals * fix Gemfile.lock --------- Co-authored-by: moustachu --- Gemfile | 3 +-- Gemfile.lock | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index 5897a9a..25d4485 100644 --- a/Gemfile +++ b/Gemfile @@ -15,8 +15,7 @@ gem "decidim-budgets_paper_ballots", git: "https://github.com/digidemlab/decidim gem "decidim-decidim_awesome" gem "decidim-half_signup", git: "https://github.com/OpenSourcePolitics/decidim-module-half_sign_up", branch: DECIDIM_BRANCH gem "decidim-homepage_interactive_map", git: "https://github.com/OpenSourcePolitics/decidim-module-homepage_interactive_map.git", branch: DECIDIM_BRANCH -# gem "decidim-homepage_proposals", git: "https://github.com/OpenSourcePolitics/decidim-module_homepage_proposals.git", branch: DECIDIM_BRANCH -gem "decidim-homepage_proposals", git: "https://github.com/alecslupu-pfa/decidim-module_homepage_proposals", branch: "release/0.26-bulk-deploy" +gem "decidim-homepage_proposals", git: "https://github.com/alecslupu-pfa/decidim-module_homepage_proposals", branch: "release/0.26-stable" gem "decidim-phone_authorization_handler", git: "https://github.com/OpenSourcePolitics/decidim-module_phone_authorization_handler", branch: DECIDIM_BRANCH gem "decidim-simple_proposal", git: "https://github.com/mainio/decidim-module-simple_proposal", branch: DECIDIM_BRANCH gem "decidim-slider", git: "https://github.com/alecslupu-pfa/decidim-module-slider", branch: "main" diff --git a/Gemfile.lock b/Gemfile.lock index 67770e6..343e85b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -52,8 +52,8 @@ GIT GIT remote: https://github.com/alecslupu-pfa/decidim-module_homepage_proposals - revision: 6e3b7a2bfc6e531bb77a4d8ebfb7dd190acee681 - branch: release/0.26-bulk-deploy + revision: 905b8a43403b7042fab9ad7d229ef5df4c11c632 + branch: release/0.26-stable specs: decidim-homepage_proposals (1.0.2) decidim-core (~> 0.26) From a714decfd43d5f530266eda18ecdca94df6314c8 Mon Sep 17 00:00:00 2001 From: Simonas Date: Thu, 30 Nov 2023 13:06:22 +0100 Subject: [PATCH 08/13] Filter reset when changing category or scope --- Gemfile | 2 +- Gemfile.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index a775264..239d8e0 100644 --- a/Gemfile +++ b/Gemfile @@ -16,7 +16,7 @@ gem "decidim-decidim_awesome" gem "decidim-half_signup", git: "https://github.com/OpenSourcePolitics/decidim-module-half_sign_up", branch: DECIDIM_BRANCH gem "decidim-homepage_interactive_map", git: "https://github.com/OpenSourcePolitics/decidim-module-homepage_interactive_map.git", branch: DECIDIM_BRANCH # gem "decidim-homepage_proposals", git: "https://github.com/OpenSourcePolitics/decidim-module_homepage_proposals.git", branch: DECIDIM_BRANCH -gem "decidim-homepage_proposals", git: "https://github.com/alecslupu-pfa/decidim-module_homepage_proposals", branch: "release/0.26-stable" +gem "decidim-homepage_proposals", git: "https://github.com/alecslupu-pfa/decidim-module_homepage_proposals", branch: "feature/reset-filters" gem "decidim-phone_authorization_handler", git: "https://github.com/OpenSourcePolitics/decidim-module_phone_authorization_handler", branch: DECIDIM_BRANCH gem "decidim-simple_proposal", git: "https://github.com/mainio/decidim-module-simple_proposal", branch: DECIDIM_BRANCH gem "decidim-slider", git: "https://github.com/alecslupu-pfa/decidim-module-slider", branch: "main" diff --git a/Gemfile.lock b/Gemfile.lock index 343e85b..86e96d5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -52,8 +52,8 @@ GIT GIT remote: https://github.com/alecslupu-pfa/decidim-module_homepage_proposals - revision: 905b8a43403b7042fab9ad7d229ef5df4c11c632 - branch: release/0.26-stable + revision: 0407242d42c0a03d87aa7d47292301cbc987c4df + branch: feature/reset-filters specs: decidim-homepage_proposals (1.0.2) decidim-core (~> 0.26) From 30ae5a3271ce3f42d68f4adf6b21f8e03cc99d0f Mon Sep 17 00:00:00 2001 From: Simonas Date: Thu, 30 Nov 2023 13:09:32 +0100 Subject: [PATCH 09/13] fix: Multi-threading compliant term customizer --- Gemfile | 2 +- Gemfile.lock | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index 25d4485..c017aa5 100644 --- a/Gemfile +++ b/Gemfile @@ -20,7 +20,7 @@ gem "decidim-phone_authorization_handler", git: "https://github.com/OpenSourcePo gem "decidim-simple_proposal", git: "https://github.com/mainio/decidim-module-simple_proposal", branch: DECIDIM_BRANCH gem "decidim-slider", git: "https://github.com/alecslupu-pfa/decidim-module-slider", branch: "main" gem "decidim-spam_detection" -gem "decidim-term_customizer", git: "https://github.com/mainio/decidim-module-term_customizer.git", branch: DECIDIM_BRANCH +gem "decidim-term_customizer", git: "https://github.com/opensourcepolitics/decidim-module-term_customizer.git", branch: "fix/multi-threading-compliant-0.26" gem "dotenv-rails" diff --git a/Gemfile.lock b/Gemfile.lock index 343e85b..53e3465 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -77,9 +77,9 @@ GIT decidim-proposals (~> 0.26.0) GIT - remote: https://github.com/mainio/decidim-module-term_customizer.git - revision: f0d720710822f1231ea249dd71f978143d38a6c4 - branch: release/0.26-stable + remote: https://github.com/opensourcepolitics/decidim-module-term_customizer.git + revision: f5208f3cad23cb68e502e77cb0d2d3d441d09e40 + branch: fix/multi-threading-compliant-0.26 specs: decidim-term_customizer (0.26.0) decidim-admin (~> 0.26.0) From fba88bd7782a3f6a67b06597ecd453ce3d705357 Mon Sep 17 00:00:00 2001 From: Simonas Date: Fri, 1 Dec 2023 08:41:00 +0100 Subject: [PATCH 10/13] Urgent mini-bump This solves an issue with card scrolling --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 3e997e9..2ce633f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -52,7 +52,7 @@ GIT GIT remote: https://github.com/alecslupu-pfa/decidim-module_homepage_proposals - revision: 0407242d42c0a03d87aa7d47292301cbc987c4df + revision: 37ac5b73893ab532e06729bef6f5d3b4b6553f35 branch: feature/reset-filters specs: decidim-homepage_proposals (1.0.2) From db9c3d12c1cf153c10c00ee97d261e8ca9bebe04 Mon Sep 17 00:00:00 2001 From: Simonas Date: Mon, 11 Dec 2023 22:26:11 +0100 Subject: [PATCH 11/13] add application override to proposal_m_cell.rb (#85) * add application override to proposal_m_cell.rb * rubocop --------- Co-authored-by: moustachu --- .../decidim/proposals/proposal_m_cell.rb | 153 ++++++++++++++++++ 1 file changed, 153 insertions(+) create mode 100644 app/cells/decidim/proposals/proposal_m_cell.rb diff --git a/app/cells/decidim/proposals/proposal_m_cell.rb b/app/cells/decidim/proposals/proposal_m_cell.rb new file mode 100644 index 0000000..6d00994 --- /dev/null +++ b/app/cells/decidim/proposals/proposal_m_cell.rb @@ -0,0 +1,153 @@ +# frozen_string_literal: true + +require "cell/partial" + +module Decidim + module Proposals + # This cell renders a proposal with its M-size card. + class ProposalMCell < Decidim::CardMCell + include ProposalCellsHelper + + delegate :current_locale, to: :controller + + def badge + render if has_badge? + end + + private + + def preview? + options[:preview] + end + + def title + present(model).title(html_escape: true) + end + + def body + decidim_sanitize_editor(present(model).body) + end + + def has_state? + model.published? + end + + def has_badge? + published_state? || withdrawn? + end + + def has_link_to_resource? + model.published? + end + + def has_footer? + return false if model.emendation? + + true + end + + def description + strip_tags(body).truncate(200, separator: /\s/) + end + + def badge_classes + return super unless options[:full_badge] + + state_classes.concat(["label", "proposal-status"]).join(" ") + end + + def base_statuses + @base_statuses ||= begin + if endorsements_visible? + [:endorsements_count, :comments_count] + else + [:comments_count] + end + end + end + + def statuses + return [] if preview? + return base_statuses if model.draft? + return [:creation_date] + base_statuses if !has_link_to_resource? || !can_be_followed? + + [:creation_date, :follow] + base_statuses + end + + def creation_date_status + explanation = tag.strong(t("activemodel.attributes.common.created_at")) + "#{explanation}
#{l(model.published_at.to_date, format: :decidim_short)}" + end + + def endorsements_count_status + return endorsements_count unless has_link_to_resource? + + link_to resource_path, "aria-label" => "#{t("decidim.endorsable.endorsements_count")}: #{model.endorsements_count}", title: t("decidim.endorsable.endorsements_count") do + endorsements_count + end + end + + def endorsements_count + with_tooltip t("decidim.endorsable.endorsements") do + "#{icon("bullhorn", class: "icon--small")} #{model.endorsements_count}" + end + end + + def progress_bar_progress + model.proposal_votes_count || 0 + end + + def progress_bar_total + model.maximum_votes || 0 + end + + def progress_bar_subtitle_text + if progress_bar_progress >= progress_bar_total + t("decidim.proposals.proposals.votes_count.most_popular_proposal") + else + t("decidim.proposals.proposals.votes_count.need_more_votes") + end + end + + def can_be_followed? + !model.withdrawn? + end + + def endorsements_visible? + model.component.current_settings.endorsements_enabled? + end + + def has_image? + @has_image ||= model.attachments.map(&:image?).any? + end + + def resource_image_path + @resource_image_path ||= has_image? ? model.attachments.find_by("content_type like '%image%'").thumbnail_url : nil + end + + def cache_hash + hash = [] + hash << I18n.locale.to_s + hash << model.cache_key_with_version + hash << model.proposal_votes_count + hash << model.endorsements_count + hash << model.comments_count + hash << Digest::MD5.hexdigest(model.component.cache_key_with_version) + hash << Digest::MD5.hexdigest(resource_image_path) if resource_image_path + hash << render_space? ? 1 : 0 + if current_user + hash << current_user.cache_key_with_version + hash << current_user.follows?(model) ? 1 : 0 + end + hash << model.follows_count + hash << Digest::MD5.hexdigest(model.authors.map(&:cache_key_with_version).to_s) + hash << (model.must_render_translation?(model.organization) ? 1 : 0) if model.respond_to?(:must_render_translation?) + hash << model.component.participatory_space.active_step.id if model.component.participatory_space.try(:active_step) + hash << has_footer? + hash << has_actions? + + hash.join(Decidim.cache_key_separator) + end + end + end +end From 9e8ae6f7fcfaa765d6f5ff13009ca580a797bd70 Mon Sep 17 00:00:00 2001 From: moustachu Date: Mon, 11 Dec 2023 22:04:43 +0100 Subject: [PATCH 12/13] feat: filter bad search bot in NGINX --- .platform/nginx/conf.d/elasticbeanstalk/filter_agent.conf | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .platform/nginx/conf.d/elasticbeanstalk/filter_agent.conf diff --git a/.platform/nginx/conf.d/elasticbeanstalk/filter_agent.conf b/.platform/nginx/conf.d/elasticbeanstalk/filter_agent.conf new file mode 100644 index 0000000..aaebfa0 --- /dev/null +++ b/.platform/nginx/conf.d/elasticbeanstalk/filter_agent.conf @@ -0,0 +1,3 @@ +if ($http_user_agent ~* (AhrefsBot|SemrushBot|SeekportBot|PetalBot|Qwantify-dev|CCBot|Bytespider) ) { + return 202; +} \ No newline at end of file From d5a865bbe7eb0643a1a6160a981278a2b8dbcc6a Mon Sep 17 00:00:00 2001 From: Simonas Date: Thu, 14 Dec 2023 16:59:20 +0100 Subject: [PATCH 13/13] Making card paragraph shorter in proposal_m_cell.rb --- app/cells/decidim/proposals/proposal_m_cell.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/cells/decidim/proposals/proposal_m_cell.rb b/app/cells/decidim/proposals/proposal_m_cell.rb index 6d00994..215c72a 100644 --- a/app/cells/decidim/proposals/proposal_m_cell.rb +++ b/app/cells/decidim/proposals/proposal_m_cell.rb @@ -47,7 +47,7 @@ def has_footer? end def description - strip_tags(body).truncate(200, separator: /\s/) + strip_tags(body).truncate(120, separator: /\s/) end def badge_classes