Commit e107ebc3 authored by Luke Bennett's avatar Luke Bennett

Refactor PersistentUserCallout instantiations

Uses a new factory method to DRY instantiation.
parent f100c9ba
...@@ -119,8 +119,7 @@ export default class Clusters { ...@@ -119,8 +119,7 @@ export default class Clusters {
static initDismissableCallout() { static initDismissableCallout() {
const callout = document.querySelector('.js-cluster-security-warning'); const callout = document.querySelector('.js-cluster-security-warning');
PersistentUserCallout.factory(callout);
if (callout) new PersistentUserCallout(callout); // eslint-disable-line no-new
} }
addListeners() { addListeners() {
......
...@@ -2,6 +2,5 @@ import PersistentUserCallout from '~/persistent_user_callout'; ...@@ -2,6 +2,5 @@ import PersistentUserCallout from '~/persistent_user_callout';
document.addEventListener('DOMContentLoaded', () => { document.addEventListener('DOMContentLoaded', () => {
const callout = document.querySelector('.gcp-signup-offer'); const callout = document.querySelector('.gcp-signup-offer');
PersistentUserCallout.factory(callout);
if (callout) new PersistentUserCallout(callout); // eslint-disable-line no-new
}); });
...@@ -3,8 +3,7 @@ import initGkeDropdowns from '~/projects/gke_cluster_dropdowns'; ...@@ -3,8 +3,7 @@ import initGkeDropdowns from '~/projects/gke_cluster_dropdowns';
function initGcpSignupCallout() { function initGcpSignupCallout() {
const callout = document.querySelector('.gcp-signup-offer'); const callout = document.querySelector('.gcp-signup-offer');
PersistentUserCallout.factory(callout);
if (callout) new PersistentUserCallout(callout); // eslint-disable-line no-new
} }
document.addEventListener('DOMContentLoaded', () => { document.addEventListener('DOMContentLoaded', () => {
......
...@@ -2,6 +2,5 @@ import PersistentUserCallout from '~/persistent_user_callout'; ...@@ -2,6 +2,5 @@ import PersistentUserCallout from '~/persistent_user_callout';
document.addEventListener('DOMContentLoaded', () => { document.addEventListener('DOMContentLoaded', () => {
const callout = document.querySelector('.gcp-signup-offer'); const callout = document.querySelector('.gcp-signup-offer');
PersistentUserCallout.factory(callout);
if (callout) new PersistentUserCallout(callout); // eslint-disable-line no-new
}); });
...@@ -13,7 +13,7 @@ document.addEventListener('DOMContentLoaded', () => { ...@@ -13,7 +13,7 @@ document.addEventListener('DOMContentLoaded', () => {
if (newClusterViews.indexOf(page) > -1) { if (newClusterViews.indexOf(page) > -1) {
const callout = document.querySelector('.gcp-signup-offer'); const callout = document.querySelector('.gcp-signup-offer');
if (callout) new PersistentUserCallout(callout); // eslint-disable-line no-new PersistentUserCallout.factory(callout);
initGkeDropdowns(); initGkeDropdowns();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment