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

ActiveAdmin::Scope.new now accepts options hash, stores :if as block #555

Merged
merged 1 commit into from
Oct 13, 2011

Conversation

macfanatic
Copy link
Contributor

ActiveAdmin::Scope.new now accepts options hash, stores :if as block, ActiveAdmin::Views::Scopes component optionally displays the scope if the block returns true.

If no :if block is provided, the scope defaults to shown. Updated cukes to reflect & test these changes.

Can be used as:

ActiveAdmin.register Post do

  scope :published, :if => proc { current_admin_user.can?( :manage, Post ) }
  scope "Published", :published, :if => proc { current_admin_user.can?( :manage, Post) }
  scope "Published", :if => proc { current_admin_user.can?( :manage, Posts) } do |posts|
    posts.published
  end

end

… ActiveAdmin::Views::Scopes component optionally displays the scope if the block returns true.

If no :if block is provided, the scope defaults to shown.  Updated cukes to reflect & test these changes.
@gregbell gregbell merged commit db9da12 into activeadmin:master Oct 13, 2011
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.

2 participants