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
4d378f3c
Commit
4d378f3c
authored
Mar 19, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
load notes for wall via api
parent
57f3409b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
0 deletions
+50
-0
app/assets/javascripts/wall.js.coffee
app/assets/javascripts/wall.js.coffee
+46
-0
lib/api/notes.rb
lib/api/notes.rb
+4
-0
No files found.
app/assets/javascripts/wall.js.coffee
0 → 100644
View file @
4d378f3c
@
Wall
=
note_ids
:
[]
notes_path
:
null
notes_params
:
null
project_id
:
null
init
:
(
project_id
)
->
Wall
.
project_id
=
project_id
Wall
.
notes_path
=
"/api/"
+
gon
.
api_version
+
"/projects/"
+
project_id
+
"/notes.json"
Wall
.
getContent
()
Wall
.
initRefresh
()
#
# Gets an initial set of notes.
#
getContent
:
->
$
.
ajax
url
:
Wall
.
notes_path
,
data
:
private_token
:
gon
.
api_token
gfm
:
true
recent
:
true
dataType
:
"json"
success
:
(
notes
)
->
notes
.
sort
(
a
,
b
)
->
return
a
.
id
-
b
.
id
$
.
each
notes
,
(
i
,
note
)
->
if
$
.
inArray
(
note
.
id
,
Wall
.
note_ids
)
==
-
1
Wall
.
note_ids
.
push
(
note
.
id
)
Wall
.
renderNote
(
note
)
complete
:
->
$
(
'.js-notes-busy'
).
removeClass
(
"loading"
)
beforeSend
:
->
$
(
'.js-notes-busy'
).
addClass
(
"loading"
)
renderNote
:
(
note
)
->
author
=
'<strong>'
+
note
.
author
.
name
+
': </strong>'
html
=
'<li>'
+
author
+
note
.
body
+
'</li>'
$
(
'ul.notes'
).
append
(
html
)
initRefresh
:
->
setInterval
(
"Wall.refresh()"
,
10000
)
refresh
:
->
Wall
.
getContent
()
lib/api/notes.rb
View file @
4d378f3c
...
...
@@ -14,6 +14,10 @@ module Gitlab
# GET /projects/:id/notes
get
":id/notes"
do
@notes
=
user_project
.
notes
.
common
# Get recent notes if recent = true
@notes
=
@notes
.
order
(
'id DESC'
)
if
params
[
:recent
]
present
paginate
(
@notes
),
with:
Entities
::
Note
end
...
...
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