Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
a95d8afd
Commit
a95d8afd
authored
Jan 12, 2018
by
Clement Ho
Committed by
Phil Hughes
Jan 12, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor dispatcher projects blame and blob path
parent
3fde958f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
52 additions
and
34 deletions
+52
-34
app/assets/javascripts/dispatcher.js
app/assets/javascripts/dispatcher.js
+9
-34
app/assets/javascripts/pages/projects/blame/show/index.js
app/assets/javascripts/pages/projects/blame/show/index.js
+3
-0
app/assets/javascripts/pages/projects/blob/show/index.js
app/assets/javascripts/pages/projects/blob/show/index.js
+7
-0
app/assets/javascripts/pages/projects/init_blob.js
app/assets/javascripts/pages/projects/init_blob.js
+33
-0
No files found.
app/assets/javascripts/dispatcher.js
View file @
a95d8afd
...
...
@@ -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
'
;
...
...
@@ -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
'
;
...
...
@@ -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
;
...
...
@@ -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
)
{
...
...
@@ -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
'
:
...
...
app/assets/javascripts/pages/projects/blame/show/index.js
0 → 100644
View file @
a95d8afd
import
initBlob
from
'
~/pages/projects/init_blob
'
;
export
default
initBlob
;
app/assets/javascripts/pages/projects/blob/show/index.js
0 → 100644
View file @
a95d8afd
import
BlobViewer
from
'
~/blob/viewer/index
'
;
import
initBlob
from
'
~/pages/projects/init_blob
'
;
export
default
()
=>
{
new
BlobViewer
();
// eslint-disable-line no-new
initBlob
();
};
app/assets/javascripts/pages/projects/init_blob.js
0 → 100644
View file @
a95d8afd
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
();
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment