Commit 01719606 authored by Lukas Eipert's avatar Lukas Eipert

Move initialization of Awards Handler to pages

We currently initialize the Awards Handler on every page, this moves it
to the pages where it is used:
- Commits
- Epics
- Issues
- Merge Requests
- Snippets
parent e2e3b618
......@@ -20,7 +20,6 @@ import { localTimeAgo } from './lib/utils/datetime_utility';
import { getLocationHash, visitUrl } from './lib/utils/url_utility';
// everything else
import loadAwardsHandler from './awards_handler';
import { deprecatedCreateFlash as Flash, removeFlashClickListener } from './flash';
import initTodoToggle from './header';
import initImporterStatus from './importer_status';
......@@ -154,8 +153,6 @@ function deferredInitialisation() {
viewport: '.layout-page',
});
loadAwardsHandler();
// Adding a helper class to activate animations only after all is rendered
setTimeout(() => $body.addClass('page-initialised'), 1000);
}
......
......@@ -14,6 +14,7 @@ import axios from '~/lib/utils/axios_utils';
import syntaxHighlight from '~/syntax_highlight';
import flash from '~/flash';
import { __ } from '~/locale';
import loadAwardsHandler from '~/awards_handler';
document.addEventListener('DOMContentLoaded', () => {
const hasPerfBar = document.querySelector('.with-performance-bar');
......@@ -48,4 +49,5 @@ document.addEventListener('DOMContentLoaded', () => {
} else {
new Diff();
}
loadAwardsHandler();
});
import loadAwardsHandler from '~/awards_handler';
import initIssuableSidebar from '~/init_issuable_sidebar';
import Issue from '~/issue';
import ShortcutsIssuable from '~/behaviors/shortcuts/shortcuts_issuable';
......@@ -37,4 +38,6 @@ export default function() {
} else {
initIssuableSidebar();
}
loadAwardsHandler();
}
......@@ -6,6 +6,7 @@ import howToMerge from '~/how_to_merge';
import initPipelines from '~/commit/pipelines/pipelines_bundle';
import initVueIssuableSidebarApp from '~/issuable_sidebar/sidebar_bundle';
import initSourcegraph from '~/sourcegraph';
import loadAwardsHandler from '~/awards_handler';
export default function() {
new ZenMode(); // eslint-disable-line no-new
......@@ -19,4 +20,5 @@ export default function() {
handleLocationHash();
howToMerge();
initSourcegraph();
loadAwardsHandler();
}
......@@ -4,6 +4,7 @@ import ZenMode from '~/zen_mode';
import initNotes from '~/init_notes';
import snippetEmbed from '~/snippet/snippet_embed';
import { SnippetShowInit } from '~/snippets';
import loadAwardsHandler from '~/awards_handler';
document.addEventListener('DOMContentLoaded', () => {
if (!gon.features.snippetsVue) {
......@@ -16,4 +17,5 @@ document.addEventListener('DOMContentLoaded', () => {
SnippetShowInit();
initNotes();
}
loadAwardsHandler();
});
......@@ -3,10 +3,12 @@ import EpicTabs from 'ee/epic/epic_tabs';
import initEpicApp from 'ee/epic/epic_bundle';
import ZenMode from '~/zen_mode';
import '~/notes/index';
import loadAwardsHandler from '~/awards_handler';
document.addEventListener('DOMContentLoaded', () => {
new ZenMode(); // eslint-disable-line no-new
initEpicApp();
new ShortcutsEpic(); // eslint-disable-line no-new
new EpicTabs(); // eslint-disable-line no-new
loadAwardsHandler();
});
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