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 pagination to travel advice #357

Merged
merged 4 commits into from May 11, 2017
Merged

Add pagination to travel advice #357

merged 4 commits into from May 11, 2017

Conversation

@fofr
Copy link
Contributor

@fofr fofr commented May 10, 2017

  • When linking to the first part of a guide, link to the base path. eg: www.gov.uk/attendance-allowance/overview is identical to www.gov.uk/attendance-allowance – avoids duplicate URLs with the same content.
  • This also works with travel advice summaries. Summaries are not included as a part by the content item, but for all purposes, the frontend renders it as a part. Coerce summary into being the first part, which conveniently has no slug, so links to the base_path like the first part of a guide.
  • Now parts logic is common between travel advice and guides the logic for next and previous pagination can be shared
  • Add pagination to travel advice, ensuring that the link to the first part is without slug

Screenshots

screen shot 2017-05-10 at 11 40 56
screen shot 2017-05-10 at 11 41 11
screen shot 2017-05-10 at 11 41 24

fofr added 4 commits May 9, 2017
* Shim summary into parts array as first part
* Summary doesn’t have a slug, the first part of a guide _does_,
however that content is a duplication of what’s shown on the base_path
* For the first part: link to the base path
Rather than manipulating the part path when generating navigation
links, decorate the parts upstream. This will allow previous/next nav
to follow the same rules (eg link to base_path for first part)

Can’t place directly on `parts` because of the way travel advice
overrides the parts method.
* Pull shared logic from guides into parts module
* Use decorated parts so that links to the first part point at base
path rather than the part slug. Update guide presenter test to reflect
this.
* Try to avoid concept of parts and decorated_parts
* Add raw_parts method which gets decorated by parts method, by
splitting the two it allows raw_parts to be overwritten by formats like
travel advice – to coerce summary into a part.
@boffbowsh boffbowsh temporarily deployed to government-frontend-pr-357 May 10, 2017 Inactive
Copy link
Contributor

@theleebriggs theleebriggs left a comment

LGTM 👍 , rebase and we're all good.

@michaelihejirika
Copy link

@michaelihejirika michaelihejirika commented May 11, 2017

I built a local branch the navigations look fine by me

@fofr fofr merged commit d25c86b into master May 11, 2017
2 checks passed
2 checks passed
continuous-integration/jenkins/branch This commit looks good
Details
security/snyk No new vulnerabilities
Details
@fofr fofr deleted the part-nav-travel-advice branch May 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

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