-
-
Notifications
You must be signed in to change notification settings - Fork 396
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Projects (Budgets) to filtered search #11740
Add Projects (Budgets) to filtered search #11740
Conversation
I think you were right about the tests @andreslucena. I'm having a discussion with @carolromero on what icon to replace Projects with to which we have concluded it would be the same as Budgets |
I think it's related to this association: And this other ActiveRecord method: https://github.com/greenwoodt/decidim/blob/85e53e4b491066c2e12a79c46c343fc4c70c73fa/decidim-core/lib/decidim/has_component.rb#L12-L13 That we're including in the same class. As far as I remember, the problem is that we usually have a simpler relation between the Components and its resources, (like you have a set of Meetings in this Component, and there are Proposals in this other Component). The issue comes that in this case, the relation between the Component and the Projects is done through the Budgets, and adding this concern like that is breaking the Projects creation. You check it out by creating a new Project in the Admin panel. I see the same exception as the specs. I think a better approach could be to actually change the code that registers these models in the Search. Let's try this:
As we're changing code from This is what I have in mind: diff --git a/decidim-budgets/app/models/decidim/budgets/project.rb b/decidim-budgets/app/models/decidim/budgets/project.rb
index 545c632cff..508c73bc49 100644
--- a/decidim-budgets/app/models/decidim/budgets/project.rb
+++ b/decidim-budgets/app/models/decidim/budgets/project.rb
@@ -19,7 +19,6 @@ module Decidim
include Decidim::Searchable
include Decidim::TranslatableResource
include Decidim::FilterableResource
- include Decidim::HasComponent
translatable_fields :title, :description
diff --git a/decidim-core/lib/decidim/searchable.rb b/decidim-core/lib/decidim/searchable.rb
index 6da2b23a94..fa132ffbc1 100644
--- a/decidim-core/lib/decidim/searchable.rb
+++ b/decidim-core/lib/decidim/searchable.rb
@@ -35,7 +35,7 @@ module Decidim
end
def self.searchable_resources_of_type_component
- searchable_resources.select { |r| r.constantize.ancestors.include?(Decidim::HasComponent) }
+ searchable_resources.select { |r| r.constantize.ancestors.include?(Decidim::Searchable) }
end
def self.searchable_resources_of_type_comment Try it out locally and if you see that it works then commit/push and wait for the specs 🤞🏽 |
Thanks Andres I'll give it a go! |
@andreslucena looks like your suggestion worked! Thanks very much! I will now open this for a review by the maintainers! |
Glad to hear that! Lets add an spec here, I think this would be enough: diff --git a/decidim-core/spec/system/search_spec.rb b/decidim-core/spec/system/search_spec.rb
index 9ccb45e386..8bffc83eca 100644
--- a/decidim-core/spec/system/search_spec.rb
+++ b/decidim-core/spec/system/search_spec.rb
@@ -32,6 +32,13 @@ describe "Search", type: :system do
expect(page).to have_content(/results for the search: "#{term}"/i)
expect(page).to have_selector(".filter-search.filter-container")
end
+
+ it "has all the resources to search" do
+ within ".search__filter" do
+ expect(page).to have_content("All")
+ expect(page).to have_content("Participants")
+ # TODO: all the resources
+ end
end
context "when the device is a mobile" do You need to add the list of all the Searchable models, of course. Just having this list would be enough IMO. |
…oodt/decidim into fix/projects-displayed-in-filters
Done! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A change in the spec and this would be good to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
I'll not merge until @alecslupu checks this out, as I was involved in the code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sweet !
LGTM
* develop: (30 commits) Add `process-content` to erb-lint's deprecated classes (#11762) Add possibility of overriding the tailwind.config.js (#11763) Ask old password when changing email or password (#11737) Add Projects (Budgets) to filtered search (#11740) Fix missing results on Geocoded when search without diacritics (#11761) Add robots.txt instructions (#11693) Add missing activerecord budget locales for search (#11766) Improve design of Admin's Sidebar pages (#11759) Show small static map on admin's meetings index with big screens (#11715) Remove "Manage" button when there's a Sidebar (#11717) Fix admin breadcrumb in Process (#11757) Apply new rubocop rules on erb - Layout/MultilineMethodCallIndentation (#11756) Remove xlarge-* references from admin forms (#11712) Apply new rubocop rules on erb - Argument identation (#11707) Update HERE API autocomplete (#11507) Admin redesign proposal issues (#11668) Redesign: responsive links on cards (#11538) Refactor CI pipelines (#11196) Update postcss and graphql to latest versions (#11733) Fix develop pipeline (#11750) ...
🎩 What? Why?
Upon searching through modules as a user, Projects under Budgets were not searchable or available.
📌 Related Issues
Testing
RSPEC test added to
decidim-core/spec/system/search_spec.rb
also.📷 Screenshots
Before:
After: