Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
586c53ea
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,发现更多精彩内容 >>
提交
586c53ea
编写于
11月 05, 2011
作者:
D
Dmitriy Zaporozhets
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fixed notes loading/paging
上级
0b0e0225
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
47 addition
and
15 deletion
+47
-15
app/assets/javascripts/note.js
app/assets/javascripts/note.js
+23
-1
app/controllers/application_controller.rb
app/controllers/application_controller.rb
+12
-0
app/controllers/commits_controller.rb
app/controllers/commits_controller.rb
+1
-4
app/controllers/issues_controller.rb
app/controllers/issues_controller.rb
+1
-4
app/controllers/projects_controller.rb
app/controllers/projects_controller.rb
+1
-4
app/views/notes/_load.js.haml
app/views/notes/_load.js.haml
+9
-2
未找到文件。
app/assets/javascripts/note.js
浏览文件 @
586c53ea
...
...
@@ -31,6 +31,15 @@ append:
this
.
initLoadMore
();
},
replace
:
function
(
fid
,
lid
,
html
)
{
this
.
first_id
=
fid
;
this
.
last_id
=
lid
;
$
(
"
#notes-list
"
).
html
(
html
);
this
.
initLoadMore
();
},
prepend
:
function
(
id
,
html
)
{
this
.
last_id
=
id
;
...
...
@@ -47,10 +56,23 @@ getNew:
dataType
:
"
script
"
});
},
refresh
:
function
()
{
// refersh notes list
$
.
ajax
({
type
:
"
GET
"
,
url
:
location
.
href
,
data
:
"
first_id=
"
+
this
.
first_id
+
"
&last_id=
"
+
this
.
last_id
,
dataType
:
"
script
"
});
},
initRefresh
:
function
()
{
// init timer
var
int
=
setInterval
(
"
NoteList.getNew()
"
,
20000
);
var
intNew
=
setInterval
(
"
NoteList.getNew()
"
,
15000
);
var
intRefresh
=
setInterval
(
"
NoteList.refresh()
"
,
90000
);
},
initLoadMore
:
...
...
app/controllers/application_controller.rb
浏览文件 @
586c53ea
...
...
@@ -83,4 +83,16 @@ class ApplicationController < ActionController::Base
cookies
[
:view_style
]
=
""
end
end
def
respond_with_notes
if
params
[
:last_id
]
&&
params
[
:first_id
]
@notes
=
@notes
.
where
(
"id >= ?"
,
params
[
:first_id
])
elsif
params
[
:last_id
]
@notes
=
@notes
.
where
(
"id > ?"
,
params
[
:last_id
])
elsif
params
[
:first_id
]
@notes
=
@notes
.
where
(
"id < ?"
,
params
[
:first_id
])
else
nil
end
end
end
app/controllers/commits_controller.rb
浏览文件 @
586c53ea
...
...
@@ -33,10 +33,7 @@ class CommitsController < ApplicationController
respond_to
do
|
format
|
format
.
html
format
.
js
do
@notes
=
@notes
.
where
(
"id > ?"
,
params
[
:last_id
])
if
params
[
:last_id
]
@notes
=
@notes
.
where
(
"id < ?"
,
params
[
:first_id
])
if
params
[
:first_id
]
end
format
.
js
{
respond_with_notes
}
end
end
end
app/controllers/issues_controller.rb
浏览文件 @
586c53ea
...
...
@@ -40,10 +40,7 @@ class IssuesController < ApplicationController
respond_to
do
|
format
|
format
.
html
format
.
js
do
@notes
=
@notes
.
where
(
"id > ?"
,
params
[
:last_id
])
if
params
[
:last_id
]
@notes
=
@notes
.
where
(
"id < ?"
,
params
[
:first_id
])
if
params
[
:first_id
]
end
format
.
js
{
respond_with_notes
}
end
end
...
...
app/controllers/projects_controller.rb
浏览文件 @
586c53ea
...
...
@@ -90,10 +90,7 @@ class ProjectsController < ApplicationController
respond_to
do
|
format
|
format
.
html
format
.
js
do
@notes
=
@notes
.
where
(
"id > ?"
,
params
[
:last_id
])
if
params
[
:last_id
]
@notes
=
@notes
.
where
(
"id < ?"
,
params
[
:first_id
])
if
params
[
:first_id
]
end
format
.
js
{
respond_with_notes
}
end
end
...
...
app/views/notes/_load.js.haml
浏览文件 @
586c53ea
-
unless
@notes
.
blank?
-
if
params
[
:last_id
]
-
if
params
[
:last_id
]
&&
params
[
:first_id
]
:plain
NoteList.replace(
#{
@notes
.
last
.
id
}
,
#{
@notes
.
first
.
id
}
, "
#{
escape_javascript
(
render
(
:partial
=>
'notes/notes_list'
))
}
");
-
elsif
params
[
:last_id
]
:plain
NoteList.prepend(
#{
@notes
.
first
.
id
}
, "
#{
escape_javascript
(
render
(
:partial
=>
'notes/notes_list'
))
}
");
-
if
params
[
:first_id
]
-
els
if
params
[
:first_id
]
:plain
NoteList.append(
#{
@notes
.
last
.
id
}
, "
#{
escape_javascript
(
render
(
:partial
=>
'notes/notes_list'
))
}
");
-
else
:plain
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录