mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-09 15:09:48 -04:00
Make folder controls update sticky JS on change
Also removes a call the `render` method which duplicates one already made by the `selectActionButtons` method on load.
This commit is contained in:
@@ -12,7 +12,6 @@
|
|||||||
this._appliedClass = null;
|
this._appliedClass = null;
|
||||||
this._$shim = null;
|
this._$shim = null;
|
||||||
this._stopped = false;
|
this._stopped = false;
|
||||||
this.scrolledFrom = this._sticky.getScrolledFrom($el);
|
|
||||||
};
|
};
|
||||||
StickyElement.prototype.stickyClass = function () {
|
StickyElement.prototype.stickyClass = function () {
|
||||||
return (this._sticky._initialPositionsSet) ? this._fixedClass : this._initialFixedClass;
|
return (this._sticky._initialPositionsSet) ? this._fixedClass : this._initialFixedClass;
|
||||||
@@ -106,9 +105,15 @@
|
|||||||
};
|
};
|
||||||
Sticky.prototype.setElementDimensions = function (el, callback) {
|
Sticky.prototype.setElementDimensions = function (el, callback) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
var $el = el.$fixedEl;
|
||||||
var onHeightSet = function () {
|
var onHeightSet = function () {
|
||||||
el.scrolledTo = self.getScrollingTo(el);
|
el.scrolledTo = self.getScrollingTo(el);
|
||||||
el.updateShim(el);
|
// if element is shim'ed, pass changes in dimension on to the shim
|
||||||
|
if (el._$shim) {
|
||||||
|
el.updateShim();
|
||||||
|
$el = el._$shim;
|
||||||
|
}
|
||||||
|
el.scrolledFrom = self.getScrolledFrom($el);
|
||||||
if (callback !== undefined) {
|
if (callback !== undefined) {
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,8 +36,6 @@
|
|||||||
|
|
||||||
this.$form.on('click', 'button.button-secondary', (event) => this.actionButtonClicked(event));
|
this.$form.on('click', 'button.button-secondary', (event) => this.actionButtonClicked(event));
|
||||||
this.$form.on('change', 'input[type=checkbox]', () => this.templateFolderCheckboxChanged());
|
this.$form.on('change', 'input[type=checkbox]', () => this.templateFolderCheckboxChanged());
|
||||||
|
|
||||||
this.render();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.addCancelButton = function(state) {
|
this.addCancelButton = function(state) {
|
||||||
@@ -96,6 +94,11 @@
|
|||||||
this.states.forEach(
|
this.states.forEach(
|
||||||
state => (state.key === this.currentState ? this.$stickyBottom.append(state.$el) : state.$el.detach())
|
state => (state.key === this.currentState ? this.$stickyBottom.append(state.$el) : state.$el.detach())
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// make sticky JS recalculate its cache of the element's position
|
||||||
|
if ('stickAtBottomWhenScrolling' in GOVUK) {
|
||||||
|
GOVUK.stickAtBottomWhenScrolling.recalculate();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.nothingSelectedButtons = `
|
this.nothingSelectedButtons = `
|
||||||
|
|||||||
Reference in New Issue
Block a user