design_system 0.15.2 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c43b735d9c944d2aedef0fc9e19a29a42b88ec8df6bc2b193886a61627770e92
4
- data.tar.gz: 9061dc3ebeccbe8f12b1d6badb9f72a22bfe42122842dce4cae364cbbc13095a
3
+ metadata.gz: 86b229cbfe82c0d8b0b7d9c88dfeec1b5993a5524ad04fa4b6f5baaa7507d269
4
+ data.tar.gz: 2b33b73ffabdd0381e2842f3d3f645476563698fec7b912e0d4e67a65d35dfd9
5
5
  SHA512:
6
- metadata.gz: ee7e8d53fad7cf58b0afd77d5a6c915230c904df16da97a563fa0f82f5439049d1e43805f26c1d7e5aa9c8adf2de97411efd556fde84160048e8a51b80521cf5
7
- data.tar.gz: d5ac0cbbb6629d1c0a756833510c4ecf97c18826eec8a779d941555e2a81a302d7cecfef5dab8e2e3aa5326937ec1651d9236b942d3d9cfb60af5f4fb21b853b
6
+ metadata.gz: 7da95f367410b3780f36f11a6de15d028b82b1a410b4ce83aa63cc58ccd3a5dd965c6bae1b3eb0ade6308c8dfa2dfce577afa569bef90f01f04d455e262b45a9
7
+ data.tar.gz: 0c70a3bafd6638771780d1d098beff10eec4f63bfa8983a8cde25964c0a7940e6ca48f2255491d0f37d3de5d6380b9514be95adfe465c5e1e3a005192f7c9edd
data/README.md CHANGED
@@ -48,6 +48,23 @@ import { registerControllers } from 'design_system/controllers'
48
48
  registerControllers(application)
49
49
  ```
50
50
 
51
+ ## Customising the header logo link
52
+
53
+ The brand header logo (the NHS/GOV.UK homepage link) points to your app's
54
+ `root_path` by default. If your home page is served by a route that isn't named
55
+ `:root`, override `ds_root_path`. Define it as a private method anywhere in your
56
+ controller's ancestry — directly in the controller, or in a concern that pulls in
57
+ `DesignSystem::Branded` — and it will take precedence over the default:
58
+
59
+ ```ruby
60
+ def ds_root_path
61
+ main_app.dashboard_path
62
+ end
63
+ ```
64
+
65
+ `ds_root_path` is exposed as a helper method, so it's available to both the
66
+ bundled layouts and your own views.
67
+
51
68
  ## Updating Frontends
52
69
 
53
70
  ### GOVUK Frontend (currently v5.11.1)
@@ -10,6 +10,7 @@ module DesignSystem
10
10
  attr_writer :govuk_footer_elements
11
11
 
12
12
  helper DesignSystemHelper
13
+ helper_method :ds_root_path
13
14
  end
14
15
 
15
16
  def brand
@@ -30,5 +31,14 @@ module DesignSystem
30
31
  @footer_links ||= []
31
32
  @footer_links << { name:, href:, options: }
32
33
  end
34
+
35
+ private
36
+
37
+ # The path the header logo/homepage link points to. Defaults to the host
38
+ # app's root_path; host apps can override this (e.g. if they name their
39
+ # home route something other than :root).
40
+ def ds_root_path
41
+ main_app.root_path
42
+ end
33
43
  end
34
44
  end
@@ -53,7 +53,7 @@
53
53
  <header class="govuk-header" data-module="govuk-header">
54
54
  <div class="govuk-header__container govuk-width-container">
55
55
  <div class="govuk-header__logo">
56
- <a href="<%= main_app.root_path %>" class="govuk-header__link govuk-header__link--homepage">
56
+ <a href="<%= ds_root_path %>" class="govuk-header__link govuk-header__link--homepage">
57
57
  <svg
58
58
  focusable="false"
59
59
  role="img"
@@ -30,7 +30,7 @@
30
30
 
31
31
  <div class="nhsuk-header__container nhsuk-width-container">
32
32
  <div class="nhsuk-header__service">
33
- <a class="nhsuk-header__service-logo nhsuk-header__link--service" href="<%= main_app.root_path %>" aria-label="NHS homepage">
33
+ <a class="nhsuk-header__service-logo nhsuk-header__link--service" href="<%= ds_root_path %>" aria-label="NHS homepage">
34
34
  <svg class="nhsuk-header__logo" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 80" height="40" width="100" focusable="false" role="img" aria-label="NHS">
35
35
  <title>NHS</title>
36
36
  <path fill="currentcolor" d="M200 0v80H0V0h200Zm-27.5 5.5c-14.5 0-29 5-29 22 0 10.2 7.7 13.5 14.7 16.3l.7.3c5.4 2 10.1 3.9 10.1 8.4 0 6.5-8.5 7.5-14 7.5s-12.5-1.5-16-3.5L135 70c5.5 2 13.5 3.5 20 3.5 15.5 0 32-4.5 32-22.5 0-19.5-25.5-16.5-25.5-25.5 0-5.5 5.5-6.5 12.5-6.5a35 35 0 0 1 14.5 3l4-13.5c-4.5-2-12-3-20-3Zm-131 2h-22l-14 65H22l9-45h.5l13.5 45h21.5l14-65H64l-9 45h-.5l-13-45Zm63 0h-18l-13 65h17l6-28H117l-5.5 28H129l13.5-65H125L119.5 32h-20l5-24.5Z" />
@@ -1,3 +1,3 @@
1
1
  module DesignSystem
2
- VERSION = '0.15.2'.freeze
2
+ VERSION = '0.16.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: design_system
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.2
4
+ version: 0.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Filis Liu
@@ -524,7 +524,7 @@ files:
524
524
  - lib/tasks/design_system_tasks.rake
525
525
  - lib/tasks/govuk.rake
526
526
  - lib/tasks/nhsuk.rake
527
- - public/design_system/static/design_system-0.15.2/design_system.js
527
+ - public/design_system/static/design_system-0.16.0/design_system.js
528
528
  - public/design_system/static/govuk-frontend-5.11.1/fonts/bold-affa96571d-v2.woff
529
529
  - public/design_system/static/govuk-frontend-5.11.1/fonts/bold-b542beb274-v2.woff2
530
530
  - public/design_system/static/govuk-frontend-5.11.1/fonts/light-94a07e06a1-v2.woff2