Skip to content
Snippets Groups Projects
Commit a95d8afd authored by Clement Ho's avatar Clement Ho Committed by Phil Hughes
Browse files

Refactor dispatcher projects blame and blob path

parent 3fde958f
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -35,8 +35,6 @@ import Group from './group';
import ProjectsList from './projects_list';
import setupProjectEdit from './project_edit';
import MiniPipelineGraph from './mini_pipeline_graph_dropdown';
import BlobLinePermalinkUpdater from './blob/blob_line_permalink_updater';
import BlobForkSuggestion from './blob/blob_fork_suggestion';
import UserCallout from './user_callout';
import ShortcutsWiki from './shortcuts_wiki';
import BlobViewer from './blob/viewer/index';
Loading
Loading
@@ -44,7 +42,6 @@ import AutoWidthDropdownSelect from './issuable/auto_width_dropdown_select';
import UsersSelect from './users_select';
import RefSelectDropdown from './ref_select_dropdown';
import GfmAutoComplete from './gfm_auto_complete';
import ShortcutsBlob from './shortcuts_blob';
import Star from './star';
import TreeView from './tree';
import Wikis from './wikis';
Loading
Loading
@@ -85,7 +82,7 @@ import Activities from './activities';
}
 
Dispatcher.prototype.initPageScripts = function() {
var path, shortcut_handler, fileBlobPermalinkUrlElement, fileBlobPermalinkUrl;
var path, shortcut_handler;
const page = $('body').attr('data-page');
if (!page) {
return false;
Loading
Loading
@@ -110,33 +107,6 @@ import Activities from './activities';
});
});
 
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,
});
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'),
})
.init();
}
const filteredSearchEnabled = gl.FilteredSearchManager && document.querySelector('.filtered-search');
 
switch (page) {
Loading
Loading
@@ -460,11 +430,16 @@ import Activities from './activities';
shortcut_handler = true;
break;
case 'projects:blob:show':
new BlobViewer();
initBlob();
import('./pages/projects/blob/show')
.then(callDefault)
.catch(fail);
shortcut_handler = true;
break;
case 'projects:blame:show':
initBlob();
import('./pages/projects/blame/show')
.then(callDefault)
.catch(fail);
shortcut_handler = true;
break;
case 'groups:labels:new':
case 'groups:labels:edit':
Loading
Loading
import initBlob from '~/pages/projects/init_blob';
export default initBlob;
import BlobViewer from '~/blob/viewer/index';
import initBlob from '~/pages/projects/init_blob';
export default () => {
new BlobViewer(); // eslint-disable-line no-new
initBlob();
};
import LineHighlighter from '~/line_highlighter';
import BlobLinePermalinkUpdater from '~/blob/blob_line_permalink_updater';
import ShortcutsNavigation from '~/shortcuts_navigation';
import ShortcutsBlob from '~/shortcuts_blob';
import BlobForkSuggestion from '~/blob/blob_fork_suggestion';
export default () => {
new LineHighlighter(); // eslint-disable-line no-new
new BlobLinePermalinkUpdater( // eslint-disable-line no-new
document.querySelector('#blob-content-holder'),
'.diff-line-num[data-line-number]',
document.querySelectorAll('.js-data-file-blob-permalink-url, .js-blob-blame-link'),
);
const fileBlobPermalinkUrlElement = document.querySelector('.js-data-file-blob-permalink-url');
const fileBlobPermalinkUrl = fileBlobPermalinkUrlElement && fileBlobPermalinkUrlElement.getAttribute('href');
new ShortcutsNavigation(); // eslint-disable-line no-new
new ShortcutsBlob({ // eslint-disable-line no-new
skipResetBindings: true,
fileBlobPermalinkUrl,
});
new BlobForkSuggestion({ // eslint-disable-line no-new
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'),
}).init();
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment