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

`Page#parent` should return first category for pages at root level #147

Closed
gma opened this issue May 4, 2014 · 2 comments
Closed

`Page#parent` should return first category for pages at root level #147

gma opened this issue May 4, 2014 · 2 comments

Comments

@gma
Copy link
Owner

@gma gma commented May 4, 2014

If http://hostname/page-1 is in the page-2 category, I’d like the breadcrumb to say “Home > Page 2 > Page 1”. The breadcrumb is currently just built from the path, so it would say “Home > Page 1”.

The breadcrumb is built from the Page#parent method.

I’d like Page#parent to return a page object for the parent (derived from the URL) or fall back to the page for the first category for pages that sit at the root of the site. If a page sits at the top level and doesn't have any categories, the home page would be returned.

I think this would sort out the breadcrumb.

@jkowens
Copy link
Contributor

@jkowens jkowens commented Sep 30, 2014

Should category priority be considered or should the first category sorted alphabetically be selected?

If a top level page has a category that also has a category is it ok to display the full category hierarchy?

So instead of just "Home > Bugatti Veyron" the breadcrumb would display "Home > Cars > Supercars > Bugatti Veyron" etc.

I ask because I think Page#parent will have to continue up the category chain.

@gma
Copy link
Owner Author

@gma gma commented Oct 2, 2014

Yes, what this ticket is about what you've described as "Home > Cars > Supercars > Bugatti Veyron".

If memory serves all we need to do is to get Page#parent to pull the first category off the list of categories, as the breadcrumb_ancestors method already does the loop (i.e. Page#parent should only return a single page, or nil).

There are already some specs for the #parent method in models_spec.rb.

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

Successfully merging a pull request may close this issue.

2 participants
You can’t perform that action at this time.