From 030979a8645a4bf3841aee0877a900ba82ca5a7d Mon Sep 17 00:00:00 2001 From: Tom Byers Date: Thu, 29 Aug 2019 16:28:33 +0100 Subject: [PATCH 1/3] Remove `expandCollapse.js` script and refs to it --- app/assets/javascripts/expandCollapse.js | 58 ------------------------ gulpfile.js | 1 - 2 files changed, 59 deletions(-) delete mode 100644 app/assets/javascripts/expandCollapse.js diff --git a/app/assets/javascripts/expandCollapse.js b/app/assets/javascripts/expandCollapse.js deleted file mode 100644 index 396747d4c..000000000 --- a/app/assets/javascripts/expandCollapse.js +++ /dev/null @@ -1,58 +0,0 @@ -(function(Modules) { - "use strict"; - - Modules.ExpandCollapse = function() { - - this.start = function(component) { - - this.$component = $(component); - - this.$toggle = this.$component.find('.toggle') - .on( - "click", - this.change - ) - .on("keydown", this.filterKeyPresses([32, 13], this.change)); - - if (this.getNativeHeight() < this.$component.data('max-height')) { - this.change(); - } - - }; - - this.filterKeyPresses = (keys, callback) => function(event) { - - if (keys.indexOf(event.keyCode)) return; - - event.preventDefault(); - callback(); - - }; - - this.getNativeHeight = function() { - - var $copy = this.$component.clone().css({ - 'position': 'absolute', - 'left': '9999px', - 'width': this.$component.width(), - 'font-size': this.$component.css('font-size'), - 'line-height': this.$component.css('line-height') - }).addClass('expanded'); - - $('body').append($copy); - - var nativeHeight = $copy.height(); - - $copy.remove(); - - return nativeHeight; - - }; - - this.change = () => this.toggleCollapsed() && this.$toggle.remove(); - - this.toggleCollapsed = () => this.$component.addClass('expanded'); - - }; - -})(window.GOVUK.Modules); diff --git a/gulpfile.js b/gulpfile.js index 305323158..c10a41f28 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -84,7 +84,6 @@ const javascripts = () => { paths.src + 'javascripts/autofocus.js', paths.src + 'javascripts/highlightTags.js', paths.src + 'javascripts/fileUpload.js', - paths.src + 'javascripts/expandCollapse.js', paths.src + 'javascripts/radioSelect.js', paths.src + 'javascripts/updateContent.js', paths.src + 'javascripts/listEntry.js', From c9c3f90fd8158bb6177266b503ea1de944401d6e Mon Sep 17 00:00:00 2001 From: Tom Byers Date: Thu, 29 Aug 2019 16:41:53 +0100 Subject: [PATCH 2/3] Remove CSS used by `expandCollapse.js` --- .../stylesheets/components/email-message.scss | 49 ------------------- 1 file changed, 49 deletions(-) diff --git a/app/assets/stylesheets/components/email-message.scss b/app/assets/stylesheets/components/email-message.scss index d999e8c96..226e8fadf 100644 --- a/app/assets/stylesheets/components/email-message.scss +++ b/app/assets/stylesheets/components/email-message.scss @@ -78,57 +78,8 @@ $email-message-gutter: $gutter * 2; overflow: hidden; } - .js-enabled .expanded & { - max-height: none; - padding-bottom: $gutter; - } - - } - - .toggle { - - display: none; - position: absolute; - left: 50%; - bottom: -18px; - height: 27px; - padding: 0; - margin: 0 0 0 -30px; - line-height: 12px; - font-size: 30px; - font-weight: bold; - letter-spacing: 2px; - text-align: center; - cursor: pointer; - width: 60px; - text-decoration: none; - background: $grey-3; - color: $text-colour; - border-style: solid; - border-width: 3px; - border-color: $white; - box-shadow: inset 0 -2px 0 $button-bottom-border-colour, 0 0 0 1px $white-50-opaque; - - &:hover { - background: $grey-2; - } - - &:focus, - &:active { - border-color: $yellow; - outline: none; - } - } } } - -.js-enabled .toggle { - display: inline-block; -} - -.js-enabled .expanded .toggle { - display: none; -} From 26e1e3a5cb43029cbe120cc1285cec746f294239 Mon Sep 17 00:00:00 2001 From: Tom Byers Date: Fri, 30 Aug 2019 08:44:14 +0100 Subject: [PATCH 3/3] Remove CSS tied to `.js-enabled` class Not as obviously connected to expandCollapse but no longer needed. --- app/assets/stylesheets/components/email-message.scss | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/app/assets/stylesheets/components/email-message.scss b/app/assets/stylesheets/components/email-message.scss index 226e8fadf..c829a0de3 100644 --- a/app/assets/stylesheets/components/email-message.scss +++ b/app/assets/stylesheets/components/email-message.scss @@ -70,16 +70,6 @@ $email-message-gutter: $gutter * 2; } - &-wrapper { - - .js-enabled & { - max-height: 92px; - padding: 0; - overflow: hidden; - } - - } - } }