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

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

Comments

Projects
None yet
2 participants
@gma
Owner

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

This comment has been minimized.

Show comment
Hide comment
@jkowens

jkowens Sep 30, 2014

Contributor

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.

Contributor

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

This comment has been minimized.

Show comment
Hide comment
@gma

gma Oct 2, 2014

Owner

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.

Owner

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