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
iv
gitlab-ce
Commits
7ec5ff4d
Commit
7ec5ff4d
authored
Apr 28, 2014
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pass last_fetched_at for notes to javascript
parent
bbfa4a77
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
3 deletions
+7
-3
app/assets/javascripts/notes.js.coffee
app/assets/javascripts/notes.js.coffee
+4
-1
app/controllers/projects/notes_controller.rb
app/controllers/projects/notes_controller.rb
+2
-1
app/views/projects/notes/_notes_with_form.html.haml
app/views/projects/notes/_notes_with_form.html.haml
+1
-1
No files found.
app/assets/javascripts/notes.js.coffee
View file @
7ec5ff4d
class
Notes
@
interval
:
null
constructor
:
(
notes_url
,
note_ids
)
->
constructor
:
(
notes_url
,
note_ids
,
last_fetched_at
)
->
@
notes_url
=
notes_url
@
notes_url
=
gon
.
relative_url_root
+
@
notes_url
if
gon
.
relative_url_root
?
@
note_ids
=
note_ids
@
last_fetched_at
=
last_fetched_at
@
initRefresh
()
@
setupMainTargetNoteForm
()
@
cleanBinding
()
...
...
@@ -76,9 +77,11 @@ class Notes
getContent
:
->
$
.
ajax
url
:
@
notes_url
data
:
"last_fetched_at="
+
@
last_fetched_at
dataType
:
"json"
success
:
(
data
)
=>
notes
=
data
.
notes
@
last_fetched_at
=
data
.
last_fetched_at
$
.
each
notes
,
(
i
,
note
)
=>
@
renderNote
(
note
)
...
...
app/controllers/projects/notes_controller.rb
View file @
7ec5ff4d
...
...
@@ -5,9 +5,10 @@ class Projects::NotesController < Projects::ApplicationController
before_filter
:authorize_admin_note!
,
only:
[
:update
,
:destroy
]
def
index
current_fetched_at
=
Time
.
now
@notes
=
NotesFinder
.
new
.
execute
(
project
,
current_user
,
params
)
notes_json
=
{
notes:
[]
}
notes_json
=
{
notes:
[]
,
last_fetched_at:
current_fetched_at
}
@notes
.
each
do
|
note
|
notes_json
[
:notes
]
<<
{
...
...
app/views/projects/notes/_notes_with_form.html.haml
View file @
7ec5ff4d
...
...
@@ -7,4 +7,4 @@
=
render
"projects/notes/form"
:javascript
new
Notes
(
"
#{
project_notes_path
(
target_id:
@noteable
.
id
,
target_type:
@noteable
.
class
.
name
.
underscore
)
}
"
,
#{
@notes
.
map
(
&
:id
).
to_json
}
)
new
Notes
(
"
#{
project_notes_path
(
target_id:
@noteable
.
id
,
target_type:
@noteable
.
class
.
name
.
underscore
)
}
"
,
#{
@notes
.
map
(
&
:id
).
to_json
}
,
Time
.
now
)
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