Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRiyad Preukschas <riyad@informatik.uni-bremen.de>2012-10-31 00:55:51 +0400
committerRiyad Preukschas <riyad@informatik.uni-bremen.de>2012-12-04 01:51:56 +0400
commitbd60a4ed40ca52fd23e027de8f30e2f094eb6e5c (patch)
treedc64b73ebbcb66bcef325d89dca5b08f5fae24be /app/assets/javascripts/notes.js
parentae067ee322e6702fb5ef0fd4f0cc4d4d5106cbde (diff)
Make notes JS know which notes are new in a request
Diffstat (limited to 'app/assets/javascripts/notes.js')
-rw-r--r--app/assets/javascripts/notes.js39
1 files changed, 20 insertions, 19 deletions
diff --git a/app/assets/javascripts/notes.js b/app/assets/javascripts/notes.js
index 91215fdbcbe..f6a27c7ec6a 100644
--- a/app/assets/javascripts/notes.js
+++ b/app/assets/javascripts/notes.js
@@ -89,12 +89,12 @@ var NoteList = {
getContent:
function() {
$.ajax({
- type: "GET",
- url: this.notes_path,
- data: this.target_params,
- complete: function(){ $('.notes-status').removeClass("loading")},
- beforeSend: function() { $('.notes-status').addClass("loading") },
- dataType: "script"});
+ url: this.notes_path,
+ data: this.target_params,
+ complete: function(){ $('.notes-status').removeClass("loading")},
+ beforeSend: function() { $('.notes-status').addClass("loading") },
+ dataType: "script"
+ });
},
/**
@@ -102,9 +102,9 @@ var NoteList = {
* Replaces the content of #notes-list with the given html.
*/
setContent:
- function(first_id, last_id, html) {
- this.top_id = first_id;
- this.bottom_id = last_id;
+ function(newNoteIds, html) {
+ this.top_id = newNoteIds.first();
+ this.bottom_id = newNoteIds.last();
$("#notes-list").html(html);
// init infinite scrolling
@@ -151,12 +151,12 @@ var NoteList = {
// only load more notes if there are no "new" notes
$('.loading').show();
$.ajax({
- type: "GET",
url: this.notes_path,
data: this.target_params + "&loading_more=1&" + (this.reversed ? "before_id" : "after_id") + "=" + this.bottom_id,
complete: function(){ $('.notes-status').removeClass("loading")},
beforeSend: function() { $('.notes-status').addClass("loading") },
- dataType: "script"});
+ dataType: "script"
+ });
},
/**
@@ -164,9 +164,10 @@ var NoteList = {
* Append notes to #notes-list.
*/
appendMoreNotes:
- function(id, html) {
- if(id != this.bottom_id) {
- this.bottom_id = id;
+ function(newNoteIds, html) {
+ var lastNewNoteId = newNoteIds.last();
+ if(lastNewNoteId != this.bottom_id) {
+ this.bottom_id = lastNewNoteId;
$("#notes-list").append(html);
}
},
@@ -212,10 +213,10 @@ var NoteList = {
getNew:
function() {
$.ajax({
- type: "GET",
- url: this.notes_path,
- data: this.target_params + "&loading_new=1&after_id=" + (this.reversed ? this.top_id : this.bottom_id),
- dataType: "script"});
+ url: this.notes_path,
+ data: this.target_params + "&loading_new=1&after_id=" + (this.reversed ? this.top_id : this.bottom_id),
+ dataType: "script"
+ });
},
/**
@@ -223,7 +224,7 @@ var NoteList = {
* Replaces the content of #new-notes-list with the given html.
*/
replaceNewNotes:
- function(html) {
+ function(newNoteIds, html) {
$("#new-notes-list").html(html);
this.updateVotes();
},