Skip to content

Add search filters to admin proposals, participation spaces and participants#5503

Merged
tramuntanal merged 43 commits intomasterfrom
feature/add_search_bar_and_filters_to_proposals
Jan 28, 2020
Merged

Add search filters to admin proposals, participation spaces and participants#5503
tramuntanal merged 43 commits intomasterfrom
feature/add_search_bar_and_filters_to_proposals

Conversation

@tramuntanal
Copy link
Copy Markdown
Contributor

@tramuntanal tramuntanal commented Nov 19, 2019

🎩 What? Why?

This PR reworks and extends the following admin filters:

  • list of proposals
  • list of participants
  • list of spaces in each participation space

It started as the PR for filtering proposals in the admin, but as this was the most complex filter, it served as the common point of development for the rest of filters and all were finally merged here.

📌 Related Issues

📋 Subtasks

  • Add CHANGELOG entry
  • Add documentation regarding the feature
  • Add/modify seeds
  • Add tests
  • Add search options by proposal ID or title
  • Add filter options by status, category and scopes.

📷 Screenshots (optional)

image

@tramuntanal tramuntanal self-assigned this Nov 19, 2019
@tramuntanal tramuntanal changed the title Add search filters to admin proposals. [WIP] Add search filters to admin proposals. Nov 19, 2019
@tramuntanal tramuntanal changed the title [WIP] Add search filters to admin proposals. Add search filters to admin proposals. Nov 22, 2019
@carolromero
Copy link
Copy Markdown
Member

Hello @tramuntanal, I've tested this and I have some comments:

Regarding the design:

a) Now that we incorporate more elements in the component tables it is important to take into account aspects of information architecture and try to standardize it in all the tables of the admin panel.

The hierarchy should be Menu > Search/Filters > Pagination. The ideal layout would be something like this:

imatge

This way we will avoid incosistences like this:
imatge

b) Also for consistency reasons, the default type filter has associated icons. It is better to remove these icons and, following the criteria of the rest of the filters, replace them with "Type: "

Insted of:
imatge

This:
imatge

Regarding the functioning:

a) Every time a filter is applied, the filter appears expanded for a moment, it is a strange behavior. Can we prevent the filter from deploying every time?

filters

b) I've seen that now the search bars for other components overlap. Can you check it please?

imatge

@tramuntanal
Copy link
Copy Markdown
Contributor Author

@agustibr can you reveiw please?

Copy link
Copy Markdown
Contributor

@agustibr agustibr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good work, left some comments.

@@ -0,0 +1,30 @@
<div class="filters__section">
<div class="fcell filter">
<ul class="dropdown menu" data-dropdown-menu data-close-on-click-inside="false">
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd move the <ul> inside the admin_filter helper method

html << content_tag(:span, class: "label secondary") do
tag = "#{t("models.proposal.fields.state", scope: "decidim.proposals")}: "
tag += humanize_proposal_state "not_answered"
tag += icon_link_to("circle-x", url_for(q: ransak_params_for_query_without(:state_null)), t("decidim.admin.actions.cancel"), class: "action-icon--remove")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The per_page params are not passed

tramuntanal and others added 2 commits December 13, 2019 19:27
* Upgrade rack-cors gem to 1.1.0. (#5527)

* Upgrade rack-cors gem to 1.1.0.

* Add changelog entry.

* Standardize proposal answer callout styles (#5530)

* Add CHANGELOG entry

* Generalize the proposal answer callout styling

* Update the proposals system spec (answer callout styling classes)

* make use of AnnouncementCell

* Fix: Edit component permissions when PermissionsForm validations fail (#5458)

* Fix: Edit component permissions when PermissionsForm validations fail

* Add CHANGELOG entry

* Drop unnecessary condition

Errors added to the Form object are already taken into account.

* Revert "Drop unnecessary condition"

This reverts commit 5680df5.

Not so unnecessary after all, since it prevents logic errors by returning early
when the conditions required to check nested attribute errors are not met.

* Add helper method to paginable

* Add filterable base concern

* Add filterable test examples

* Add filterable to consultations

* Add filterable to conferences

* Remove Continuity badge (#5565)

* Remove Continuity badge

* Add Changelog entry

* Upgrade puma gem to v3.12.2. (#5556)

* Upgrade puma gem to v3.12.2.

* Add changelog entry.

* New Crowdin translations (#5546)

* New translations en.yml (Italian)

* New translations en.yml (Russian with many plural form)

* New translations en.yml (Finnish (plain))

* New translations en.yml (Turkish)

* New translations en.yml (Swedish)

* New translations en.yml (Spanish, Paraguay)

* New translations en.yml (Spanish, Mexico)

* New translations en.yml (Spanish)

* New translations en.yml (Portuguese, Brazilian)

* New translations en.yml (Portuguese)

* New translations en.yml (Polish)

* New translations en.yml (Indonesian)

* New translations en.yml (Arabic)

* New translations en.yml (Hungarian)

* New translations en.yml (German)

* New translations en.yml (Galician)

* New translations en.yml (French)

* New translations en.yml (Finnish)

* New translations en.yml (Dutch)

* New translations en.yml (Czech)

* New translations en.yml (Catalan)

* New translations en.yml (Basque)

* New translations en.yml (Ukrainian with many plural form)

* New translations en.yml (Finnish)

* New translations en.yml (Italian)

* New translations en.yml (Catalan)

* New translations en.yml (Swedish)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Finnish)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Dutch)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Dutch)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Hungarian)

* New translations en.yml (Italian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Norwegian)

* New translations en.yml (Finnish (plain))

* Improved visiblity of buttons: new proposal, debate and initiative (#5535)

* Improved visiblity of buttons: new proposal, debate and initiative

* [FIX] updated changelog

* [FIX] specified module affected in changelog

* feat admin: move process_groups from main_menu to process :secondary_nav (#5545)

* [Fix] Cluttered conference sessions in confirmation mail (#5524)

* [Fix] Cluttered conference sessions in confirmation mail

* Add entry CHANGELOG.md

* Fix error in confirmation email

* Fix dynamic controller extensions (undefined method `current_user`) (#5533)

* Add CHANGELOG entry

* Remove duplicate entry from CHANGELOG

* Fix crashing bug with dynamic controller extensions

When dynamically adding route extensions, Decidim would throw the
following error:

`alias_method': undefined method `current_user' for class
`Decidim::ApplicationController' (NameError)

* Add CHANGELOG entry

* Remove banner image resizing (#5567)

* Remove banner image resizing

* Add changelog entry

* Add upgrade note for SocialShareButton (#5574)

* Add filterable to initiatives

* Add filterable to assemblies

* Add filterable to processes

* Add filterable to participants (#38)

* Add filterable to participants

* Changelog entry added

* Changelog entry updated

* Refactor filterable to allow nested dropdown submenu options

* Add filterable to proposals

* Remove unused code

* Add CHANGELOG entry

* Get rid of Loofah's deprecation message. (#5576)

* Get rid of Loofah's deprecation message.

* Changelog entry.

* [ci skip] Fix typo on Proposals i18n (#5578)

* Docs: Adds subdomain on checklist (#5577)

* Update CHANGELOG.md

* Bump version

* Refine/v0.20 (#5611)

* Rubocopify initiatives.

* Update documentation for Releasing new versions.

* Apply GHSA-hrqr-hxpp-chr3 security fix for 'rack' gem.

* Apply bundle install for new rack version.

* Rubocopify decidim-forms and decidim-surveys.

* Back to Ruby 2.5.3 until wkhtmltopdf-binary is updated.

* Remove unnecessary empty 'h.merge'.

* [DOC] Still improve documentation for "Releasing new versions".

* Update reference to previous changes in CHANGELOG.md.

* Update version to 0.21.0-dev.

* Use 0.21.0-dev in Gemfile.lock files. (#5619)

* Use 0.21.0-dev in Gemfile.lock files.

* Use 0.21.0.pre.dev as devel version.

* Fix: data_portability_export email download (#5342)

* Upload and retreive the file with carrierwave

* Refactor following Decidim::OpenDataExporter design

* Use random string for non password-protected zip

* [REFACTOR] Remove commented sentence.

* [DOC] Clarify comment in method signature.

* [FEATURE] Make assemblies searchable.

* [TEST|REFACTOR] Extract test into shared example for all kinds of participatory spaces.

* Update when assemblies should be indexed on update.

* [FEATURE] Make ParticipatoryProcesses searchable.

* [FEATURE] Make conferences searchable.

* [FEATURE] Make consultations searchable.

* [FEATURE] Make Initiatives searchable.

* Update changelog with update notes for new searchables.

* [DOC] Update how to index a resource in the Global Search.

* [FEATURE] Make Debates searchable.

* [REFACTOR] Review prioritization of indexed fields.
Force seeds resources to be indexed on creation.

* Rubocopify.

* [FEATURE] Make Results searchable.

* Rubocopify.

* [FEATURE] Do not index resources if manifest don't allow it.

* [TEST] Make Result temporarily searchable during test to make it succeed.

* [FEATURE] Make blog Posts and budget Projects searchable.

* [TEST] Transliterate Proposal title and body before comparing.

* [FEATURE] Adapt global search results view to many types.

* ERB linter.

* Update decidim-generators/Gemfile.lock and decidim_app-design/Gemfile.lock.

* Normalize core locales and remove unused keys.

* Remove unnecessary `add_to_index_as_search_resource` in assembly seeds.

* Specs for the DataPortabilityExporter.

* Remove specs for DataPortabilityFileReader that doesn't exist anymore.

* [TEST] Wait for jobs open during the main job.

* Fix bad changelog merge.

* Update decidim-core/app/services/decidim/data_portability_exporter.rb

* [REFACTOR] Split DataPortabilityExporter#data method into smaller methods.

* [FEAT] Removing data portability files now supports AWS S3 storage.

* [DOC] Update documentation.

* Add changelog entry.

* [TEST] Make sure data portability removal rake task spec doesn't mess with other tests in the cloud.

Co-authored-by: Oliver Valls <tramuntanal@gmail.com>

* [DOC] Fix bad changelog after merging PR against previous version.

* Fix metrics docs (#5587)

* add fix metrics docs

* Edit: fix metrics docs (#26)

* Edit fix metrics doc

* Fix typo

* Edit text

* [REFACTOR] Remove commented sentence.

* [DOC] Clarify comment in method signature.

* [FEATURE] Make assemblies searchable.

* [TEST|REFACTOR] Extract test into shared example for all kinds of participatory spaces.

* Update when assemblies should be indexed on update.

* [FEATURE] Make ParticipatoryProcesses searchable.

* [FEATURE] Make conferences searchable.

* [FEATURE] Make consultations searchable.

* [FEATURE] Make Initiatives searchable.

* Update changelog with update notes for new searchables.

* [DOC] Update how to index a resource in the Global Search.

* [FEATURE] Make Debates searchable.

* [REFACTOR] Review prioritization of indexed fields.
Force seeds resources to be indexed on creation.

* Rubocopify.

* [FEATURE] Make Results searchable.

* Rubocopify.

* [FEATURE] Do not index resources if manifest don't allow it.

* [TEST] Make Result temporarily searchable during test to make it succeed.

* [FEATURE] Make blog Posts and budget Projects searchable.

* [TEST] Transliterate Proposal title and body before comparing.

* [FEATURE] Adapt global search results view to many types.

* ERB linter.

* Add some helpful queries.

* Remove line that was added by mistake.

* Resolve changelog conflicts.

* [DOC] Set changelog as in Decidim master.

* Update changelog after releasing v0.20.0.

Co-authored-by: Isaac Massot <isaacmassot@gmail.com>

* Fix use incrementing date when rebuilding since one date. (#5541)

* Fix use incrementing date when rebuilding since one date.

* Add changelog entry.

* Refactor for better readability and add output to logger.

* Rubocopify.

* Update changelog after upgrading master to v0.21.0.

* Change: Extend the capabilities of the Quill text editor (#5488)

* [REFACTOR] Remove commented sentence.

* [DOC] Clarify comment in method signature.

* [FEATURE] Make assemblies searchable.

* [TEST|REFACTOR] Extract test into shared example for all kinds of participatory spaces.

* Update when assemblies should be indexed on update.

* [FEATURE] Make ParticipatoryProcesses searchable.

* [FEATURE] Make conferences searchable.

* [FEATURE] Make consultations searchable.

* [FEATURE] Make Initiatives searchable.

* Update changelog with update notes for new searchables.

* [DOC] Update how to index a resource in the Global Search.

* [FEATURE] Make Debates searchable.

* [REFACTOR] Review prioritization of indexed fields.
Force seeds resources to be indexed on creation.

* Rubocopify.

* [FEATURE] Make Results searchable.

* Rubocopify.

* [FEATURE] Do not index resources if manifest don't allow it.

* [TEST] Make Result temporarily searchable during test to make it succeed.

* [FEATURE] Make blog Posts and budget Projects searchable.

* [TEST] Transliterate Proposal title and body before comparing.

* [FEATURE] Adapt global search results view to many types.

* ERB linter.

* Move diffy gem dependecy from to decidim-core

* Refactor: extract new_settings_schema logic into class method

* Add ComponentForm validations for proposals

For the time being this feature is made incompatible via validation with:
- Collaborative drafts (needs refactor to pass params via POST)
- Participatory texts (technical difficulties)

* Add component settings for debates

* Extend quill editor in admin (full toolbar) and add it to remaining components

* Update presenters

* Add editor and rendereing logic for public view

* Add tests for quill editor and html rendering in frontend

* Add option to view HTML unescaped for better user experience in diff cell

* Update amendments with quill editor and diff improvements

* Move "rich text editor" setting from component to organization

* Fix hashtagable behaviour with quilljs

* Add CHANGELOG entry

* rename attribute to :rich_text_editor_in_public_views

* renamed spec examples to "with rich text editor content"

* [DOC] Set changelog as in Decidim master.

* Update Gemfile.locks due to bad merge from master.

* Fix for CI tests.

Co-authored-by: Oliver Valls <tramuntanal@gmail.com>
Co-authored-by: Agusti B.R. <agustibr@users.noreply.github.com>

* [Feature] Newsletter participants count (#5555)

* New route added

* Refactor query

* Update controller

* Update views

* Update javascript

* Add tests

* Fix error in tests

* Entry changelog added

* Changes in javascript

* Error in css fixed

* Refactor

* Refactor

* Fix CHANGELOG.md entries

Co-authored-by: Oliver Valls <tramuntanal@gmail.com>

* Feature/multitenant timezone (#5607)

* add time_zone configutation to organizations

* make controllers use time_zone from organization

* calendar export as local times

* use UTC in ical definition. remove unecessary concen

* rubocop

* add tests

* changelog

* remove unecessary lib

* update a gem to rebuild cache

* fix comments

* changelog rebase mess fix

Co-authored-by: Oliver Valls <tramuntanal@gmail.com>

* Feature/assembly types (#5616)

* assemblies migrations

* fixed migrations

* migration fixes

* admin type form

* assembly form

* crud commands

* basic controller

* permissions specs

* Refine/v0.20 (#5611)

* Rubocopify initiatives.

* Update documentation for Releasing new versions.

* Apply GHSA-hrqr-hxpp-chr3 security fix for 'rack' gem.

* Apply bundle install for new rack version.

* Rubocopify decidim-forms and decidim-surveys.

* Back to Ruby 2.5.3 until wkhtmltopdf-binary is updated.

* Remove unnecessary empty 'h.merge'.

* [DOC] Still improve documentation for "Releasing new versions".

* fix rollback migrate

* assemblies controller

* assemblies commands tests

* correct broken generation files

* use assembly type in public views/presenters

* use assembly type in public views/presenters

* fuckdapolice

* normalize yaml

* key unused keys for migrations

* fix permissions and tests

* changelog

* add traceability to type crud

* add tests. fix new type controller action

Co-authored-by: Oliver Valls <tramuntanal@gmail.com>

* Fix email_regexp and add model test (#5560)

* Fix email_regex and add model test

* Add changelog entry

Co-authored-by: Oliver Valls <tramuntanal@gmail.com>

* [FIX] Remove reference to a given installation's dir. (#5623)

* [FIX] Remove reference to a given installation's dir.

* Rubocopify.

* Add overflow property to cards

* Run rubocop

Co-authored-by: Oliver Valls <tramuntanal@gmail.com>
Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi>
Co-authored-by: Marc Riera <mrc2407@gmail.com>
Co-authored-by: decidim-bot <decidim-bot@users.noreply.github.com>
Co-authored-by: victorol1 <56717126+victorol1@users.noreply.github.com>
Co-authored-by: Agusti B.R. <agustibr@users.noreply.github.com>
Co-authored-by: jarvisct <57717422+jarvisct@users.noreply.github.com>
Co-authored-by: Andrés Pereira de Lucena <andreslucena@users.noreply.github.com>
Co-authored-by: Isaac Massot <isaacmassot@gmail.com>
Co-authored-by: Ivan Vergés <ivan@platoniq.net>
Co-authored-by: Mijail Rondon <mijail@riseup.net>
Copy link
Copy Markdown

@qlty-cloud-legacy qlty-cloud-legacy bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR diff size of 8181 lines exceeds the maximum allowed for the inline comments feature.

@andreslucena andreslucena mentioned this pull request Jan 28, 2020
7 tasks
@tramuntanal tramuntanal merged commit f6fefe1 into master Jan 28, 2020
@tramuntanal tramuntanal deleted the feature/add_search_bar_and_filters_to_proposals branch January 28, 2020 14:15
@mrcasals
Copy link
Copy Markdown
Contributor

mrcasals commented Feb 5, 2020

Hi @decidim/core @tramuntanal! I'm trying to use this feature in #5687: I need to assign proposals to user roles, so the data structure looks like this:

Proposal has_and_belongs_to_many user_roles

(If you check my PR, this is done via the ValuationAssignment module).

Some of the Acceptance Criteria for the related issue (#5633) is that admins should be able to filter by the assigned valuator (using the valuator user role). The thing is, the gem you used to implement these filters, ransack, doesn't seem flexible enough to do what I need. Then I remembered Decidim already has a system to search inside a component, in the public area, that uses searchlight.

How come you used ransack for the admin area instead of using searchlight?

Thanks! 😄

@tramuntanal
Copy link
Copy Markdown
Contributor Author

tramuntanal commented Feb 8, 2020

Hi @mrcasals
As you may remember from when you were in the core team a long time ago, ransack was introduced in #2419 because it makes easier to implement sortable columns.
It was not a problem at these moment as you can see by the comment: #2419 (review)
I guess it was a trade-off made by the developer and the core team at the moment and it seemed a good option.

Not being a Ransacker expert, afaik this gem excels at helping implement search forms (filters) and sorting columns, and is currently maintained.

You can find examples on how to implement searches over HABTM relations here: activerecord-hackery/ransack#164 (comment)
I agree with you that this searches are not trivial, but indeed can be solved using Arel.

cc/ @decidim/product

@tramuntanal tramuntanal changed the title Add search filters to admin proposals. Add search filters to admin proposals, participation spaces and participants Feb 8, 2020
@mrcasals
Copy link
Copy Markdown
Contributor

mrcasals commented Feb 8, 2020

@tramuntanal sorry for not updating my comment, I finally managed to solve the issue I was having, thanks!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

project: AM2019 Barcelona City Council contract

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants