Skip to content

Add per_page option in Admin for participants#5480

Closed
agustibr wants to merge 8 commits intodecidim:masterfrom
CodiTramuntana:feat/admin_per_page_participant_index
Closed

Add per_page option in Admin for participants#5480
agustibr wants to merge 8 commits intodecidim:masterfrom
CodiTramuntana:feat/admin_per_page_participant_index

Conversation

@agustibr
Copy link
Copy Markdown
Contributor

@agustibr agustibr commented Nov 8, 2019

🎩 What? Why?

Add pagination options to select how many results are shown per page in admin:

  • participants
  • proposals
  • participatory_processes
  • assemblies
  • initiatives
  • conferences
  • consultations

📌 Related Issues

📋 Subtasks

  • Add CHANGELOG entry
  • Add documentation regarding the feature
  • Add tests

📷 Screenshots (optional)

Captura de pantalla de 2019-11-13 15-39-07

@agustibr agustibr changed the title Add per_page option in participant index Add per_page option in Admin participant index Nov 8, 2019
@agustibr agustibr force-pushed the feat/admin_per_page_participant_index branch 2 times, most recently from bd90b63 to dd0dc8f Compare November 8, 2019 14:35
@agustibr agustibr marked this pull request as ready for review November 8, 2019 14:36
@agustibr agustibr requested a review from a team as a code owner November 8, 2019 14:36
@agustibr agustibr force-pushed the feat/admin_per_page_participant_index branch 3 times, most recently from bd7e147 to b551c1c Compare November 13, 2019 14:43
Copy link
Copy Markdown
Contributor

@tramuntanal tramuntanal left a comment

Choose a reason for hiding this comment

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

thanks @agustibr , I'lve left just some comments regarding documentation and foundation.

@agustibr agustibr changed the title Add per_page option in Admin participant index Add per_page option in Admin for participants, proposals and spaces indexes Nov 14, 2019
@agustibr
Copy link
Copy Markdown
Contributor Author

Thanks @tramuntanal I'll check your review

Copy link
Copy Markdown
Contributor

@aitorlb aitorlb left a comment

Choose a reason for hiding this comment

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

As talked offline, this PR should only apply per page to participants, so @jarvisct can finish the rest of the functionality in #5454.

@agustibr agustibr force-pushed the feat/admin_per_page_participant_index branch from 89966e2 to 67d6de8 Compare December 3, 2019 09:41
@agustibr
Copy link
Copy Markdown
Contributor Author

agustibr commented Dec 3, 2019

@jarvisct I've removed all the functionality, so it only remains the functionality affecting participants

@agustibr agustibr changed the title Add per_page option in Admin for participants, proposals and spaces indexes Add per_page option in Admin for participants Dec 3, 2019
helper Decidim::Admin::IconLinkHelper
helper Decidim::Admin::MenuHelper
helper Decidim::Admin::ScopesHelper
helper Decidim::Admin::Paginable::PerPageHelper
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.

Why not declaring this helper inside the Decidim::Admin::Paginable concern itself?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yes, why not!

module Paginable
# This module includes helpers the :per_page cell's option
module PerPageHelper
def per_page_options
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.

If this method does not need to make use of Action View helpers, I would rather move this logic inside the Decidim::Admin::Paginable concern.

Instead, it would be nice to expose some helper method to easily render the cell from the views, i.e.:

property :per_page, :per_page_range, :with_label

def path_for_num_per_page(num_per_page = per_page_range.first)
%(#{request.path}?per_page=#{num_per_page})
Copy link
Copy Markdown
Contributor

@aitorlb aitorlb Dec 4, 2019

Choose a reason for hiding this comment

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

For this to work alongside existing params it should be changed to something like:

controller.url_for(params.to_unsafe_h.merge(per_page: num_per_page))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Well this was intended, as when the :per_page value changes the :page value has to be cleared.
But yes maybe it could be removed only the :page and mantainthe rest of them.

@agustibr agustibr closed this Dec 17, 2019
@tramuntanal tramuntanal deleted the feat/admin_per_page_participant_index branch February 19, 2021 16:53
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.

3 participants