Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
cda5e66d
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,发现更多精彩内容 >>
提交
cda5e66d
编写于
10月 03, 2012
作者:
R
Robert Speicher
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use History.js for better Tree browsing
Closes #1578
上级
679d0d6d
变更
5
展开全部
隐藏空白更改
内联
并排
Showing
5 changed file
with
26 addition
and
19 deletion
+26
-19
app/assets/javascripts/application.js
app/assets/javascripts/application.js
+1
-0
app/assets/javascripts/tree.js.coffee
app/assets/javascripts/tree.js.coffee
+21
-3
app/views/tree/_tree.html.haml
app/views/tree/_tree.html.haml
+2
-15
app/views/tree/_tree_item.html.haml
app/views/tree/_tree_item.html.haml
+1
-1
vendor/assets/javascripts/jquery.history.js
vendor/assets/javascripts/jquery.history.js
+1
-0
未找到文件。
app/assets/javascripts/application.js
浏览文件 @
cda5e66d
...
...
@@ -10,6 +10,7 @@
//= require jquery.cookie
//= require jquery.endless-scroll
//= require jquery.highlight
//= require jquery.history
//= require jquery.waitforimages
//= require jquery.atwho
//= require bootstrap
...
...
app/assets/javascripts/tree.js.coffee
浏览文件 @
cda5e66d
...
...
@@ -8,9 +8,6 @@ $ ->
$
(
'#tree-slider .tree-item-file-name a, .breadcrumb li > a'
).
live
"click"
,
->
$
(
"#tree-content-holder"
).
hide
(
"slide"
,
{
direction
:
"left"
},
150
)
$
(
'.project-refs-form'
).
live
"ajax:beforeSend"
:
->
$
(
"#tree-content-holder"
).
hide
(
"slide"
,
{
direction
:
"left"
},
150
)
# Make the entire tree-item row clickable, but not if clicking another link (like a commit message)
$
(
"#tree-slider .tree-item"
).
live
'click'
,
(
e
)
->
$
(
'.tree-item-file-name a'
,
this
).
trigger
(
'click'
)
if
(
e
.
target
.
nodeName
!=
"A"
)
...
...
@@ -19,3 +16,24 @@ $ ->
$
(
'#tree-slider .tree-item-file-name a, .breadcrumb a, .project-refs-form'
).
live
"ajax:beforeSend"
:
->
$
(
'.tree_progress'
).
addClass
(
"loading"
)
"ajax:complete"
:
->
$
(
'.tree_progress'
).
removeClass
(
"loading"
)
# Maintain forward/back history while browsing the file tree
((
window
)
->
History
=
window
.
History
$
=
window
.
jQuery
document
=
window
.
document
# Check to see if History.js is enabled for our Browser
unless
History
.
enabled
return
false
$
->
$
(
'#tree-slider .tree-item-file-name a, .breadcrumb li > a'
).
live
'click'
,
(
e
)
->
History
.
pushState
(
null
,
null
,
$
(
@
).
attr
(
'href'
))
return
false
History
.
Adapter
.
bind
window
,
'statechange'
,
->
state
=
History
.
getState
()
window
.
ajaxGet
(
state
.
url
)
)(
window
)
app/views/tree/_tree.html.haml
浏览文件 @
cda5e66d
%ul
.breadcrumb
%li
%span
.arrow
=
link_to
project_tree_path
(
@project
,
@ref
)
,
remote:
true
do
=
link_to
project_tree_path
(
@project
,
@ref
)
do
=
@project
.
name
-
tree
.
breadcrumbs
(
6
)
do
|
link
|
\/
...
...
@@ -26,7 +26,7 @@
%tr
.tree-item
%td
.tree-item-file-name
=
image_tag
"file_empty.png"
,
size:
'16x16'
=
link_to
".."
,
tree
.
up_dir_path
,
remote:
true
=
link_to
".."
,
tree
.
up_dir_path
%td
%td
...
...
@@ -44,22 +44,9 @@
-
else
=
raw
GitHub
::
Markup
.
render
(
content
.
name
,
content
.
data
)
:javascript
$
(
function
(){
history
.
pushState
({
path
:
this
.
path
},
''
,
"
#{
@history_path
}
"
);
});
-
unless
tree
.
is_blob?
:javascript
// Load last commit log for each file in tree
$
(
window
).
load
(
function
(){
ajaxGet
(
'
#{
@logs_path
}
'
);
});
-
if
@path
.
present?
&&
request
.
xhr?
:javascript
$
(
window
).
unbind
(
'
popstate
'
);
$
(
window
).
bind
(
'
popstate
'
,
function
()
{
if
(
location
.
pathname
.
search
(
"
tree
"
)
!=
-
1
)
{
$
.
ajax
({
type
:
"
GET
"
,
url
:
location
.
pathname
,
dataType
:
"
script
"
})}
else
{
location
.
href
=
location
.
pathname
;}});
app/views/tree/_tree_item.html.haml
浏览文件 @
cda5e66d
%tr
{
class:
"tree-item #{tree_hex_class(tree_item)}"
}
%td
.tree-item-file-name
=
tree_icon
(
type
)
%strong
=
link_to
truncate
(
tree_item
.
name
,
length:
40
),
project_tree_path
(
@project
,
tree_join
(
@id
||
@commit
.
id
,
tree_item
.
name
))
,
remote:
true
%strong
=
link_to
truncate
(
tree_item
.
name
,
length:
40
),
project_tree_path
(
@project
,
tree_join
(
@id
||
@commit
.
id
,
tree_item
.
name
))
%td
.tree_time_ago.cgray
%span
.log_loading.hide
Loading commit data...
...
...
vendor/assets/javascripts/jquery.history.js
0 → 100644
浏览文件 @
cda5e66d
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录