2017-01-10 23:02:20 +00: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 */
|
2016-12-14 03:01:05 +00:00
|
|
|
/* global UsernameValidator */
|
|
|
|
/* global ActiveTabMemoizer */
|
|
|
|
/* global ShortcutsNavigation */
|
|
|
|
/* global Build */
|
|
|
|
/* global Issuable */
|
|
|
|
/* global ShortcutsIssuable */
|
|
|
|
/* global ZenMode */
|
|
|
|
/* global Milestone */
|
|
|
|
/* global IssuableForm */
|
|
|
|
/* global LabelsSelect */
|
|
|
|
/* global MilestoneSelect */
|
|
|
|
/* global MergedButtons */
|
|
|
|
/* global Commit */
|
|
|
|
/* global NotificationsForm */
|
|
|
|
/* global TreeView */
|
|
|
|
/* global NotificationsDropdown */
|
|
|
|
/* global UsersSelect */
|
|
|
|
/* global GroupAvatar */
|
|
|
|
/* global LineHighlighter */
|
|
|
|
/* global ProjectFork */
|
|
|
|
/* global BuildArtifacts */
|
|
|
|
/* global GroupsSelect */
|
|
|
|
/* global Search */
|
|
|
|
/* global Admin */
|
|
|
|
/* global NamespaceSelects */
|
|
|
|
/* global ShortcutsDashboardNavigation */
|
|
|
|
/* global Project */
|
|
|
|
/* global ProjectAvatar */
|
|
|
|
/* global CompareAutocomplete */
|
|
|
|
/* global ProjectNew */
|
|
|
|
/* global Star */
|
|
|
|
/* global ProjectShow */
|
|
|
|
/* global Labels */
|
|
|
|
/* global Shortcuts */
|
2017-03-23 20:53:51 +00:00
|
|
|
/* global Sidebar */
|
|
|
|
|
2017-03-01 19:54:04 +00:00
|
|
|
import Issue from './issue';
|
2016-12-14 03:01:05 +00:00
|
|
|
|
2017-03-06 13:06:33 +00:00
|
|
|
import BindInOut from './behaviors/bind_in_out';
|
2017-03-01 02:59:55 +00:00
|
|
|
import GroupName from './group_name';
|
2017-03-02 11:05:48 +00:00
|
|
|
import GroupsList from './groups_list';
|
2017-03-03 10:13:03 +00:00
|
|
|
import ProjectsList from './projects_list';
|
2017-03-09 18:26:15 +00:00
|
|
|
import MiniPipelineGraph from './mini_pipeline_graph_dropdown';
|
2017-02-23 01:27:06 +00:00
|
|
|
import BlobLinePermalinkUpdater from './blob/blob_line_permalink_updater';
|
2017-03-22 08:26:12 +00:00
|
|
|
import UserCallout from './user_callout';
|
2017-03-02 12:55:22 +00:00
|
|
|
|
2017-01-26 03:13:01 +00:00
|
|
|
const ShortcutsBlob = require('./shortcuts_blob');
|
|
|
|
|
2016-07-24 20:45:11 +00:00
|
|
|
(function() {
|
|
|
|
var Dispatcher;
|
|
|
|
|
|
|
|
$(function() {
|
|
|
|
return new Dispatcher();
|
|
|
|
});
|
|
|
|
|
|
|
|
Dispatcher = (function() {
|
|
|
|
function Dispatcher() {
|
|
|
|
this.initSearch();
|
2016-09-09 12:21:00 +00:00
|
|
|
this.initFieldErrors();
|
2016-07-24 20:45:11 +00:00
|
|
|
this.initPageScripts();
|
|
|
|
}
|
|
|
|
|
|
|
|
Dispatcher.prototype.initPageScripts = function() {
|
2016-12-22 06:21:40 +00:00
|
|
|
var page, path, shortcut_handler, fileBlobPermalinkUrlElement, fileBlobPermalinkUrl;
|
2016-07-24 20:45:11 +00:00
|
|
|
page = $('body').attr('data-page');
|
|
|
|
if (!page) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
path = page.split(':');
|
|
|
|
shortcut_handler = null;
|
2017-03-13 22:46:21 +00: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,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2016-07-24 20:45:11 +00:00
|
|
|
switch (page) {
|
2016-09-09 12:21:00 +00:00
|
|
|
case 'sessions:new':
|
|
|
|
new UsernameValidator();
|
2016-11-06 18:41:23 +00:00
|
|
|
new ActiveTabMemoizer();
|
2016-09-09 12:21:00 +00:00
|
|
|
break;
|
2016-08-19 09:21:09 +00:00
|
|
|
case 'projects:boards:show':
|
2016-10-12 16:43:20 +00:00
|
|
|
case 'projects:boards:index':
|
2016-08-19 09:21:09 +00:00
|
|
|
shortcut_handler = new ShortcutsNavigation();
|
|
|
|
break;
|
2016-09-08 15:50:36 +00:00
|
|
|
case 'projects:builds:show':
|
|
|
|
new Build();
|
|
|
|
break;
|
2016-09-06 12:49:49 +00:00
|
|
|
case 'projects:merge_requests:index':
|
2016-07-24 20:45:11 +00:00
|
|
|
case 'projects:issues:index':
|
2017-01-09 17:33:17 +00:00
|
|
|
if (gl.FilteredSearchManager) {
|
2017-02-15 22:13:53 +00:00
|
|
|
new gl.FilteredSearchManager(page === 'projects:issues:index' ? 'issues' : 'merge_requests');
|
2016-11-04 21:27:11 +00:00
|
|
|
}
|
2016-07-24 20:45:11 +00:00
|
|
|
Issuable.init();
|
2016-11-29 07:47:02 +00:00
|
|
|
new gl.IssuableBulkActions({
|
2016-12-15 23:02:45 +00:00
|
|
|
prefixId: page === 'projects:merge_requests:index' ? 'merge_request_' : 'issue_',
|
2016-11-29 07:47:02 +00:00
|
|
|
});
|
2016-07-24 20:45:11 +00:00
|
|
|
shortcut_handler = new ShortcutsNavigation();
|
|
|
|
break;
|
|
|
|
case 'projects:issues:show':
|
|
|
|
new Issue();
|
|
|
|
shortcut_handler = new ShortcutsIssuable();
|
|
|
|
new ZenMode();
|
|
|
|
break;
|
|
|
|
case 'projects:milestones:show':
|
|
|
|
case 'groups:milestones:show':
|
|
|
|
case 'dashboard:milestones:show':
|
|
|
|
new Milestone();
|
2017-03-23 20:53:51 +00:00
|
|
|
new Sidebar();
|
2016-07-24 20:45:11 +00:00
|
|
|
break;
|
|
|
|
case 'dashboard:todos:index':
|
2016-09-08 13:13:15 +00:00
|
|
|
new gl.Todos();
|
2016-07-24 20:45:11 +00:00
|
|
|
break;
|
2017-03-03 10:13:03 +00: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 11:05:48 +00:00
|
|
|
case 'dashboard:groups:index':
|
|
|
|
case 'explore:groups:index':
|
|
|
|
new GroupsList();
|
|
|
|
break;
|
2016-07-24 20:45:11 +00:00
|
|
|
case 'projects:milestones:new':
|
|
|
|
case 'projects:milestones:edit':
|
2017-01-04 13:16:14 +00:00
|
|
|
case 'projects:milestones:update':
|
2016-07-24 20:45:11 +00:00
|
|
|
new ZenMode();
|
2016-10-11 08:19:18 +00:00
|
|
|
new gl.DueDateSelectors();
|
2017-01-03 12:04:33 +00:00
|
|
|
new gl.GLForm($('.milestone-form'));
|
2016-07-24 20:45:11 +00:00
|
|
|
break;
|
|
|
|
case 'groups:milestones:new':
|
|
|
|
new ZenMode();
|
|
|
|
break;
|
|
|
|
case 'projects:compare:show':
|
2016-10-25 19:25:46 +00:00
|
|
|
new gl.Diff();
|
2016-07-24 20:45:11 +00:00
|
|
|
break;
|
2016-10-09 14:17:14 +00:00
|
|
|
case 'projects:branches:index':
|
|
|
|
gl.AjaxLoadingSpinner.init();
|
|
|
|
break;
|
2016-07-24 20:45:11 +00:00
|
|
|
case 'projects:issues:new':
|
|
|
|
case 'projects:issues:edit':
|
|
|
|
shortcut_handler = new ShortcutsNavigation();
|
2017-01-03 12:04:33 +00:00
|
|
|
new gl.GLForm($('.issue-form'));
|
2016-07-24 20:45:11 +00:00
|
|
|
new IssuableForm($('.issue-form'));
|
2016-08-30 10:21:29 +00:00
|
|
|
new LabelsSelect();
|
|
|
|
new MilestoneSelect();
|
2016-10-05 10:48:18 +00:00
|
|
|
new gl.IssuableTemplateSelectors();
|
2016-07-24 20:45:11 +00:00
|
|
|
break;
|
|
|
|
case 'projects:merge_requests:new':
|
2017-02-14 18:39:11 +00:00
|
|
|
case 'projects:merge_requests:new_diffs':
|
2016-07-24 20:45:11 +00:00
|
|
|
case 'projects:merge_requests:edit':
|
2016-10-25 19:25:46 +00:00
|
|
|
new gl.Diff();
|
2016-07-24 20:45:11 +00:00
|
|
|
shortcut_handler = new ShortcutsNavigation();
|
2017-01-03 12:04:33 +00:00
|
|
|
new gl.GLForm($('.merge-request-form'));
|
2016-07-24 20:45:11 +00:00
|
|
|
new IssuableForm($('.merge-request-form'));
|
2016-08-30 10:21:29 +00:00
|
|
|
new LabelsSelect();
|
|
|
|
new MilestoneSelect();
|
2016-10-05 10:48:18 +00:00
|
|
|
new gl.IssuableTemplateSelectors();
|
2016-07-24 20:45:11 +00:00
|
|
|
break;
|
|
|
|
case 'projects:tags:new':
|
|
|
|
new ZenMode();
|
2017-01-03 12:04:33 +00:00
|
|
|
new gl.GLForm($('.tag-form'));
|
2016-07-24 20:45:11 +00:00
|
|
|
break;
|
|
|
|
case 'projects:releases:edit':
|
|
|
|
new ZenMode();
|
2017-01-03 12:04:33 +00:00
|
|
|
new gl.GLForm($('.release-form'));
|
2016-07-24 20:45:11 +00:00
|
|
|
break;
|
|
|
|
case 'projects:merge_requests:show':
|
2016-10-25 19:25:46 +00:00
|
|
|
new gl.Diff();
|
2016-07-24 20:45:11 +00:00
|
|
|
shortcut_handler = new ShortcutsIssuable(true);
|
|
|
|
new ZenMode();
|
|
|
|
new MergedButtons();
|
|
|
|
break;
|
|
|
|
case 'projects:merge_requests:commits':
|
|
|
|
new MergedButtons();
|
|
|
|
break;
|
|
|
|
case "projects:merge_requests:diffs":
|
2016-10-25 19:25:46 +00:00
|
|
|
new gl.Diff();
|
2016-07-24 20:45:11 +00:00
|
|
|
new ZenMode();
|
|
|
|
new MergedButtons();
|
|
|
|
break;
|
|
|
|
case 'dashboard:activity':
|
2016-11-20 05:52:53 +00:00
|
|
|
new gl.Activities();
|
2016-07-24 20:45:11 +00:00
|
|
|
break;
|
|
|
|
case 'projects:commit:show':
|
|
|
|
new Commit();
|
2016-10-25 19:25:46 +00:00
|
|
|
new gl.Diff();
|
2016-07-24 20:45:11 +00:00
|
|
|
new ZenMode();
|
|
|
|
shortcut_handler = new ShortcutsNavigation();
|
2017-03-16 00:44:31 +00:00
|
|
|
new MiniPipelineGraph({
|
|
|
|
container: '.js-commit-pipeline-graph',
|
|
|
|
}).bindEvents();
|
2016-07-24 20:45:11 +00:00
|
|
|
break;
|
2017-01-14 15:27:50 +00:00
|
|
|
case 'projects:commit:pipelines':
|
2017-03-09 18:26:15 +00:00
|
|
|
new MiniPipelineGraph({
|
2017-03-16 00:44:31 +00:00
|
|
|
container: '.js-commit-pipeline-graph',
|
2017-01-14 15:27:50 +00:00
|
|
|
}).bindEvents();
|
|
|
|
break;
|
2016-07-24 20:45:11 +00:00
|
|
|
case 'projects:commits:show':
|
|
|
|
case 'projects:activity':
|
|
|
|
shortcut_handler = new ShortcutsNavigation();
|
|
|
|
break;
|
|
|
|
case 'projects:show':
|
|
|
|
shortcut_handler = new ShortcutsNavigation();
|
|
|
|
new NotificationsForm();
|
|
|
|
if ($('#tree-slider').length) {
|
|
|
|
new TreeView();
|
|
|
|
}
|
|
|
|
break;
|
2016-12-21 11:21:11 +00:00
|
|
|
case 'projects:pipelines:builds':
|
2016-09-29 21:24:37 +00:00
|
|
|
case 'projects:pipelines:show':
|
2016-11-29 10:35:53 +00:00
|
|
|
const { controllerAction } = document.querySelector('.js-pipeline-container').dataset;
|
2016-11-24 16:43:54 +00:00
|
|
|
|
|
|
|
new gl.Pipelines({
|
|
|
|
initTabs: true,
|
|
|
|
tabsOptions: {
|
|
|
|
action: controllerAction,
|
|
|
|
defaultAction: 'pipelines',
|
|
|
|
parentEl: '.pipelines-tabs',
|
|
|
|
},
|
|
|
|
});
|
2016-09-29 21:24:37 +00:00
|
|
|
break;
|
2016-07-24 20:45:11 +00:00
|
|
|
case 'groups:activity':
|
2016-11-20 05:52:53 +00:00
|
|
|
new gl.Activities();
|
2016-07-24 20:45:11 +00:00
|
|
|
break;
|
|
|
|
case 'groups:show':
|
|
|
|
shortcut_handler = new ShortcutsNavigation();
|
|
|
|
new NotificationsForm();
|
|
|
|
new NotificationsDropdown();
|
2017-03-03 10:13:03 +00:00
|
|
|
new ProjectsList();
|
2016-07-24 20:45:11 +00:00
|
|
|
break;
|
|
|
|
case 'groups:group_members:index':
|
2016-08-19 00:02:36 +00:00
|
|
|
new gl.MemberExpirationDate();
|
2016-09-02 13:19:11 +00:00
|
|
|
new gl.Members();
|
2016-07-24 20:45:11 +00:00
|
|
|
new UsersSelect();
|
|
|
|
break;
|
2016-12-22 22:38:27 +00:00
|
|
|
case 'projects:members:show':
|
2016-12-23 22:29:00 +00:00
|
|
|
new gl.MemberExpirationDate('.js-access-expiration-date-groups');
|
|
|
|
new GroupsSelect();
|
2016-08-19 00:02:36 +00:00
|
|
|
new gl.MemberExpirationDate();
|
2016-09-02 13:19:11 +00:00
|
|
|
new gl.Members();
|
2016-07-24 20:45:11 +00:00
|
|
|
new UsersSelect();
|
|
|
|
break;
|
|
|
|
case 'groups:new':
|
2017-02-28 16:32:30 +00:00
|
|
|
case 'admin:groups:new':
|
2017-03-02 12:55:22 +00:00
|
|
|
case 'groups:create':
|
|
|
|
case 'admin:groups:create':
|
2017-03-03 08:01:54 +00:00
|
|
|
BindInOut.initAll();
|
2017-02-28 16:32:30 +00:00
|
|
|
case 'groups:new':
|
|
|
|
case 'admin:groups:new':
|
2016-07-24 20:45:11 +00:00
|
|
|
case 'groups:edit':
|
|
|
|
case 'admin:groups:edit':
|
|
|
|
new GroupAvatar();
|
|
|
|
break;
|
|
|
|
case 'projects:tree:show':
|
|
|
|
shortcut_handler = new ShortcutsNavigation();
|
|
|
|
new TreeView();
|
2016-12-22 06:21:40 +00:00
|
|
|
gl.TargetBranchDropDown.bootstrap();
|
2016-07-24 20:45:11 +00:00
|
|
|
break;
|
|
|
|
case 'projects:find_file:show':
|
|
|
|
shortcut_handler = true;
|
|
|
|
break;
|
2016-12-22 06:21:40 +00:00
|
|
|
case 'projects:blob:new':
|
|
|
|
gl.TargetBranchDropDown.bootstrap();
|
|
|
|
break;
|
|
|
|
case 'projects:blob:create':
|
|
|
|
gl.TargetBranchDropDown.bootstrap();
|
|
|
|
break;
|
2016-07-24 20:45:11 +00:00
|
|
|
case 'projects:blob:show':
|
2016-12-22 06:21:40 +00:00
|
|
|
gl.TargetBranchDropDown.bootstrap();
|
2017-03-13 22:46:21 +00:00
|
|
|
initBlob();
|
2016-12-22 06:21:40 +00:00
|
|
|
break;
|
|
|
|
case 'projects:blob:edit':
|
|
|
|
gl.TargetBranchDropDown.bootstrap();
|
|
|
|
break;
|
2016-07-24 20:45:11 +00:00
|
|
|
case 'projects:blame:show':
|
2017-03-13 22:46:21 +00:00
|
|
|
initBlob();
|
2016-07-24 20:45:11 +00:00
|
|
|
break;
|
2016-09-19 19:49:08 +00:00
|
|
|
case 'groups:labels:new':
|
|
|
|
case 'groups:labels:edit':
|
2016-07-24 20:45:11 +00:00
|
|
|
case 'projects:labels:new':
|
|
|
|
case 'projects:labels:edit':
|
|
|
|
new Labels();
|
|
|
|
break;
|
|
|
|
case 'projects:labels:index':
|
|
|
|
if ($('.prioritized-labels').length) {
|
2016-09-12 17:05:47 +00:00
|
|
|
new gl.LabelManager();
|
2016-07-24 20:45:11 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'projects:network:show':
|
2016-07-27 03:32:10 +00:00
|
|
|
// Ensure we don't create a particular shortcut handler here. This is
|
|
|
|
// already created, where the network graph is created.
|
2016-07-24 20:45:11 +00:00
|
|
|
shortcut_handler = true;
|
|
|
|
break;
|
|
|
|
case 'projects:forks:new':
|
|
|
|
new ProjectFork();
|
|
|
|
break;
|
|
|
|
case 'projects:artifacts:browse':
|
|
|
|
new BuildArtifacts();
|
|
|
|
break;
|
2017-01-19 14:29:11 +00:00
|
|
|
case 'help:index':
|
|
|
|
gl.VersionCheckImage.bindErrorEvent($('img.js-version-status-badge'));
|
|
|
|
break;
|
2016-07-24 20:45:11 +00:00
|
|
|
case 'search:show':
|
|
|
|
new Search();
|
2016-07-29 07:01:15 +00:00
|
|
|
break;
|
2017-01-30 19:21:02 +00:00
|
|
|
case 'projects:repository:show':
|
2016-08-05 06:57:53 +00:00
|
|
|
new gl.ProtectedBranchCreate();
|
|
|
|
new gl.ProtectedBranchEditList();
|
2016-07-29 07:01:15 +00:00
|
|
|
break;
|
2017-01-24 00:51:16 +00:00
|
|
|
case 'projects:ci_cd:show':
|
2016-11-24 08:21:48 +00:00
|
|
|
new gl.ProjectVariables();
|
|
|
|
break;
|
2017-01-04 21:44:16 +00:00
|
|
|
case 'ci:lints:create':
|
|
|
|
case 'ci:lints:show':
|
|
|
|
new gl.CILintEditor();
|
|
|
|
break;
|
2017-02-17 17:28:52 +00:00
|
|
|
case 'users:show':
|
|
|
|
new UserCallout();
|
|
|
|
break;
|
2016-07-24 20:45:11 +00:00
|
|
|
}
|
|
|
|
switch (path.first()) {
|
2017-01-24 00:06:17 +00:00
|
|
|
case 'sessions':
|
|
|
|
case 'omniauth_callbacks':
|
|
|
|
if (!gon.u2f) break;
|
|
|
|
gl.u2fAuthenticate = new gl.U2FAuthenticate(
|
|
|
|
$('#js-authenticate-u2f'),
|
|
|
|
'#js-login-u2f-form',
|
|
|
|
gon.u2f,
|
|
|
|
document.querySelector('#js-login-2fa-device'),
|
|
|
|
document.querySelector('.js-2fa-form'),
|
|
|
|
);
|
|
|
|
gl.u2fAuthenticate.start();
|
2016-07-24 20:45:11 +00:00
|
|
|
case 'admin':
|
|
|
|
new Admin();
|
|
|
|
switch (path[1]) {
|
|
|
|
case 'groups':
|
|
|
|
new UsersSelect();
|
|
|
|
break;
|
|
|
|
case 'projects':
|
|
|
|
new NamespaceSelects();
|
2016-07-26 22:59:55 +00:00
|
|
|
break;
|
|
|
|
case 'labels':
|
2016-07-27 08:24:11 +00:00
|
|
|
switch (path[2]) {
|
2016-08-31 22:54:06 +00:00
|
|
|
case 'new':
|
2016-07-27 08:24:11 +00:00
|
|
|
case 'edit':
|
|
|
|
new Labels();
|
|
|
|
}
|
2016-07-01 02:18:52 +00:00
|
|
|
case 'abuse_reports':
|
2016-08-08 13:04:18 +00:00
|
|
|
new gl.AbuseReports();
|
2016-07-01 02:18:52 +00:00
|
|
|
break;
|
2016-07-24 20:45:11 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'dashboard':
|
|
|
|
case 'root':
|
|
|
|
shortcut_handler = new ShortcutsDashboardNavigation();
|
2017-02-17 17:28:52 +00:00
|
|
|
new UserCallout();
|
2016-07-24 20:45:11 +00:00
|
|
|
break;
|
2017-03-01 02:59:55 +00:00
|
|
|
case 'groups':
|
|
|
|
new GroupName();
|
|
|
|
break;
|
2016-07-24 20:45:11 +00:00
|
|
|
case 'profiles':
|
|
|
|
new NotificationsForm();
|
|
|
|
new NotificationsDropdown();
|
|
|
|
break;
|
|
|
|
case 'projects':
|
|
|
|
new Project();
|
|
|
|
new ProjectAvatar();
|
2017-03-01 02:59:55 +00:00
|
|
|
new GroupName();
|
2016-07-24 20:45:11 +00:00
|
|
|
switch (path[1]) {
|
|
|
|
case 'compare':
|
|
|
|
new CompareAutocomplete();
|
|
|
|
break;
|
|
|
|
case 'edit':
|
|
|
|
shortcut_handler = new ShortcutsNavigation();
|
|
|
|
new ProjectNew();
|
|
|
|
break;
|
|
|
|
case 'new':
|
|
|
|
new ProjectNew();
|
|
|
|
break;
|
|
|
|
case 'show':
|
2016-07-26 22:59:55 +00:00
|
|
|
new Star();
|
2016-07-24 20:45:11 +00:00
|
|
|
new ProjectNew();
|
|
|
|
new ProjectShow();
|
|
|
|
new NotificationsDropdown();
|
|
|
|
break;
|
|
|
|
case 'wikis':
|
2016-11-14 21:33:21 +00:00
|
|
|
new gl.Wikis();
|
2016-07-24 20:45:11 +00:00
|
|
|
shortcut_handler = new ShortcutsNavigation();
|
|
|
|
new ZenMode();
|
2017-01-03 12:04:33 +00:00
|
|
|
new gl.GLForm($('.wiki-form'));
|
2016-07-24 20:45:11 +00:00
|
|
|
break;
|
|
|
|
case 'snippets':
|
|
|
|
shortcut_handler = new ShortcutsNavigation();
|
|
|
|
if (path[2] === 'show') {
|
|
|
|
new ZenMode();
|
|
|
|
}
|
|
|
|
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();
|
|
|
|
}
|
|
|
|
}
|
2016-07-27 03:32:10 +00:00
|
|
|
// If we haven't installed a custom shortcut handler, install the default one
|
2016-07-24 20:45:11 +00:00
|
|
|
if (!shortcut_handler) {
|
2017-01-24 00:06:17 +00:00
|
|
|
new Shortcuts();
|
2016-07-24 20:45:11 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
Dispatcher.prototype.initSearch = function() {
|
2016-07-27 03:32:10 +00:00
|
|
|
// Only when search form is present
|
2016-07-24 20:45:11 +00:00
|
|
|
if ($('.search').length) {
|
2016-09-08 13:59:33 +00:00
|
|
|
return new gl.SearchAutocomplete();
|
2016-07-24 20:45:11 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2016-09-09 12:21:00 +00:00
|
|
|
Dispatcher.prototype.initFieldErrors = function() {
|
2016-11-02 10:35:21 +00:00
|
|
|
$('.gl-show-field-errors').each((i, form) => {
|
2016-10-12 16:47:31 +00:00
|
|
|
new gl.GlFieldErrors(form);
|
|
|
|
});
|
2016-09-09 12:21:00 +00:00
|
|
|
};
|
|
|
|
|
2016-07-24 20:45:11 +00:00
|
|
|
return Dispatcher;
|
|
|
|
})();
|
2017-02-10 06:50:50 +00:00
|
|
|
}).call(window);
|