Skip to content

Commit

Permalink
Add shim-links functionality
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
pcraig3 committed Feb 24, 2017
1 parent 73b0cc3 commit 4e7f5d8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
15 changes: 15 additions & 0 deletions app/assets/javascripts/_shim-links-with-button-role.js
Original file line number Diff line number Diff line change
@@ -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||{}]);
2 changes: 2 additions & 0 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {

Expand Down

0 comments on commit 4e7f5d8

Please sign in to comment.