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

Update organisation switcher link logic #67

Merged
merged 1 commit into from
Aug 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions app/views/components/organisation-switcher/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,24 @@ <h2 class="govuk-heading-l">Example 1</h2>
href: '#'
}
}) }}

<br>

<h2 class="govuk-heading-l">Example 2</h2>
{{ mojOrganisationSwitcher({
text: 'HMP Brixton, HMP/YOI Feltham, HMP/YOI Isis, HMP Pentonville, HMP Thameside, HMP Wandsworth, HMP Wormwood Scrubs',
link: {
text: "Change prisons",
href: '#'
}
}) }}

<br>

<h2 class="govuk-heading-l">Example 3</h2>
{{ mojOrganisationSwitcher({
text: 'HMP Brixton'
}) }}

</div>

</div>
Expand Down
14 changes: 9 additions & 5 deletions src/moj/components/organisation-switcher/template.njk
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
<div {% if params.id %}id="{{ params.id }}"{% endif -%} class="moj-organisation-nav {{- ' ' + params.classes if params.classes}}" aria-label="{{ params.label | default('Organisation switcher') }}" {%- for attribute, value in params.attributes -%} {{ attribute }}="{{ value }}"{% endfor %}>
<div {%- if params.id %} id="{{ params.id }}"{% endif %} class="moj-organisation-nav {{- ' ' + params.classes if params.classes }}" aria-label="{{ params.label | default('Organisation switcher') }}" {%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor %}>
<div class="moj-organisation-nav__title">
{{- params.html | safe if params.html else params.text -}}
</div>
<a {% if params.link.id %}id="{{ params.link.id }}"{% endif -%} href="{{ params.link.href }}" class="moj-organisation-nav__link {{- ' ' + params.link.classes if params.link.classes}}" {%- for attribute, value in params.link.attributes -%} {{ attribute }}="{{ value }}"{% endfor %}>
{{- params.link.html | safe if params.link.html else params.link.text | default('Change organisation') -}}
</a>
</div>

{% if params.link %}
{%- set linkText = params.link.text | default('Change organisation') -%}
<a {%- if params.link.id %} id="{{ params.link.id }}"{% endif %} href="{{ params.link.href }}" class="moj-organisation-nav__link {{- ' ' + params.link.classes if params.link.classes }}" {%- for attribute, value in params.link.attributes %} {{ attribute }}="{{ value }}"{% endfor %}>
{{- linkText -}}
</a>
{% endif %}
</div>