guardian/frontend — pull request #4459 by janua (2014-05-28 15:52:49+00:00)
Title: Fix navigation

The navigation in articles is broken and no one seems to have noticed.
I am unsure if this has recently happened because of code churn, or has always been broken since around Feb.

For example, on [this page](http://www.theguardian.com/film/2014/may/21/batman-vs-superman-costume-batsuit-kevin-smith), the article is clearly a `film` article. But it shows up in the main Nav as `World` -> `Us`.

This happens for a lot of different articles. And sometimes, doesn't happen for other articles.

This PR fixes that.

#### Why (Technical)

The searching through `NavItem`s in `Edition` is wrong.

What was happening was we were iterating through the `Edition` `NavItems` and checking if a `MetaData` (`Article`) object belonged to any of the items. One of the comparisons (In the middle of all the ORs) uses the code `page.tags.exists(t => s"/${t.id}" == href)`.

This meant that for EACH `Edition` `NavItem`, we checked if the `SectionLink.href` matched ANY tag.

What happens if an article has the tag `film/film` but also the tag `world/usa`?
Since we are iterating over the `NavItem`s from an `Edition`, this means that the order there wins. In the [example](http://www.theguardian.com/film/2014/may/21/batman-vs-superman-costume-batsuit-kevin-smith) in this PR, `world/usa` comes first in the list of `NavItems` for `Uk`. So unfortunately in the navigation it will show up as `World` -> `Us`.

I have removed the searching of all tags, and moved this search into an explicit method `currentForIncludingAllTags(page)`.

It is slightly weird. We now have `currentFor` AND `currentForIncludingAllTags`. Then we also have `searchForCurrentSublink` that uses both together.
We do this because when searching through a `List` of `NavItem`, we never want to do a search on tags unless the search fails.
If we have only one `NavItem` and a `MetaData` (`Article`), then we want to just do one after the other for this `NavItem`.

This also fixes the `breadcrumbs`.