Skip to content

Commit

Permalink
Upgrade decidim-regulations module
Browse files Browse the repository at this point in the history
  • Loading branch information
laurajaime committed Oct 2, 2024
1 parent d0d6991 commit 1fb0739
Show file tree
Hide file tree
Showing 26 changed files with 206 additions and 424 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ gem "decidim-templates", DECIDIM_VERSION
gem "decidim-home", path: "decidim-home"
gem "decidim-process-extended", path: "decidim-process-extended"
gem "decidim-recaptcha", path: "decidim-recaptcha"
# gem "decidim-regulations", path: "decidim-regulations"
gem "decidim-regulations", path: "decidim-regulations"
gem "decidim-top_comments", path: "decidim-top_comments"

gem "decidim-cdtb"
Expand Down
12 changes: 10 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,12 @@ PATH
decidim-recaptcha (0.1.0)
decidim-core (= 0.28.2)

PATH
remote: decidim-regulations
specs:
decidim-regulations (0.1.3)
rails (>= 5.2, < 7.0.x)

PATH
remote: decidim-top_comments
specs:
Expand Down Expand Up @@ -515,9 +521,10 @@ GEM
marcel (1.0.4)
matrix (0.4.2)
method_source (1.1.0)
mime-types (3.5.2)
mime-types (3.6.0)
logger
mime-types-data (~> 3.2015)
mime-types-data (3.2024.0903)
mime-types-data (3.2024.1001)
mini_magick (4.13.2)
mini_mime (1.1.5)
minitest (5.25.1)
Expand Down Expand Up @@ -858,6 +865,7 @@ DEPENDENCIES
decidim-home!
decidim-process-extended!
decidim-recaptcha!
decidim-regulations!
decidim-templates!
decidim-top_comments!
deface
Expand Down
5 changes: 0 additions & 5 deletions app/decorators/decidim/admin/newsletters_helper_decorator.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# frozen_string_literal: true

# rubocop:disable Metrics/CyclomaticComplexity
# rubocop:disable Metrics/PerceivedComplexity
module Decidim::Admin::NewslettersHelperDecorator
def self.decorate
Decidim::Admin::NewslettersHelper.class_eval do
Expand Down Expand Up @@ -57,6 +55,3 @@ def filter_spaces_by_process_group(space_type)
end

::Decidim::Admin::NewslettersHelperDecorator.decorate

# rubocop:enable Metrics/CyclomaticComplexity
# rubocop:enable Metrics/PerceivedComplexity
4 changes: 2 additions & 2 deletions config/initializers/decidim.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
config.expire_session_after= (ENV["EXPIRE_SESSION_AFTER"].presence || 0.5).to_f.hours

config.follow_http_x_forwarded_host = Rails.application.secrets.decidim[:follow_http_x_forwarded_host].present?

# Configure CSP for Algolia search for Decidim Finder
config.content_security_policies_extra = {
"connect-src" => %w(https://*.algolianet.com https://*.algolianet.net),
Expand All @@ -76,7 +76,7 @@
end

Decidim.menu :home_content_block_menu do |menu|
menu.add_item :meetings, I18n.t("decidim.menu.meetings_static"), "/meetings", position: 13, active: :inclusive
menu.add_item :meetings, I18n.t("decidim.menu.meetings_static"), "/meetings", active: :inclusive
end

Rails.application.config.i18n.available_locales = Decidim.available_locales
Expand Down
7 changes: 3 additions & 4 deletions config/initializers/menus.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
Rails.application.config.to_prepare do
Decidim.menu :home_content_block_menu do |menu|
menu.add_item :decidims_finder,
I18n.t("menu.decidims_finder", scope: "participagencat"),
Rails.application.routes.url_helpers.decidims_finder_page_path,
position: 14,
active: :inclusive
I18n.t("menu.decidims_finder", scope: "participagencat"),
Rails.application.routes.url_helpers.decidims_finder_page_path,
active: :inclusive
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def metadata_valued_items

{
title: t(item, scope: translations_scope),
value:
value: value
}
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def self.decorate

def metadata_items
%w(participatory_scope target participatory_structure area_name meta_scope local_area developer_group
promoting_unit facilitators cost has_summary_record email)
promoting_unit facilitators cost has_summary_record email)
end
end
end
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,31 @@
module Decidim
module Regulations
module ContentBlocks
class HighlightedRegulationsCell < Decidim::ViewModel
include Decidim::SanitizeHelper

delegate :current_organization, to: :controller
class HighlightedRegulationsCell < Decidim::ContentBlocks::HighlightedParticipatorySpacesCell
delegate :current_user, to: :controller

def show
if single_regulation?
render "single_regulation"
elsif highlighted_regulations.any?
render
end
def highlighted_spaces
@highlighted_spaces ||= highlighted_regulations
end

def single_regulation?
highlighted_regulations.to_a.length == 1
alias limited_highlighted_spaces highlighted_spaces

def i18n_scope
"decidim.regulations.pages.home.highlighted_regulations"
end

def all_path
Decidim::ParticipatoryProcesses::Engine.routes.url_helpers.participatory_processes_path
end

def max_results
model.settings.max_results
end

private

def block_id
"highlighted-regulations"
end

def highlighted_regulations
Expand All @@ -29,14 +38,6 @@ def highlighted_regulations
.order(published_at: :desc)
.limit(8)
end

def i18n_scope
"decidim.regulations.pages.home.highlighted_regulations"
end

def decidim_participatory_processes
Decidim::ParticipatoryProcesses::Engine.routes.url_helpers
end
end
end
end
Expand Down
Loading

0 comments on commit 1fb0739

Please sign in to comment.