Commit e10810de authored by Eric Eastwood's avatar Eric Eastwood

Fix missing blob line permalink updater on blob:show

See
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/9461#note_25288831
parent 302d0453
...@@ -67,6 +67,25 @@ const UserCallout = require('./user_callout'); ...@@ -67,6 +67,25 @@ const UserCallout = require('./user_callout');
} }
path = page.split(':'); path = page.split(':');
shortcut_handler = null; shortcut_handler = null;
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,
});
}
switch (page) { switch (page) {
case 'sessions:new': case 'sessions:new':
new UsernameValidator(); new UsernameValidator();
...@@ -259,34 +278,13 @@ const UserCallout = require('./user_callout'); ...@@ -259,34 +278,13 @@ const UserCallout = require('./user_callout');
break; break;
case 'projects:blob:show': case 'projects:blob:show':
gl.TargetBranchDropDown.bootstrap(); gl.TargetBranchDropDown.bootstrap();
new LineHighlighter(); initBlob();
shortcut_handler = new ShortcutsNavigation();
fileBlobPermalinkUrlElement = document.querySelector('.js-data-file-blob-permalink-url');
fileBlobPermalinkUrl = fileBlobPermalinkUrlElement && fileBlobPermalinkUrlElement.getAttribute('href');
new ShortcutsBlob({
skipResetBindings: true,
fileBlobPermalinkUrl,
});
break; break;
case 'projects:blob:edit': case 'projects:blob:edit':
gl.TargetBranchDropDown.bootstrap(); gl.TargetBranchDropDown.bootstrap();
break; break;
case 'projects:blame:show': case 'projects:blame:show':
new LineHighlighter(); initBlob();
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,
});
break; break;
case 'groups:labels:new': case 'groups:labels:new':
case 'groups:labels:edit': case 'groups:labels:edit':
......
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