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 .actions method for index as table #1834

Merged
merged 1 commit into from
Mar 5, 2013

Conversation

ejholmes
Copy link
Contributor

I've always wanted to be able to easily extend the default actions. This adds an actions method when using index as table.

Some examples:

# Works just like before
default_actions

# Same as above
actions

# Append some actions onto the end of the default actions
actions do |resource|
  auto_link resource
end

# Custom actions without the defaults.
actions :defaults => false do |resource|
  auto_link resource
end

Would love some feedback/suggestions.

@orlando
Copy link

orlando commented Jan 3, 2013

👍 i just implemented something like this last week. it will be awesome to have it right build in.

@gregbell
Copy link
Contributor

Hi @ejholmes,

This looks great - however we need some tests and documentation before we can merge this feature in.

The default actions are tested in the cucumber features at https://github.com/gregbell/active_admin/blob/master/features/index/index_as_table.feature#L83 and documentation can be found at https://github.com/gregbell/active_admin/blob/master/docs/3-index-pages/index-as-table.md

I'd be glad to merge this feature in (and I think there's support for it) if you could please update the pull request with these items.

@ejholmes
Copy link
Contributor Author

Will do.

@ejholmes
Copy link
Contributor Author

Added tests and updated the documentation!

@macfanatic macfanatic merged commit c633344 into activeadmin:master Mar 5, 2013
@amoslanka
Copy link

Adding :only and :except on the actions method would be another nice addition. This could be:

actions only: :show
# or
actions except: :destroy do 
    link_to "Some other action"
end

@bartezic
Copy link

bartezic commented Jun 4, 2013

How i can add few custom actions to default actions?

actions do |tour|
  link_to "Clone", {:action => 'clone', :id => tour }, :method => :put
  link_to "Share", {:action => 'share', :id => tour }, :method => :put 
end

Now I can add correctly only one action.

@seanlinsley
Copy link
Contributor

@bartezic answered your (reposted) question in #53.

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.

7 participants