diff --git a/app/assets/images/folder-black.png b/app/assets/images/folder-black.png
deleted file mode 100644
index 3c586bc69..000000000
Binary files a/app/assets/images/folder-black.png and /dev/null differ
diff --git a/app/assets/images/folder-black.svg b/app/assets/images/folder-black.svg
deleted file mode 100644
index d6de0a261..000000000
--- a/app/assets/images/folder-black.svg
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/app/assets/javascripts/collapsibleCheckboxes.js b/app/assets/javascripts/collapsibleCheckboxes.js
deleted file mode 100644
index 3eea8693d..000000000
--- a/app/assets/javascripts/collapsibleCheckboxes.js
+++ /dev/null
@@ -1,170 +0,0 @@
-(function (global) {
- "use strict";
-
- const GOVUK = global.GOVUK;
-
- function Summary (module) {
- this.module = module;
- this.$el = module.$formGroup.find('.selection-summary');
- this.fieldLabel = module.fieldLabel;
- this.total = module.total;
- this.addContent();
- this.update(module.getSelection());
- }
- Summary.prototype.templates = {
- all: (selection, total, field) => `All ${field}s`,
- some: (selection, total, field) => `${selection} of ${total} ${field}s`,
- none: (selection, total, field) => ({
- "folder": "No folders (only templates outside a folder)",
- "team member": "No team members (only you)"
- }[field] || `No ${field}s`)
- };
- Summary.prototype.addContent = function() {
- this.$text = $(`
`);
-
- if (this.fieldLabel === 'folder') { this.$text.addClass('selection-summary__text--folders'); }
-
- this.$el.append(this.$text);
- };
- Summary.prototype.update = function(selection) {
- let template;
-
- if (selection === this.total) {
- template = 'all';
- } else if (selection > 0) {
- template = 'some';
- } else {
- template = 'none';
- }
-
- this.$text.html(this.templates[template](selection, this.total, this.fieldLabel));
- };
- Summary.prototype.bindEvents = function () {
- // take summary out of tab order when focus moves
- this.$el.on('blur', (e) => $(this).attr('tabindex', '-1'));
- };
-
- function Footer (module) {
- this.module = module;
- this.fieldLabel = module.fieldLabel;
- this.fieldsetId = module.$fieldset.attr('id');
- this.$el = this.getEl(this.module.expanded);
- this.module.$formGroup.append(this.$el);
- }
- Footer.prototype.buttonContent = {
- change: (fieldLabel) => `Choose ${fieldLabel}s`,
- done: (fieldLabel) => `Done choosing ${fieldLabel}s`
- };
- Footer.prototype.getEl = function (expanded) {
- const buttonState = expanded ? 'done' : 'change';
- const buttonContent = this.buttonContent[buttonState](this.fieldLabel);
- const stickyClass = expanded ? ' js-stick-at-bottom-when-scrolling' : '';
-
- return $(``);
- };
- Footer.prototype.update = function (expanded) {
- this.$el.remove();
- this.$el = this.getEl(expanded);
-
- this.module.$formGroup.append(this.$el);
-
- // make footer sticky if expanded, clear up from it being sticky if not
- GOVUK.stickAtBottomWhenScrolling.recalculate();
- };
-
- function CollapsibleCheckboxes () {}
- CollapsibleCheckboxes.prototype._focusTextElement = ($el) => {
- $el
- .attr('tabindex', '-1')
- .focus();
- };
- CollapsibleCheckboxes.prototype.start = function(component) {
- this.$formGroup = $(component);
- this.$fieldset = this.$formGroup.find('fieldset');
- this.$checkboxes = this.$fieldset.find('input[type=checkbox]');
- this.fieldLabel = this.$formGroup.data('fieldLabel');
- this.total = this.$checkboxes.length;
- this.legendText = this.$fieldset.find('legend').text().trim();
- this.expanded = false;
-
- this.addHeadingHideLegend();
-
- // generate summary and footer
- this.footer = new Footer(this);
- this.summary = new Summary(this);
-
- this.$fieldset.before(this.summary.$el);
-
- // add custom classes
- this.$formGroup.addClass('selection-wrapper');
- this.$fieldset.addClass('selection-content');
-
- // hide checkboxes
- this.$fieldset.hide();
-
- this.bindEvents();
- };
- CollapsibleCheckboxes.prototype.getSelection = function() { return this.$checkboxes.filter(':checked').length; };
- CollapsibleCheckboxes.prototype.addHeadingHideLegend = function() {
- const headingLevel = this.$formGroup.data('heading-level') || '2';
-
- this.$heading = $(`${this.legendText}`);
- this.$fieldset.before(this.$heading);
-
- this.$fieldset.find('legend').addClass('visuallyhidden');
- };
- CollapsibleCheckboxes.prototype.expand = function(e) {
- if (e !== undefined) { e.preventDefault(); }
-
- if (!this.expanded) {
- this.$fieldset.show();
- this.expanded = true;
- this.summary.update(this.getSelection());
- this.footer.update(this.expanded);
- }
-
- // shift focus whether expanded or not
- this._focusTextElement(this.$fieldset);
- };
- CollapsibleCheckboxes.prototype.collapse = function(e) {
- if (e !== undefined) { e.preventDefault(); }
-
- if (this.expanded) {
- this.$fieldset.hide();
- this.expanded = false;
- this.summary.update(this.getSelection());
- this.footer.update(this.expanded);
- }
-
- // shift focus whether expanded or not
- this._focusTextElement(this.summary.$text);
- };
- CollapsibleCheckboxes.prototype.handleClick = function(e) {
- if (this.expanded) {
- this.collapse(e);
- } else {
- this.expand(e);
- }
- };
- CollapsibleCheckboxes.prototype.handleSelection = function(e) {
- this.summary.update(this.getSelection(), this.total, this.fieldLabel);
- };
- CollapsibleCheckboxes.prototype.bindEvents = function() {
- const self = this;
-
- this.$formGroup.on('click', '.button', this.handleClick.bind(this));
- this.$checkboxes.on('click', this.handleSelection.bind(this));
-
- this.summary.bindEvents(this);
- };
-
- GOVUK.Modules.CollapsibleCheckboxes = CollapsibleCheckboxes;
-
-}(window));
diff --git a/app/assets/javascripts/stick-to-window-when-scrolling.js b/app/assets/javascripts/stick-to-window-when-scrolling.js
index 0a3176beb..7f2066aa5 100644
--- a/app/assets/javascripts/stick-to-window-when-scrolling.js
+++ b/app/assets/javascripts/stick-to-window-when-scrolling.js
@@ -11,11 +11,12 @@
var $scrollArea = $el.closest('.sticky-scroll-area');
$scrollArea = $scrollArea.length ? $scrollArea : $el.parent();
+ scrollArea = $scrollArea.get(0);
this._els = [el];
this.edge = edge;
this.selector = selector;
- this.node = $scrollArea.get(0);
+ this.node = scrollArea;
this.setEvents();
};
ScrollArea.prototype.addEl = function (el) {
@@ -37,7 +38,7 @@
};
ScrollArea.prototype.getFocusedDetails = {
forElement: function ($focusedElement) {
- var focused = {
+ focused = {
'top': $focusedElement.offset().top,
'height': $focusedElement.outerHeight(),
'type': 'element'
diff --git a/app/assets/stylesheets/app.scss b/app/assets/stylesheets/app.scss
index 3cb2aa81b..4bd8db24b 100644
--- a/app/assets/stylesheets/app.scss
+++ b/app/assets/stylesheets/app.scss
@@ -124,20 +124,10 @@ td {
.form-label {
margin-bottom: 5px;
-
- &.heading-small {
- @include bold-19();
- }
}
.hint {
color: $secondary-text-colour;
-
- .form-label + & {
- display: block;
- margin-top: -5px;
- margin-bottom: 5px;
- }
}
.list-bullet {
diff --git a/app/assets/stylesheets/components/checkboxes.scss b/app/assets/stylesheets/components/checkboxes.scss
index 46e8269a9..40ca600d4 100644
--- a/app/assets/stylesheets/components/checkboxes.scss
+++ b/app/assets/stylesheets/components/checkboxes.scss
@@ -1,37 +1,3 @@
-.selection-summary {
-
- .selection-summary__text {
- @include core-19($tabular-numbers: true);
- padding: 5px 0 0 0;
- margin-bottom: $gutter / 2;
-
- &:focus {
- outline: none;
- }
- }
-
- .selection-summary__text--folders {
- padding: 10px 15px 5px 51px;
- background-image: file-url('folder-black.svg');
- background-repeat: no-repeat;
- background-size: 39px auto;
- background-position: 0px 4px;
-
- @include ie-lte(8) {
- background-image: file-url('folder-black.png');
- }
- }
-
- // revert full-width button for smaller screens
- .button {
- display: inline-block;
- width: auto;
- position: relative;
- top: 1px;
- }
-
-}
-
.checkboxes-nested {
margin-bottom: 10px;
@@ -76,29 +42,3 @@
}
}
-
-.selection-content {
- margin-bottom: ($gutter / 3) * 2;
-
- .checkboxes-nested {
- margin-bottom: 0;
- }
-}
-
-.selection-footer {
- clear: both;
-
- .button-secondary {
- // revert full-width button for smaller screens
- display: inline-block;
- width: auto;
- }
-}
-
-// styles specific to the collapsible checkboxes module
-.selection-wrapper {
- fieldset:focus {
- outline: none;
- }
-
-}
diff --git a/app/templates/components/checkbox.html b/app/templates/components/checkbox.html
index 3647c4f1c..51594eea6 100644
--- a/app/templates/components/checkbox.html
+++ b/app/templates/components/checkbox.html
@@ -19,13 +19,13 @@
{% endmacro %}
-{% macro checkboxes_nested(field, child_map, hint=None, disable=[], option_hints={}, hide_legend=False, collapsible_opts={}, legend_style="text") %}
- {{ select_nested(field, child_map, hint, disable, option_hints, hide_legend, collapsible_opts, legend_style, input="checkbox") }}
+{% macro checkboxes_nested(field, child_map, hint=None, disable=[], option_hints={}, hide_legend=False) %}
+ {{ select_nested(field, child_map, hint, disable, option_hints, hide_legend, input="checkbox") }}
{% endmacro %}
-{% macro checkboxes(field, hint=None, disable=[], option_hints={}, hide_legend=False, collapsible_opts={}) %}
- {{ select(field, hint, disable, option_hints, hide_legend, collapsible_opts, input="checkbox") }}
+{% macro checkboxes(field, hint=None, disable=[], option_hints={}, hide_legend=False) %}
+ {{ select(field, hint, disable, option_hints, hide_legend, input="checkbox") }}
{% endmacro %}
diff --git a/app/templates/components/select-input.html b/app/templates/components/select-input.html
index f65647647..b3cfbb9e4 100644
--- a/app/templates/components/select-input.html
+++ b/app/templates/components/select-input.html
@@ -1,6 +1,6 @@
-{% macro select(field, hint=None, disable=[], option_hints={}, hide_legend=False, collapsible_opts={}, legend_style="text", input="radio") %}
+{% macro select(field, hint=None, disable=[], option_hints={}, hide_legend=False, input="radio") %}
{% call select_wrapper(
- field, hint, disable, option_hints, hide_legend, collapsible_opts, legend_style
+ field, hint, disable, option_hints, hide_legend
) %}
{% for option in field %}
{{ select_input(option, disable, option_hints, input=input) }}
@@ -24,9 +24,9 @@
{% endmacro %}
-{% macro select_nested(field, child_map, hint=None, disable=[], option_hints={}, hide_legend=False, collapsible_opts={}, legend_style="text", input="radio") %}
+{% macro select_nested(field, child_map, hint=None, disable=[], option_hints={}, hide_legend=False, input="radio") %}
{% call select_wrapper(
- field, hint, disable, option_hints, hide_legend, collapsible_opts, legend_style
+ field, hint, disable, option_hints, hide_legend
) %}
{{ select_list(child_map[None], child_map, disable, option_hints, input=input) }}
@@ -35,14 +35,10 @@
{% endmacro %}
-{% macro select_wrapper(field, hint=None, disable=[], option_hints={}, hide_legend=False, collapsible_opts={}, legend_style="text") %}
- {% set is_collapsible = collapsible_opts|length %}
-