From f9ccf7c205edd62f5ff161263b4009480ed560cc Mon Sep 17 00:00:00 2001 From: Paul Craig Date: Sun, 19 Feb 2017 16:34:35 +0000 Subject: [PATCH] Add shim-links functionality Javascript will automatically treat links with a `role="button"` and a `.link-button` class as buttons. This is part of the govuk_frontend_toolkit, not the digitalmarketplace one. --- .../javascripts/_shim-links-with-button-role.js | 15 +++++++++++++++ app/assets/javascripts/application.js | 2 ++ 2 files changed, 17 insertions(+) create mode 100644 app/assets/javascripts/_shim-links-with-button-role.js diff --git a/app/assets/javascripts/_shim-links-with-button-role.js b/app/assets/javascripts/_shim-links-with-button-role.js new file mode 100644 index 000000000..e8dde3268 --- /dev/null +++ b/app/assets/javascripts/_shim-links-with-button-role.js @@ -0,0 +1,15 @@ +(function(GOVUK, GDM) { + + GDM.shimLinksWithButtonRole = function() { + + if (!GOVUK.shimLinksWithButtonRole) return; + + GOVUK.shimLinksWithButtonRole.init({ + selector: '[class^=link-button]' + }); + + }; + + GOVUK.GDM = GDM; + +}).apply(this, [GOVUK||{}, GOVUK.GDM||{}]); diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 93e73a7ea..ad8561042 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -11,9 +11,11 @@ //= include ../../../bower_components/digitalmarketplace-frontend-toolkit/toolkit/javascripts/word-counter.js //= include ../../../bower_components/digitalmarketplace-frontend-toolkit/toolkit/javascripts/validation.js //= include ../../../node_modules/govuk_frontend_toolkit/javascripts/govuk/selection-buttons.js +//= include ../../../node_modules/govuk_frontend_toolkit/javascripts/govuk/shim-links-with-button-role.js //= include ../../../node_modules/govuk_frontend_toolkit/javascripts/govuk/show-hide-content.js //= include _analytics.js //= include _selection-buttons.js +//= include _shim-links-with-button-role.js (function(GOVUK, GDM) {