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

Default text for back link #792

Closed
web-bert opened this issue Jun 14, 2018 · 4 comments
Closed

Default text for back link #792

web-bert opened this issue Jun 14, 2018 · 4 comments

Comments

@web-bert
Copy link
Contributor

Considering the component is called "back-link" I think it would make sense to default the text to "Back" if none is provided - then you only need to specify the text when you want to override the default?

@web-bert
Copy link
Contributor Author

I have done this locally and it works:

<a href="{%- if params.href %}{{ params.href }}{% else %}#{% endif -%}" class="govuk-back-link{%- if params.classes %} {{ params.classes }}{% endif -%}"
  {%- for attribute, value in params.attributes %} {{attribute}}="{{value}}"{% endfor %}>{{ (params.html | safe if params.html else (params.text if params.text else 'Back')) }}</a>

@NickColley
Copy link
Contributor

NickColley commented Jun 14, 2018

Hey @web-bert this sounds great, do you want to do a Pull Request for that?

We'd want to add a test for this behaviour, and also update any guidance to remove it's requirement.

@web-bert
Copy link
Contributor Author

Sure, can I clone this repo and push a branch or do I have to fork?

@NickColley
Copy link
Contributor

You'll have to fork this repository since you're not a maintainer.

web-bert added a commit to web-bert/govuk-frontend that referenced this issue Jun 15, 2018
If you don't specify either html or text params there would be no text output
This adds default text of 'Back' in this case so you can call with only an href param
Closes issue alphagov#792
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants