2017-01-10 18:02:20 -05:00
|
|
|
/* eslint-disable func-names, space-before-function-paren, no-var, prefer-arrow-callback, wrap-iife, no-shadow, consistent-return, one-var, one-var-declaration-per-line, camelcase, default-case, no-new, quotes, no-duplicate-case, no-case-declarations, no-fallthrough, max-len */
|
2017-10-24 00:56:39 -04:00
|
|
|
import { s__ } from './locale';
|
2017-11-17 06:30:09 -05:00
|
|
|
import projectSelect from './project_select';
|
2017-10-26 14:03:48 -04:00
|
|
|
import IssuableIndex from './issuable_index';
|
2017-11-20 15:28:29 -05:00
|
|
|
import Milestone from './milestone';
|
2017-10-26 16:21:55 -04:00
|
|
|
import IssuableForm from './issuable_form';
|
2017-11-01 08:32:15 -04:00
|
|
|
import LabelsSelect from './labels_select';
|
2016-12-13 22:01:05 -05:00
|
|
|
/* global MilestoneSelect */
|
2017-11-20 15:28:29 -05:00
|
|
|
import NewBranchForm from './new_branch_form';
|
2016-12-13 22:01:05 -05:00
|
|
|
/* global NotificationsForm */
|
|
|
|
/* global NotificationsDropdown */
|
2017-10-23 09:05:53 -04:00
|
|
|
import groupAvatar from './group_avatar';
|
|
|
|
import GroupLabelSubscription from './group_label_subscription';
|
2016-12-13 22:01:05 -05:00
|
|
|
/* global LineHighlighter */
|
2017-10-10 07:06:42 -04:00
|
|
|
import BuildArtifacts from './build_artifacts';
|
|
|
|
import CILintEditor from './ci_lint_editor';
|
2017-10-27 05:05:03 -04:00
|
|
|
import groupsSelect from './groups_select';
|
2016-12-13 22:01:05 -05:00
|
|
|
/* global Search */
|
|
|
|
/* global Admin */
|
2017-10-26 07:03:44 -04:00
|
|
|
import NamespaceSelect from './namespace_select';
|
2017-11-20 15:28:29 -05:00
|
|
|
import NewCommitForm from './new_commit_form';
|
2017-11-13 12:45:45 -05:00
|
|
|
import Project from './project';
|
|
|
|
import projectAvatar from './project_avatar';
|
2017-07-27 04:30:14 -04:00
|
|
|
/* global MergeRequest */
|
|
|
|
/* global Compare */
|
2016-12-13 22:01:05 -05:00
|
|
|
/* global CompareAutocomplete */
|
2017-08-01 04:50:59 -04:00
|
|
|
/* global ProjectFindFile */
|
2017-11-17 06:30:09 -05:00
|
|
|
import ProjectNew from './project_new';
|
2017-11-13 12:45:45 -05:00
|
|
|
import projectImport from './project_import';
|
2017-10-10 13:22:34 -04:00
|
|
|
import Labels from './labels';
|
|
|
|
import LabelManager from './label_manager';
|
2017-03-23 16:53:51 -04:00
|
|
|
/* global Sidebar */
|
|
|
|
|
2017-10-24 00:56:39 -04:00
|
|
|
import Flash from './flash';
|
2017-10-09 06:46:40 -04:00
|
|
|
import CommitsList from './commits';
|
2017-03-01 14:54:04 -05:00
|
|
|
import Issue from './issue';
|
2017-03-06 08:06:33 -05:00
|
|
|
import BindInOut from './behaviors/bind_in_out';
|
2017-05-08 03:41:58 -04:00
|
|
|
import DeleteModal from './branches/branches_delete_modal';
|
2017-03-12 11:22:00 -04:00
|
|
|
import Group from './group';
|
2017-03-02 06:05:48 -05:00
|
|
|
import GroupsList from './groups_list';
|
2017-03-03 05:13:03 -05:00
|
|
|
import ProjectsList from './projects_list';
|
2017-05-16 12:41:50 -04:00
|
|
|
import setupProjectEdit from './project_edit';
|
2017-03-09 13:26:15 -05:00
|
|
|
import MiniPipelineGraph from './mini_pipeline_graph_dropdown';
|
2017-02-22 20:27:06 -05:00
|
|
|
import BlobLinePermalinkUpdater from './blob/blob_line_permalink_updater';
|
2017-05-02 04:05:43 -04:00
|
|
|
import Landing from './landing';
|
2017-04-06 12:36:38 -04:00
|
|
|
import BlobForkSuggestion from './blob/blob_fork_suggestion';
|
2017-03-22 04:26:12 -04:00
|
|
|
import UserCallout from './user_callout';
|
2017-03-29 07:47:34 -04:00
|
|
|
import ShortcutsWiki from './shortcuts_wiki';
|
2017-05-06 13:02:06 -04:00
|
|
|
import Pipelines from './pipelines';
|
2017-04-13 13:05:09 -04:00
|
|
|
import BlobViewer from './blob/viewer/index';
|
2017-04-25 05:34:46 -04:00
|
|
|
import AutoWidthDropdownSelect from './issuable/auto_width_dropdown_select';
|
2017-05-12 04:15:28 -04:00
|
|
|
import UsersSelect from './users_select';
|
2017-05-16 06:32:53 -04:00
|
|
|
import RefSelectDropdown from './ref_select_dropdown';
|
2017-05-16 14:42:06 -04:00
|
|
|
import GfmAutoComplete from './gfm_auto_complete';
|
2017-05-16 16:53:01 -04:00
|
|
|
import ShortcutsBlob from './shortcuts_blob';
|
2017-07-06 14:58:47 -04:00
|
|
|
import SigninTabsMemoizer from './signin_tabs_memoizer';
|
2017-07-06 14:19:41 -04:00
|
|
|
import Star from './star';
|
2017-07-06 13:57:01 -04:00
|
|
|
import Todos from './todos';
|
2017-07-28 12:18:32 -04:00
|
|
|
import TreeView from './tree';
|
2017-06-30 19:12:24 -04:00
|
|
|
import UsagePing from './usage_ping';
|
2017-06-30 18:01:49 -04:00
|
|
|
import UsernameValidator from './username_validator';
|
2017-06-30 17:50:13 -04:00
|
|
|
import VersionCheckImage from './version_check_image';
|
2017-06-30 17:39:33 -04:00
|
|
|
import Wikis from './wikis';
|
2017-06-30 17:37:31 -04:00
|
|
|
import ZenMode from './zen_mode';
|
2017-06-07 04:11:44 -04:00
|
|
|
import initSettingsPanels from './settings_panels';
|
2017-06-16 11:38:45 -04:00
|
|
|
import initExperimentalFlags from './experimental_flags';
|
2017-06-15 08:13:30 -04:00
|
|
|
import OAuthRememberMe from './oauth_remember_me';
|
2017-07-06 15:37:31 -04:00
|
|
|
import PerformanceBar from './performance_bar';
|
2017-10-13 05:44:03 -04:00
|
|
|
import initBroadcastMessagesForm from './broadcast_message';
|
2017-07-25 11:27:51 -04:00
|
|
|
import initNotes from './init_notes';
|
|
|
|
import initLegacyFilters from './init_legacy_filters';
|
|
|
|
import initIssuableSidebar from './init_issuable_sidebar';
|
2017-08-25 20:43:33 -04:00
|
|
|
import initProjectVisibilitySelector from './project_visibility';
|
2017-07-25 03:40:23 -04:00
|
|
|
import GpgBadges from './gpg_badges';
|
2017-08-06 10:42:25 -04:00
|
|
|
import UserFeatureHelper from './helpers/user_feature_helper';
|
2017-08-07 09:21:12 -04:00
|
|
|
import initChangesDropdown from './init_changes_dropdown';
|
2017-10-05 10:23:29 -04:00
|
|
|
import NewGroupChild from './groups/new_group_child';
|
2017-10-05 10:57:49 -04:00
|
|
|
import AbuseReports from './abuse_reports';
|
2017-09-06 12:14:34 -04:00
|
|
|
import { ajaxGet, convertPermissionToBoolean } from './lib/utils/common_utils';
|
2017-10-09 05:04:13 -04:00
|
|
|
import AjaxLoadingSpinner from './ajax_loading_spinner';
|
2017-10-10 04:09:01 -04:00
|
|
|
import GlFieldErrors from './gl_field_errors';
|
|
|
|
import GLForm from './gl_form';
|
2017-10-10 05:10:11 -04:00
|
|
|
import Shortcuts from './shortcuts';
|
|
|
|
import ShortcutsNavigation from './shortcuts_navigation';
|
|
|
|
import ShortcutsFindFile from './shortcuts_find_file';
|
|
|
|
import ShortcutsIssuable from './shortcuts_issuable';
|
2017-10-09 18:21:56 -04:00
|
|
|
import U2FAuthenticate from './u2f/authenticate';
|
2017-10-12 05:42:13 -04:00
|
|
|
import Members from './members';
|
|
|
|
import memberExpirationDate from './member_expiration_date';
|
2017-10-18 07:31:01 -04:00
|
|
|
import DueDateSelectors from './due_date_select';
|
2017-10-19 05:46:43 -04:00
|
|
|
import Diff from './diff';
|
2017-11-17 06:30:09 -05:00
|
|
|
import ProjectLabelSubscription from './project_label_subscription';
|
|
|
|
import ProjectVariables from './project_variables';
|
2017-01-25 22:13:01 -05:00
|
|
|
|
2016-07-24 16:45:11 -04:00
|
|
|
(function() {
|
|
|
|
var Dispatcher;
|
|
|
|
|
|
|
|
Dispatcher = (function() {
|
|
|
|
function Dispatcher() {
|
|
|
|
this.initSearch();
|
2016-09-09 08:21:00 -04:00
|
|
|
this.initFieldErrors();
|
2016-07-24 16:45:11 -04:00
|
|
|
this.initPageScripts();
|
|
|
|
}
|
|
|
|
|
|
|
|
Dispatcher.prototype.initPageScripts = function() {
|
2017-10-10 07:06:42 -04:00
|
|
|
var path, shortcut_handler, fileBlobPermalinkUrlElement, fileBlobPermalinkUrl;
|
|
|
|
const page = $('body').attr('data-page');
|
2016-07-24 16:45:11 -04:00
|
|
|
if (!page) {
|
|
|
|
return false;
|
|
|
|
}
|
2017-07-01 09:55:16 -04:00
|
|
|
|
2016-07-24 16:45:11 -04:00
|
|
|
path = page.split(':');
|
|
|
|
shortcut_handler = null;
|
2017-03-13 18:46:21 -04:00
|
|
|
|
2017-08-14 06:35:58 -04:00
|
|
|
$('.js-gfm-input:not(.js-vue-textarea)').each((i, el) => {
|
2017-06-12 15:42:12 -04:00
|
|
|
const gfm = new GfmAutoComplete(gl.GfmAutoComplete && gl.GfmAutoComplete.dataSources);
|
2017-09-06 12:14:34 -04:00
|
|
|
const enableGFM = convertPermissionToBoolean(el.dataset.supportsAutocomplete);
|
2017-06-12 15:42:12 -04:00
|
|
|
gfm.setup($(el), {
|
|
|
|
emojis: true,
|
|
|
|
members: enableGFM,
|
|
|
|
issues: enableGFM,
|
|
|
|
milestones: enableGFM,
|
|
|
|
mergeRequests: enableGFM,
|
|
|
|
labels: enableGFM,
|
|
|
|
});
|
|
|
|
});
|
2017-05-16 14:42:06 -04:00
|
|
|
|
2017-03-13 18:46:21 -04:00
|
|
|
function initBlob() {
|
|
|
|
new LineHighlighter();
|
|
|
|
|
|
|
|
new BlobLinePermalinkUpdater(
|
|
|
|
document.querySelector('#blob-content-holder'),
|
|
|
|
'.diff-line-num[data-line-number]',
|
|
|
|
document.querySelectorAll('.js-data-file-blob-permalink-url, .js-blob-blame-link'),
|
|
|
|
);
|
|
|
|
|
|
|
|
shortcut_handler = new ShortcutsNavigation();
|
|
|
|
fileBlobPermalinkUrlElement = document.querySelector('.js-data-file-blob-permalink-url');
|
|
|
|
fileBlobPermalinkUrl = fileBlobPermalinkUrlElement && fileBlobPermalinkUrlElement.getAttribute('href');
|
|
|
|
new ShortcutsBlob({
|
|
|
|
skipResetBindings: true,
|
|
|
|
fileBlobPermalinkUrl,
|
|
|
|
});
|
2017-04-06 12:36:38 -04:00
|
|
|
|
2017-04-10 16:51:24 -04:00
|
|
|
new BlobForkSuggestion({
|
|
|
|
openButtons: document.querySelectorAll('.js-edit-blob-link-fork-toggler'),
|
|
|
|
forkButtons: document.querySelectorAll('.js-fork-suggestion-button'),
|
|
|
|
cancelButtons: document.querySelectorAll('.js-cancel-fork-suggestion-button'),
|
|
|
|
suggestionSections: document.querySelectorAll('.js-file-fork-suggestion-section'),
|
|
|
|
actionTextPieces: document.querySelectorAll('.js-file-fork-suggestion-section-action'),
|
2017-04-21 14:56:27 -04:00
|
|
|
})
|
|
|
|
.init();
|
2017-03-13 18:46:21 -04:00
|
|
|
}
|
|
|
|
|
2017-08-02 05:27:24 -04:00
|
|
|
const filteredSearchEnabled = gl.FilteredSearchManager && document.querySelector('.filtered-search');
|
|
|
|
|
2016-07-24 16:45:11 -04:00
|
|
|
switch (page) {
|
2017-06-16 11:38:45 -04:00
|
|
|
case 'profiles:preferences:show':
|
|
|
|
initExperimentalFlags();
|
|
|
|
break;
|
2016-09-09 08:21:00 -04:00
|
|
|
case 'sessions:new':
|
|
|
|
new UsernameValidator();
|
2017-07-06 14:58:47 -04:00
|
|
|
new SigninTabsMemoizer();
|
2017-07-03 12:23:28 -04:00
|
|
|
new OAuthRememberMe({ container: $(".omniauth-container") }).bindEvents();
|
2016-09-09 08:21:00 -04:00
|
|
|
break;
|
2016-08-19 05:21:09 -04:00
|
|
|
case 'projects:boards:show':
|
2016-10-12 12:43:20 -04:00
|
|
|
case 'projects:boards:index':
|
2016-08-19 05:21:09 -04:00
|
|
|
shortcut_handler = new ShortcutsNavigation();
|
2017-05-12 04:15:28 -04:00
|
|
|
new UsersSelect();
|
2016-08-19 05:21:09 -04:00
|
|
|
break;
|
2016-09-06 08:49:49 -04:00
|
|
|
case 'projects:merge_requests:index':
|
2016-07-24 16:45:11 -04:00
|
|
|
case 'projects:issues:index':
|
2017-08-02 05:27:24 -04:00
|
|
|
if (filteredSearchEnabled) {
|
2017-05-22 15:58:23 -04:00
|
|
|
const filteredSearchManager = new gl.FilteredSearchManager(page === 'projects:issues:index' ? 'issues' : 'merge_requests');
|
|
|
|
filteredSearchManager.setup();
|
2016-11-04 17:27:11 -04:00
|
|
|
}
|
2017-05-15 18:12:43 -04:00
|
|
|
const pagePrefix = page === 'projects:merge_requests:index' ? 'merge_request_' : 'issue_';
|
2017-10-26 14:03:48 -04:00
|
|
|
new IssuableIndex(pagePrefix);
|
2017-05-15 18:12:43 -04:00
|
|
|
|
2016-07-24 16:45:11 -04:00
|
|
|
shortcut_handler = new ShortcutsNavigation();
|
2017-05-12 04:15:28 -04:00
|
|
|
new UsersSelect();
|
2016-07-24 16:45:11 -04:00
|
|
|
break;
|
|
|
|
case 'projects:issues:show':
|
|
|
|
new Issue();
|
|
|
|
shortcut_handler = new ShortcutsIssuable();
|
|
|
|
new ZenMode();
|
2017-07-25 06:56:41 -04:00
|
|
|
initIssuableSidebar();
|
2016-07-24 16:45:11 -04:00
|
|
|
break;
|
2017-07-03 06:58:06 -04:00
|
|
|
case 'dashboard:milestones:index':
|
2017-11-17 06:30:09 -05:00
|
|
|
projectSelect();
|
2017-07-03 06:58:06 -04:00
|
|
|
break;
|
2016-07-24 16:45:11 -04:00
|
|
|
case 'projects:milestones:show':
|
|
|
|
case 'groups:milestones:show':
|
|
|
|
case 'dashboard:milestones:show':
|
|
|
|
new Milestone();
|
2017-03-23 16:53:51 -04:00
|
|
|
new Sidebar();
|
2016-07-24 16:45:11 -04:00
|
|
|
break;
|
2017-07-25 06:56:41 -04:00
|
|
|
case 'dashboard:issues':
|
|
|
|
case 'dashboard:merge_requests':
|
2017-11-17 06:30:09 -05:00
|
|
|
projectSelect();
|
2017-07-25 06:56:41 -04:00
|
|
|
initLegacyFilters();
|
2017-05-12 04:15:28 -04:00
|
|
|
break;
|
2017-08-02 05:27:24 -04:00
|
|
|
case 'groups:issues':
|
2017-08-19 10:12:05 -04:00
|
|
|
case 'groups:merge_requests':
|
2017-08-02 05:27:24 -04:00
|
|
|
if (filteredSearchEnabled) {
|
2017-08-19 10:12:05 -04:00
|
|
|
const filteredSearchManager = new gl.FilteredSearchManager(page === 'groups:issues' ? 'issues' : 'merge_requests');
|
2017-08-02 05:27:24 -04:00
|
|
|
filteredSearchManager.setup();
|
|
|
|
}
|
2017-11-17 06:30:09 -05:00
|
|
|
projectSelect();
|
2017-08-02 05:27:24 -04:00
|
|
|
break;
|
2016-07-24 16:45:11 -04:00
|
|
|
case 'dashboard:todos:index':
|
2017-07-06 13:57:01 -04:00
|
|
|
new Todos();
|
2016-07-24 16:45:11 -04:00
|
|
|
break;
|
2017-03-03 05:13:03 -05:00
|
|
|
case 'dashboard:projects:index':
|
|
|
|
case 'dashboard:projects:starred':
|
|
|
|
case 'explore:projects:index':
|
|
|
|
case 'explore:projects:trending':
|
|
|
|
case 'explore:projects:starred':
|
|
|
|
case 'admin:projects:index':
|
|
|
|
new ProjectsList();
|
|
|
|
break;
|
2017-03-02 06:05:48 -05:00
|
|
|
case 'explore:groups:index':
|
|
|
|
new GroupsList();
|
2017-05-02 04:05:43 -04:00
|
|
|
const landingElement = document.querySelector('.js-explore-groups-landing');
|
|
|
|
if (!landingElement) break;
|
|
|
|
const exploreGroupsLanding = new Landing(
|
|
|
|
landingElement,
|
|
|
|
landingElement.querySelector('.dismiss-button'),
|
|
|
|
'explore_groups_landing_dismissed',
|
|
|
|
);
|
|
|
|
exploreGroupsLanding.toggle();
|
2017-03-02 06:05:48 -05:00
|
|
|
break;
|
2016-07-24 16:45:11 -04:00
|
|
|
case 'projects:milestones:new':
|
|
|
|
case 'projects:milestones:edit':
|
2017-01-04 08:16:14 -05:00
|
|
|
case 'projects:milestones:update':
|
2017-10-24 18:01:49 -04:00
|
|
|
new ZenMode();
|
|
|
|
new DueDateSelectors();
|
|
|
|
new GLForm($('.milestone-form'), true);
|
|
|
|
break;
|
2017-04-19 05:04:24 -04:00
|
|
|
case 'groups:milestones:new':
|
|
|
|
case 'groups:milestones:edit':
|
|
|
|
case 'groups:milestones:update':
|
2016-07-24 16:45:11 -04:00
|
|
|
new ZenMode();
|
2017-10-18 07:31:01 -04:00
|
|
|
new DueDateSelectors();
|
2017-10-23 08:41:52 -04:00
|
|
|
new GLForm($('.milestone-form'), false);
|
2016-07-24 16:45:11 -04:00
|
|
|
break;
|
|
|
|
case 'projects:compare:show':
|
2017-10-19 05:46:43 -04:00
|
|
|
new Diff();
|
2017-10-23 05:21:38 -04:00
|
|
|
const paddingTop = 16;
|
|
|
|
initChangesDropdown(document.querySelector('.navbar-gitlab').offsetHeight - paddingTop);
|
2016-07-24 16:45:11 -04:00
|
|
|
break;
|
2017-08-01 04:50:59 -04:00
|
|
|
case 'projects:branches:new':
|
|
|
|
case 'projects:branches:create':
|
|
|
|
new NewBranchForm($('.js-create-branch-form'), JSON.parse(document.getElementById('availableRefs').innerHTML));
|
|
|
|
break;
|
2016-10-09 10:17:14 -04:00
|
|
|
case 'projects:branches:index':
|
2017-10-09 05:04:13 -04:00
|
|
|
AjaxLoadingSpinner.init();
|
2017-05-08 03:41:58 -04:00
|
|
|
new DeleteModal();
|
2016-10-09 10:17:14 -04:00
|
|
|
break;
|
2016-07-24 16:45:11 -04:00
|
|
|
case 'projects:issues:new':
|
|
|
|
case 'projects:issues:edit':
|
|
|
|
shortcut_handler = new ShortcutsNavigation();
|
2017-10-10 04:09:01 -04:00
|
|
|
new GLForm($('.issue-form'), true);
|
2016-07-24 16:45:11 -04:00
|
|
|
new IssuableForm($('.issue-form'));
|
2016-08-30 06:21:29 -04:00
|
|
|
new LabelsSelect();
|
|
|
|
new MilestoneSelect();
|
2016-10-05 06:48:18 -04:00
|
|
|
new gl.IssuableTemplateSelectors();
|
2016-07-24 16:45:11 -04:00
|
|
|
break;
|
2017-06-13 18:12:31 -04:00
|
|
|
case 'projects:merge_requests:creations:new':
|
2017-07-27 04:30:14 -04:00
|
|
|
const mrNewCompareNode = document.querySelector('.js-merge-request-new-compare');
|
|
|
|
if (mrNewCompareNode) {
|
|
|
|
new Compare({
|
|
|
|
targetProjectUrl: mrNewCompareNode.dataset.targetProjectUrl,
|
|
|
|
sourceBranchUrl: mrNewCompareNode.dataset.sourceBranchUrl,
|
|
|
|
targetBranchUrl: mrNewCompareNode.dataset.targetBranchUrl,
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
const mrNewSubmitNode = document.querySelector('.js-merge-request-new-submit');
|
|
|
|
new MergeRequest({
|
|
|
|
action: mrNewSubmitNode.dataset.mrSubmitAction,
|
|
|
|
});
|
|
|
|
}
|
2017-06-13 18:12:31 -04:00
|
|
|
case 'projects:merge_requests:creations:diffs':
|
2016-07-24 16:45:11 -04:00
|
|
|
case 'projects:merge_requests:edit':
|
2017-10-19 05:46:43 -04:00
|
|
|
new Diff();
|
2016-07-24 16:45:11 -04:00
|
|
|
shortcut_handler = new ShortcutsNavigation();
|
2017-10-10 04:09:01 -04:00
|
|
|
new GLForm($('.merge-request-form'), true);
|
2016-07-24 16:45:11 -04:00
|
|
|
new IssuableForm($('.merge-request-form'));
|
2016-08-30 06:21:29 -04:00
|
|
|
new LabelsSelect();
|
|
|
|
new MilestoneSelect();
|
2016-10-05 06:48:18 -04:00
|
|
|
new gl.IssuableTemplateSelectors();
|
2017-04-25 05:34:46 -04:00
|
|
|
new AutoWidthDropdownSelect($('.js-target-branch-select')).init();
|
2016-07-24 16:45:11 -04:00
|
|
|
break;
|
|
|
|
case 'projects:tags:new':
|
|
|
|
new ZenMode();
|
2017-10-10 04:09:01 -04:00
|
|
|
new GLForm($('.tag-form'), true);
|
2017-07-28 05:07:57 -04:00
|
|
|
new RefSelectDropdown($('.js-branch-select'));
|
2016-07-24 16:45:11 -04:00
|
|
|
break;
|
2017-07-25 06:56:41 -04:00
|
|
|
case 'projects:snippets:show':
|
|
|
|
initNotes();
|
|
|
|
break;
|
2017-05-03 11:26:49 -04:00
|
|
|
case 'projects:snippets:new':
|
|
|
|
case 'projects:snippets:edit':
|
|
|
|
case 'projects:snippets:create':
|
|
|
|
case 'projects:snippets:update':
|
2017-10-10 04:09:01 -04:00
|
|
|
new GLForm($('.snippet-form'), true);
|
2017-06-19 17:29:58 -04:00
|
|
|
break;
|
2017-05-03 11:26:49 -04:00
|
|
|
case 'snippets:new':
|
|
|
|
case 'snippets:edit':
|
|
|
|
case 'snippets:create':
|
|
|
|
case 'snippets:update':
|
2017-10-10 04:09:01 -04:00
|
|
|
new GLForm($('.snippet-form'), false);
|
2017-05-03 11:26:49 -04:00
|
|
|
break;
|
2016-07-24 16:45:11 -04:00
|
|
|
case 'projects:releases:edit':
|
|
|
|
new ZenMode();
|
2017-10-10 04:09:01 -04:00
|
|
|
new GLForm($('.release-form'), true);
|
2016-07-24 16:45:11 -04:00
|
|
|
break;
|
|
|
|
case 'projects:merge_requests:show':
|
2017-10-19 05:46:43 -04:00
|
|
|
new Diff();
|
2016-07-24 16:45:11 -04:00
|
|
|
new ZenMode();
|
2017-07-27 11:00:30 -04:00
|
|
|
|
2017-07-25 06:56:41 -04:00
|
|
|
initIssuableSidebar();
|
|
|
|
initNotes();
|
2017-07-27 11:00:30 -04:00
|
|
|
|
2017-07-27 04:30:14 -04:00
|
|
|
const mrShowNode = document.querySelector('.merge-request');
|
|
|
|
window.mergeRequest = new MergeRequest({
|
|
|
|
action: mrShowNode.dataset.mrAction,
|
|
|
|
});
|
2017-11-21 11:11:45 -05:00
|
|
|
|
|
|
|
shortcut_handler = new ShortcutsIssuable(true);
|
2016-07-24 16:45:11 -04:00
|
|
|
break;
|
|
|
|
case 'dashboard:activity':
|
2016-11-20 00:52:53 -05:00
|
|
|
new gl.Activities();
|
2016-07-24 16:45:11 -04:00
|
|
|
break;
|
|
|
|
case 'projects:commit:show':
|
2017-10-19 05:46:43 -04:00
|
|
|
new Diff();
|
2016-07-24 16:45:11 -04:00
|
|
|
new ZenMode();
|
|
|
|
shortcut_handler = new ShortcutsNavigation();
|
2017-03-15 20:44:31 -04:00
|
|
|
new MiniPipelineGraph({
|
|
|
|
container: '.js-commit-pipeline-graph',
|
|
|
|
}).bindEvents();
|
2017-07-25 06:56:41 -04:00
|
|
|
initNotes();
|
2017-11-17 05:53:14 -05:00
|
|
|
const stickyBarPaddingTop = 16;
|
|
|
|
initChangesDropdown(document.querySelector('.navbar-gitlab').offsetHeight - stickyBarPaddingTop);
|
2017-08-01 04:50:59 -04:00
|
|
|
$('.commit-info.branches').load(document.querySelector('.js-commit-box').dataset.commitPath);
|
2016-07-24 16:45:11 -04:00
|
|
|
break;
|
2017-01-14 10:27:50 -05:00
|
|
|
case 'projects:commit:pipelines':
|
2017-03-09 13:26:15 -05:00
|
|
|
new MiniPipelineGraph({
|
2017-03-15 20:44:31 -04:00
|
|
|
container: '.js-commit-pipeline-graph',
|
2017-01-14 10:27:50 -05:00
|
|
|
}).bindEvents();
|
2017-08-01 04:50:59 -04:00
|
|
|
$('.commit-info.branches').load(document.querySelector('.js-commit-box').dataset.commitPath);
|
2017-01-14 10:27:50 -05:00
|
|
|
break;
|
2017-08-01 04:50:59 -04:00
|
|
|
case 'projects:activity':
|
|
|
|
new gl.Activities();
|
2017-07-25 03:40:23 -04:00
|
|
|
shortcut_handler = new ShortcutsNavigation();
|
|
|
|
break;
|
2017-08-01 04:50:59 -04:00
|
|
|
case 'projects:commits:show':
|
|
|
|
CommitsList.init(document.querySelector('.js-project-commits-show').dataset.commitsLimit);
|
2016-07-24 16:45:11 -04:00
|
|
|
shortcut_handler = new ShortcutsNavigation();
|
2017-08-01 04:50:59 -04:00
|
|
|
GpgBadges.fetch();
|
2016-07-24 16:45:11 -04:00
|
|
|
break;
|
|
|
|
case 'projects:show':
|
|
|
|
shortcut_handler = new ShortcutsNavigation();
|
|
|
|
new NotificationsForm();
|
2017-10-16 12:16:42 -04:00
|
|
|
new UserCallout({
|
|
|
|
setCalloutPerProject: true,
|
|
|
|
className: 'js-autodevops-banner',
|
|
|
|
});
|
2017-07-28 12:18:32 -04:00
|
|
|
|
|
|
|
if ($('#tree-slider').length) new TreeView();
|
2017-07-31 21:36:01 -04:00
|
|
|
if ($('.blob-viewer').length) new BlobViewer();
|
2017-08-08 07:43:45 -04:00
|
|
|
if ($('.project-show-activity').length) new gl.Activities();
|
2017-08-08 00:03:27 -04:00
|
|
|
$('#tree-slider').waitForImages(function() {
|
2017-09-06 04:01:01 -04:00
|
|
|
ajaxGet(document.querySelector('.js-tree-content').dataset.logsPath);
|
2017-08-08 00:03:27 -04:00
|
|
|
});
|
2016-07-24 16:45:11 -04:00
|
|
|
break;
|
2017-05-09 11:09:20 -04:00
|
|
|
case 'projects:edit':
|
2017-05-16 12:41:50 -04:00
|
|
|
setupProjectEdit();
|
2017-07-03 13:51:32 -04:00
|
|
|
// Initialize expandable settings panels
|
|
|
|
initSettingsPanels();
|
2017-05-09 11:09:20 -04:00
|
|
|
break;
|
2017-08-01 04:50:59 -04:00
|
|
|
case 'projects:imports:show':
|
2017-11-13 12:45:45 -05:00
|
|
|
projectImport();
|
2017-08-01 04:50:59 -04:00
|
|
|
break;
|
2017-07-25 06:12:30 -04:00
|
|
|
case 'projects:pipelines:new':
|
2017-07-28 05:07:57 -04:00
|
|
|
new NewBranchForm($('.js-new-pipeline-form'));
|
2017-07-25 06:12:30 -04:00
|
|
|
break;
|
2016-12-21 06:21:11 -05:00
|
|
|
case 'projects:pipelines:builds':
|
2017-04-15 21:33:01 -04:00
|
|
|
case 'projects:pipelines:failures':
|
2016-09-29 17:24:37 -04:00
|
|
|
case 'projects:pipelines:show':
|
2016-11-29 05:35:53 -05:00
|
|
|
const { controllerAction } = document.querySelector('.js-pipeline-container').dataset;
|
2017-04-06 06:40:39 -04:00
|
|
|
const pipelineStatusUrl = `${document.querySelector('.js-pipeline-tab-link a').getAttribute('href')}/status.json`;
|
2016-11-24 11:43:54 -05:00
|
|
|
|
2017-05-06 13:02:06 -04:00
|
|
|
new Pipelines({
|
2016-11-24 11:43:54 -05:00
|
|
|
initTabs: true,
|
2017-04-06 06:40:39 -04:00
|
|
|
pipelineStatusUrl,
|
2016-11-24 11:43:54 -05:00
|
|
|
tabsOptions: {
|
|
|
|
action: controllerAction,
|
|
|
|
defaultAction: 'pipelines',
|
|
|
|
parentEl: '.pipelines-tabs',
|
|
|
|
},
|
|
|
|
});
|
2016-09-29 17:24:37 -04:00
|
|
|
break;
|
2016-07-24 16:45:11 -04:00
|
|
|
case 'groups:activity':
|
2016-11-20 00:52:53 -05:00
|
|
|
new gl.Activities();
|
2016-07-24 16:45:11 -04:00
|
|
|
break;
|
|
|
|
case 'groups:show':
|
2017-10-05 10:23:29 -04:00
|
|
|
const newGroupChildWrapper = document.querySelector('.js-new-project-subgroup');
|
2016-07-24 16:45:11 -04:00
|
|
|
shortcut_handler = new ShortcutsNavigation();
|
|
|
|
new NotificationsForm();
|
|
|
|
new NotificationsDropdown();
|
2017-03-03 05:13:03 -05:00
|
|
|
new ProjectsList();
|
2017-10-05 10:23:29 -04:00
|
|
|
|
|
|
|
if (newGroupChildWrapper) {
|
|
|
|
new NewGroupChild(newGroupChildWrapper);
|
|
|
|
}
|
2016-07-24 16:45:11 -04:00
|
|
|
break;
|
|
|
|
case 'groups:group_members:index':
|
2017-10-12 05:42:13 -04:00
|
|
|
memberExpirationDate();
|
|
|
|
new Members();
|
2016-07-24 16:45:11 -04:00
|
|
|
new UsersSelect();
|
|
|
|
break;
|
2017-07-07 10:40:41 -04:00
|
|
|
case 'projects:project_members:index':
|
2017-10-12 05:42:13 -04:00
|
|
|
memberExpirationDate('.js-access-expiration-date-groups');
|
2017-10-27 05:05:03 -04:00
|
|
|
groupsSelect();
|
2017-10-12 05:42:13 -04:00
|
|
|
memberExpirationDate();
|
|
|
|
new Members();
|
2016-07-24 16:45:11 -04:00
|
|
|
new UsersSelect();
|
|
|
|
break;
|
|
|
|
case 'groups:new':
|
2017-02-28 11:32:30 -05:00
|
|
|
case 'admin:groups:new':
|
2017-03-02 07:55:22 -05:00
|
|
|
case 'groups:create':
|
|
|
|
case 'admin:groups:create':
|
2017-03-03 03:01:54 -05:00
|
|
|
BindInOut.initAll();
|
2017-03-12 11:22:00 -04:00
|
|
|
new Group();
|
2017-10-23 09:05:53 -04:00
|
|
|
groupAvatar();
|
2017-03-12 11:22:00 -04:00
|
|
|
break;
|
2016-07-24 16:45:11 -04:00
|
|
|
case 'groups:edit':
|
|
|
|
case 'admin:groups:edit':
|
2017-10-23 09:05:53 -04:00
|
|
|
groupAvatar();
|
2016-07-24 16:45:11 -04:00
|
|
|
break;
|
2017-07-28 12:18:32 -04:00
|
|
|
case 'projects:tree:show':
|
|
|
|
shortcut_handler = new ShortcutsNavigation();
|
|
|
|
|
2017-08-17 13:35:33 -04:00
|
|
|
if (UserFeatureHelper.isNewRepoEnabled()) break;
|
2017-07-28 12:18:32 -04:00
|
|
|
|
|
|
|
new TreeView();
|
|
|
|
new BlobViewer();
|
2017-08-01 04:50:59 -04:00
|
|
|
new NewCommitForm($('.js-create-dir-form'));
|
2017-07-25 06:48:45 -04:00
|
|
|
$('#tree-slider').waitForImages(function() {
|
2017-09-06 04:01:01 -04:00
|
|
|
ajaxGet(document.querySelector('.js-tree-content').dataset.logsPath);
|
2017-07-25 06:48:45 -04:00
|
|
|
});
|
2017-07-28 12:18:32 -04:00
|
|
|
break;
|
2016-07-24 16:45:11 -04:00
|
|
|
case 'projects:find_file:show':
|
2017-08-01 04:50:59 -04:00
|
|
|
const findElement = document.querySelector('.js-file-finder');
|
|
|
|
const projectFindFile = new ProjectFindFile($(".file-finder-holder"), {
|
|
|
|
url: findElement.dataset.fileFindUrl,
|
|
|
|
treeUrl: findElement.dataset.findTreeUrl,
|
|
|
|
blobUrlTemplate: findElement.dataset.blobUrlTemplate,
|
|
|
|
});
|
|
|
|
new ShortcutsFindFile(projectFindFile);
|
2016-07-24 16:45:11 -04:00
|
|
|
shortcut_handler = true;
|
|
|
|
break;
|
2017-07-28 12:18:32 -04:00
|
|
|
case 'projects:blob:show':
|
2017-08-17 13:35:33 -04:00
|
|
|
if (UserFeatureHelper.isNewRepoEnabled()) break;
|
2017-07-28 12:18:32 -04:00
|
|
|
new BlobViewer();
|
|
|
|
initBlob();
|
|
|
|
break;
|
2016-07-24 16:45:11 -04:00
|
|
|
case 'projects:blame:show':
|
2017-03-13 18:46:21 -04:00
|
|
|
initBlob();
|
2016-07-24 16:45:11 -04:00
|
|
|
break;
|
2016-09-19 15:49:08 -04:00
|
|
|
case 'groups:labels:new':
|
|
|
|
case 'groups:labels:edit':
|
2016-07-24 16:45:11 -04:00
|
|
|
case 'projects:labels:new':
|
|
|
|
case 'projects:labels:edit':
|
|
|
|
new Labels();
|
|
|
|
break;
|
2017-07-25 06:56:41 -04:00
|
|
|
case 'groups:labels:index':
|
2016-07-24 16:45:11 -04:00
|
|
|
case 'projects:labels:index':
|
|
|
|
if ($('.prioritized-labels').length) {
|
2017-10-10 13:22:34 -04:00
|
|
|
new LabelManager();
|
2016-07-24 16:45:11 -04:00
|
|
|
}
|
2017-07-26 06:13:35 -04:00
|
|
|
$('.label-subscription').each((i, el) => {
|
|
|
|
const $el = $(el);
|
|
|
|
|
|
|
|
if ($el.find('.dropdown-group-label').length) {
|
2017-10-23 09:05:53 -04:00
|
|
|
new GroupLabelSubscription($el);
|
2017-07-26 06:13:35 -04:00
|
|
|
} else {
|
2017-11-17 06:30:09 -05:00
|
|
|
new ProjectLabelSubscription($el);
|
2017-07-26 06:13:35 -04:00
|
|
|
}
|
|
|
|
});
|
2016-07-24 16:45:11 -04:00
|
|
|
break;
|
|
|
|
case 'projects:network:show':
|
2016-07-26 23:32:10 -04:00
|
|
|
// Ensure we don't create a particular shortcut handler here. This is
|
|
|
|
// already created, where the network graph is created.
|
2016-07-24 16:45:11 -04:00
|
|
|
shortcut_handler = true;
|
|
|
|
break;
|
|
|
|
case 'projects:forks:new':
|
2017-09-28 06:44:33 -04:00
|
|
|
import(/* webpackChunkName: 'project_fork' */ './project_fork')
|
|
|
|
.then(fork => fork.default())
|
|
|
|
.catch(() => {});
|
2016-07-24 16:45:11 -04:00
|
|
|
break;
|
|
|
|
case 'projects:artifacts:browse':
|
2017-06-08 09:23:50 -04:00
|
|
|
new ShortcutsNavigation();
|
2016-07-24 16:45:11 -04:00
|
|
|
new BuildArtifacts();
|
|
|
|
break;
|
2017-05-02 18:42:37 -04:00
|
|
|
case 'projects:artifacts:file':
|
2017-06-08 09:23:50 -04:00
|
|
|
new ShortcutsNavigation();
|
2017-05-02 18:42:37 -04:00
|
|
|
new BlobViewer();
|
|
|
|
break;
|
2017-01-19 09:29:11 -05:00
|
|
|
case 'help:index':
|
2017-06-30 17:50:13 -04:00
|
|
|
VersionCheckImage.bindErrorEvent($('img.js-version-status-badge'));
|
2017-01-19 09:29:11 -05:00
|
|
|
break;
|
2016-07-24 16:45:11 -04:00
|
|
|
case 'search:show':
|
|
|
|
new Search();
|
2016-07-29 03:01:15 -04:00
|
|
|
break;
|
2017-06-13 18:12:31 -04:00
|
|
|
case 'projects:settings:repository:show':
|
2017-06-07 04:11:44 -04:00
|
|
|
// Initialize expandable settings panels
|
|
|
|
initSettingsPanels();
|
2016-07-29 03:01:15 -04:00
|
|
|
break;
|
2017-06-13 18:12:31 -04:00
|
|
|
case 'projects:settings:ci_cd:show':
|
2017-09-06 11:38:13 -04:00
|
|
|
// Initialize expandable settings panels
|
|
|
|
initSettingsPanels();
|
2017-05-03 14:51:55 -04:00
|
|
|
case 'groups:settings:ci_cd:show':
|
2017-11-17 06:30:09 -05:00
|
|
|
new ProjectVariables();
|
2016-11-24 03:21:48 -05:00
|
|
|
break;
|
2017-01-04 16:44:16 -05:00
|
|
|
case 'ci:lints:create':
|
|
|
|
case 'ci:lints:show':
|
2017-10-10 07:06:42 -04:00
|
|
|
new CILintEditor();
|
2017-01-04 16:44:16 -05:00
|
|
|
break;
|
2017-02-17 12:28:52 -05:00
|
|
|
case 'users:show':
|
|
|
|
new UserCallout();
|
|
|
|
break;
|
2017-05-24 06:25:44 -04:00
|
|
|
case 'admin:conversational_development_index:show':
|
|
|
|
new UserCallout();
|
|
|
|
break;
|
2017-04-13 12:47:28 -04:00
|
|
|
case 'snippets:show':
|
|
|
|
new LineHighlighter();
|
|
|
|
new BlobViewer();
|
2017-07-25 06:56:41 -04:00
|
|
|
initNotes();
|
2017-04-13 12:47:28 -04:00
|
|
|
break;
|
2017-05-12 04:15:28 -04:00
|
|
|
case 'import:fogbugz:new_user_map':
|
|
|
|
new UsersSelect();
|
|
|
|
break;
|
2017-07-25 06:56:41 -04:00
|
|
|
case 'profiles:personal_access_tokens:index':
|
|
|
|
case 'admin:impersonation_tokens:index':
|
2017-10-18 07:31:01 -04:00
|
|
|
new DueDateSelectors();
|
2017-07-25 06:56:41 -04:00
|
|
|
break;
|
2017-10-03 13:23:25 -04:00
|
|
|
case 'projects:clusters:show':
|
2017-10-24 00:56:39 -04:00
|
|
|
import(/* webpackChunkName: "clusters" */ './clusters/clusters_bundle')
|
2017-10-02 15:49:04 -04:00
|
|
|
.then(cluster => new cluster.default()) // eslint-disable-line new-cap
|
2017-10-24 00:56:39 -04:00
|
|
|
.catch((err) => {
|
|
|
|
Flash(s__('ClusterIntegration|Problem setting up the cluster JavaScript'));
|
|
|
|
throw err;
|
|
|
|
});
|
2017-10-02 15:49:04 -04:00
|
|
|
break;
|
2016-07-24 16:45:11 -04:00
|
|
|
}
|
2017-08-04 04:07:05 -04:00
|
|
|
switch (path[0]) {
|
2017-01-23 19:06:17 -05:00
|
|
|
case 'sessions':
|
|
|
|
case 'omniauth_callbacks':
|
|
|
|
if (!gon.u2f) break;
|
2017-10-09 18:21:56 -04:00
|
|
|
const u2fAuthenticate = new U2FAuthenticate(
|
2017-01-23 19:06:17 -05:00
|
|
|
$('#js-authenticate-u2f'),
|
|
|
|
'#js-login-u2f-form',
|
|
|
|
gon.u2f,
|
|
|
|
document.querySelector('#js-login-2fa-device'),
|
|
|
|
document.querySelector('.js-2fa-form'),
|
|
|
|
);
|
2017-10-09 18:21:56 -04:00
|
|
|
u2fAuthenticate.start();
|
|
|
|
// needed in rspec
|
|
|
|
gl.u2fAuthenticate = u2fAuthenticate;
|
2016-07-24 16:45:11 -04:00
|
|
|
case 'admin':
|
|
|
|
new Admin();
|
|
|
|
switch (path[1]) {
|
2017-10-13 05:44:03 -04:00
|
|
|
case 'broadcast_messages':
|
|
|
|
initBroadcastMessagesForm();
|
|
|
|
break;
|
2017-04-05 06:24:15 -04:00
|
|
|
case 'cohorts':
|
2017-06-30 19:12:24 -04:00
|
|
|
new UsagePing();
|
2017-04-05 08:29:48 -04:00
|
|
|
break;
|
2016-07-24 16:45:11 -04:00
|
|
|
case 'groups':
|
|
|
|
new UsersSelect();
|
|
|
|
break;
|
|
|
|
case 'projects':
|
2017-10-26 07:03:44 -04:00
|
|
|
document.querySelectorAll('.js-namespace-select')
|
|
|
|
.forEach(dropdown => new NamespaceSelect({ dropdown }));
|
2016-07-26 18:59:55 -04:00
|
|
|
break;
|
|
|
|
case 'labels':
|
2016-07-27 04:24:11 -04:00
|
|
|
switch (path[2]) {
|
2016-08-31 18:54:06 -04:00
|
|
|
case 'new':
|
2016-07-27 04:24:11 -04:00
|
|
|
case 'edit':
|
|
|
|
new Labels();
|
|
|
|
}
|
2016-06-30 22:18:52 -04:00
|
|
|
case 'abuse_reports':
|
2017-10-05 10:57:49 -04:00
|
|
|
new AbuseReports();
|
2016-06-30 22:18:52 -04:00
|
|
|
break;
|
2016-07-24 16:45:11 -04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'dashboard':
|
|
|
|
case 'root':
|
2017-02-17 12:28:52 -05:00
|
|
|
new UserCallout();
|
2016-07-24 16:45:11 -04:00
|
|
|
break;
|
|
|
|
case 'profiles':
|
|
|
|
new NotificationsForm();
|
|
|
|
new NotificationsDropdown();
|
|
|
|
break;
|
|
|
|
case 'projects':
|
|
|
|
new Project();
|
2017-11-13 12:45:45 -05:00
|
|
|
projectAvatar();
|
2016-07-24 16:45:11 -04:00
|
|
|
switch (path[1]) {
|
|
|
|
case 'compare':
|
|
|
|
new CompareAutocomplete();
|
|
|
|
break;
|
|
|
|
case 'edit':
|
|
|
|
shortcut_handler = new ShortcutsNavigation();
|
|
|
|
new ProjectNew();
|
2017-09-07 14:07:40 -04:00
|
|
|
import(/* webpackChunkName: 'project_permissions' */ './projects/permissions')
|
|
|
|
.then(permissions => permissions.default())
|
|
|
|
.catch(() => {});
|
2016-07-24 16:45:11 -04:00
|
|
|
break;
|
|
|
|
case 'new':
|
|
|
|
new ProjectNew();
|
2017-08-25 20:43:33 -04:00
|
|
|
initProjectVisibilitySelector();
|
2016-07-24 16:45:11 -04:00
|
|
|
break;
|
|
|
|
case 'show':
|
2016-07-26 18:59:55 -04:00
|
|
|
new Star();
|
2016-07-24 16:45:11 -04:00
|
|
|
new ProjectNew();
|
|
|
|
new NotificationsDropdown();
|
|
|
|
break;
|
|
|
|
case 'wikis':
|
2017-06-30 17:39:33 -04:00
|
|
|
new Wikis();
|
2017-03-26 16:16:55 -04:00
|
|
|
shortcut_handler = new ShortcutsWiki();
|
2016-07-24 16:45:11 -04:00
|
|
|
new ZenMode();
|
2017-10-10 04:09:01 -04:00
|
|
|
new GLForm($('.wiki-form'), true);
|
2016-07-24 16:45:11 -04:00
|
|
|
break;
|
|
|
|
case 'snippets':
|
|
|
|
shortcut_handler = new ShortcutsNavigation();
|
|
|
|
if (path[2] === 'show') {
|
|
|
|
new ZenMode();
|
2017-04-13 12:47:28 -04:00
|
|
|
new LineHighlighter();
|
|
|
|
new BlobViewer();
|
2016-07-24 16:45:11 -04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'labels':
|
|
|
|
case 'graphs':
|
|
|
|
case 'compare':
|
|
|
|
case 'pipelines':
|
|
|
|
case 'forks':
|
|
|
|
case 'milestones':
|
|
|
|
case 'project_members':
|
|
|
|
case 'deploy_keys':
|
|
|
|
case 'builds':
|
|
|
|
case 'hooks':
|
|
|
|
case 'services':
|
|
|
|
case 'protected_branches':
|
|
|
|
shortcut_handler = new ShortcutsNavigation();
|
|
|
|
}
|
2017-07-18 18:27:01 -04:00
|
|
|
break;
|
2016-07-24 16:45:11 -04:00
|
|
|
}
|
2016-07-26 23:32:10 -04:00
|
|
|
// If we haven't installed a custom shortcut handler, install the default one
|
2016-07-24 16:45:11 -04:00
|
|
|
if (!shortcut_handler) {
|
2017-01-23 19:06:17 -05:00
|
|
|
new Shortcuts();
|
2016-07-24 16:45:11 -04:00
|
|
|
}
|
2017-07-06 15:37:31 -04:00
|
|
|
|
|
|
|
if (document.querySelector('#peek')) {
|
|
|
|
new PerformanceBar({ container: '#peek' });
|
|
|
|
}
|
2016-07-24 16:45:11 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
Dispatcher.prototype.initSearch = function() {
|
2016-07-26 23:32:10 -04:00
|
|
|
// Only when search form is present
|
2016-07-24 16:45:11 -04:00
|
|
|
if ($('.search').length) {
|
2016-09-08 09:59:33 -04:00
|
|
|
return new gl.SearchAutocomplete();
|
2016-07-24 16:45:11 -04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2016-09-09 08:21:00 -04:00
|
|
|
Dispatcher.prototype.initFieldErrors = function() {
|
2016-11-02 06:35:21 -04:00
|
|
|
$('.gl-show-field-errors').each((i, form) => {
|
2017-10-10 04:09:01 -04:00
|
|
|
new GlFieldErrors(form);
|
2016-10-12 12:47:31 -04:00
|
|
|
});
|
2016-09-09 08:21:00 -04:00
|
|
|
};
|
|
|
|
|
2016-07-24 16:45:11 -04:00
|
|
|
return Dispatcher;
|
|
|
|
})();
|
2017-08-03 16:31:53 -04:00
|
|
|
|
2017-08-08 09:25:00 -04:00
|
|
|
$(window).on('load', function() {
|
2017-08-03 16:31:53 -04:00
|
|
|
new Dispatcher();
|
|
|
|
});
|
2017-02-10 01:50:50 -05:00
|
|
|
}).call(window);
|