Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
a95d8afd
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a95d8afd
编写于
1月 12, 2018
作者:
C
Clement Ho
提交者:
Phil Hughes
1月 12, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Refactor dispatcher projects blame and blob path
上级
3fde958f
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
52 addition
and
34 deletion
+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
未找到文件。
app/assets/javascripts/dispatcher.js
浏览文件 @
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
浏览文件 @
a95d8afd
import
initBlob
from
'
~/pages/projects/init_blob
'
;
export
default
initBlob
;
app/assets/javascripts/pages/projects/blob/show/index.js
0 → 100644
浏览文件 @
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
浏览文件 @
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
();
};
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录