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
Tatuya Kamada
gitlab-ce
Commits
586c53ea
Commit
586c53ea
authored
Nov 05, 2011
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed notes loading/paging
parent
0b0e0225
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
47 additions
and
15 deletions
+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
No files found.
app/assets/javascripts/note.js
View file @
586c53ea
...
@@ -31,6 +31,15 @@ append:
...
@@ -31,6 +31,15 @@ append:
this
.
initLoadMore
();
this
.
initLoadMore
();
},
},
replace
:
function
(
fid
,
lid
,
html
)
{
this
.
first_id
=
fid
;
this
.
last_id
=
lid
;
$
(
"
#notes-list
"
).
html
(
html
);
this
.
initLoadMore
();
},
prepend
:
prepend
:
function
(
id
,
html
)
{
function
(
id
,
html
)
{
this
.
last_id
=
id
;
this
.
last_id
=
id
;
...
@@ -47,10 +56,23 @@ getNew:
...
@@ -47,10 +56,23 @@ getNew:
dataType
:
"
script
"
});
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
:
initRefresh
:
function
()
{
function
()
{
// init timer
// init timer
var
int
=
setInterval
(
"
NoteList.getNew()
"
,
20000
);
var
intNew
=
setInterval
(
"
NoteList.getNew()
"
,
15000
);
var
intRefresh
=
setInterval
(
"
NoteList.refresh()
"
,
90000
);
},
},
initLoadMore
:
initLoadMore
:
...
...
app/controllers/application_controller.rb
View file @
586c53ea
...
@@ -83,4 +83,16 @@ class ApplicationController < ActionController::Base
...
@@ -83,4 +83,16 @@ class ApplicationController < ActionController::Base
cookies
[
:view_style
]
=
""
cookies
[
:view_style
]
=
""
end
end
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
end
app/controllers/commits_controller.rb
View file @
586c53ea
...
@@ -33,10 +33,7 @@ class CommitsController < ApplicationController
...
@@ -33,10 +33,7 @@ class CommitsController < ApplicationController
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
format
.
html
format
.
js
do
format
.
js
{
respond_with_notes
}
@notes
=
@notes
.
where
(
"id > ?"
,
params
[
:last_id
])
if
params
[
:last_id
]
@notes
=
@notes
.
where
(
"id < ?"
,
params
[
:first_id
])
if
params
[
:first_id
]
end
end
end
end
end
end
end
app/controllers/issues_controller.rb
View file @
586c53ea
...
@@ -40,10 +40,7 @@ class IssuesController < ApplicationController
...
@@ -40,10 +40,7 @@ class IssuesController < ApplicationController
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
format
.
html
format
.
js
do
format
.
js
{
respond_with_notes
}
@notes
=
@notes
.
where
(
"id > ?"
,
params
[
:last_id
])
if
params
[
:last_id
]
@notes
=
@notes
.
where
(
"id < ?"
,
params
[
:first_id
])
if
params
[
:first_id
]
end
end
end
end
end
...
...
app/controllers/projects_controller.rb
View file @
586c53ea
...
@@ -90,10 +90,7 @@ class ProjectsController < ApplicationController
...
@@ -90,10 +90,7 @@ class ProjectsController < ApplicationController
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
format
.
html
format
.
js
do
format
.
js
{
respond_with_notes
}
@notes
=
@notes
.
where
(
"id > ?"
,
params
[
:last_id
])
if
params
[
:last_id
]
@notes
=
@notes
.
where
(
"id < ?"
,
params
[
:first_id
])
if
params
[
:first_id
]
end
end
end
end
end
...
...
app/views/notes/_load.js.haml
View file @
586c53ea
-
unless
@notes
.
blank?
-
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
:plain
NoteList.prepend(
#{
@notes
.
first
.
id
}
, "
#{
escape_javascript
(
render
(
:partial
=>
'notes/notes_list'
))
}
");
NoteList.prepend(
#{
@notes
.
first
.
id
}
, "
#{
escape_javascript
(
render
(
:partial
=>
'notes/notes_list'
))
}
");
-
if
params
[
:first_id
]
-
els
if
params
[
:first_id
]
:plain
:plain
NoteList.append(
#{
@notes
.
last
.
id
}
, "
#{
escape_javascript
(
render
(
:partial
=>
'notes/notes_list'
))
}
");
NoteList.append(
#{
@notes
.
last
.
id
}
, "
#{
escape_javascript
(
render
(
:partial
=>
'notes/notes_list'
))
}
");
-
else
:plain
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