Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Allow custom title for Index pages #1324

Merged
merged 2 commits into from May 16, 2012

Conversation

Projects
None yet
4 participants
Owner

seanlinsley commented May 14, 2012

Because I wanted to override it for my own uses, and thought someone else might like to do so as well :)

I simply copied-and-pasted this code from the show page, as it's the exact functionality I wanted. That way you can do this:

index :title => "Awesome Title" do
  #...
end

This pull request passes (merged e36766b into f83d1aa).

Contributor

pcreux commented May 15, 2012

Could you add specs or features to test this feature? They would be similar to the ones of the show action.

Owner

seanlinsley commented May 15, 2012

Added. Though I took out the symbol/proc functionality because I can't imagine someone using that on an index title.

This pull request passes (merged baba30b into f83d1aa).

@pcreux pcreux added a commit that referenced this pull request May 16, 2012

@pcreux pcreux Merge pull request #1324 from Daxter/custom-title-for-index
Allow custom title for Index pages
e3c6b05

@pcreux pcreux merged commit e3c6b05 into activeadmin:master May 16, 2012

I can see a clear case for adding the symbol/proc functionality to the title attribute here. In the case where a resource is nested inside another, the parent resource would need to be referenced.

Example:

ActiveAdmin.register Product do
    belongs_to :product_category

    index title: proc{ "#{product_category.title} Products" } do
        # etc...
    end
end

Seems like it may always be worth it to keep that option open.

Owner

seanlinsley commented Dec 7, 2012

@amoslanka, I hadn't considered that. Feel free to submit a pull request :)

@seanlinsley seanlinsley deleted the unknown repository branch Feb 8, 2013

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