Dropdown actions for index #2767

Closed
wants to merge 3 commits into from

3 participants

@lporras

When adding many custom actions using index as table you get a large column for actions. This adds a 'dropdown' option to actions method in order to display the actions in a dropdown menu

Some Examples:

To list default actions and customs actions:

index do
  selectable_column
  column :title
  actions dropdown: true do |post|
    item "Preview", admin_preview_post_path(post)
  end
end

To list custom actions without default_actions:

index do
  selectable_column
  column :title
  actions dropdown: true, default: false do |post|
    item "Preview", admin_preview_post_path(post)
  end
end

Preview:

screen shot 2013-12-06 at 10 51 00 am

@coveralls

Coverage Status

Coverage decreased (-0.25%) when pulling 283d61e on lporras:dropdown-actions-for-index into 388ed07 on gregbell:master.

@seanlinsley seanlinsley commented on the diff Dec 8, 2013
features/index/index_as_table.feature
end
end
end
"""
- Then I should not see a member link to "View"
- And I should not see a member link to "Edit"
- And I should not see a member link to "Delete"
- And I should see a member link to "Custom Action"
+ Then I should see a dropdown menu item to "View"
+ And I should see a dropdown menu item to "Edit"
+ And I should not see a dropdown menu item to "Delete"
+ And I should see a dropdown menu item to "Custom Action"
+
+ Scenario: Actions without default actions within a dropdown
@seanlinsley
Active Admin member

I see you repurposed an existing test, but there should really be three different tests:

# 1
actions defaults: false
# 2
actions dropdown: true
# 3
actions dropdown: true, defaults: false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@seanlinsley
Active Admin member

(ping)

@seanlinsley
Active Admin member

Closing due to inactivity :<

@lporras lporras deleted the lporras:dropdown-actions-for-index branch Feb 1, 2014
@lporras lporras referenced this pull request Feb 1, 2014
Closed

Dropdown actions for index #2918

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