Skip to content
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 group to scopes #322

Closed
wants to merge 0 commits into from
Closed

Add group to scopes #322

wants to merge 0 commits into from

Conversation

McRipper
Copy link
Contributor

This change allow to define a group in the scopes so they can be grouped together with the relative label.

  scopes do
    Dossier.categories_for_select.each do |s|
      scope s[0], -> { Dossier.where(category: s[1]) }, group: 'Category'
    end
  end

@coveralls
Copy link

coveralls commented Sep 11, 2020

Coverage Status

Coverage decreased (-0.03%) to 87.282% when pulling 11775bc on McRipper:master into 746f9ea on TrestleAdmin:master.

@spohlenz
Copy link
Member

I've taken this idea and enhanced it with support for column vs row layouts, mobile support and some improved design. Here is how it looks on a client's project:

Screen Shot 2021-02-15 at 5 26 54 pm

The usage is effectively the same as in your example. Provide the group option on a scope to enable grouping, and additional options can be specified on the scopes call.

# Default layout is :row (as shown in the screenshot) which is different from your initial PR
scopes layout: :columns do
  ...
end

# Disable grouping regardless of scope definitions
scopes group: false do
  ...
end

# Add custom classes to the scopes block
scopes class: "scope-tags" do
  ...
end

I'm aiming to release 0.9.5 tonight with this and other recent improvements and fixes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants