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