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:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-03-19 14:34:14 +0400
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-03-19 14:34:14 +0400
commit5bf3a898edbbd0fc4f7a4557f6ffaea8ffabfbc7 (patch)
tree8e04d6b7e9f815e95343ce64de6c12e0998cf67b /app/assets/javascripts/notes.js
parent1752c6dc8b755bc2fbff2757e8549521b0823048 (diff)
Remove wall from basic notes logic
Diffstat (limited to 'app/assets/javascripts/notes.js')
-rw-r--r--app/assets/javascripts/notes.js141
1 files changed, 0 insertions, 141 deletions
diff --git a/app/assets/javascripts/notes.js b/app/assets/javascripts/notes.js
index 4333d823178..2485f70797d 100644
--- a/app/assets/javascripts/notes.js
+++ b/app/assets/javascripts/notes.js
@@ -4,31 +4,16 @@ var NoteList = {
target_params: null,
target_id: 0,
target_type: null,
- top_id: 0,
- bottom_id: 0,
loading_more_disabled: false,
- reversed: false,
init: function(tid, tt, path) {
NoteList.notes_path = path + ".js";
NoteList.target_id = tid;
NoteList.target_type = tt;
- NoteList.reversed = $("#notes-list").is(".reversed");
NoteList.target_params = "target_type=" + NoteList.target_type + "&target_id=" + NoteList.target_id;
NoteList.setupMainTargetNoteForm();
- if(NoteList.reversed) {
- var form = $(".js-main-target-form");
- form.find(".note-form-actions").hide();
- var textarea = form.find(".js-note-text");
- textarea.css("height", "40px");
- textarea.on("focus", function(){
- textarea.css("height", "80px");
- form.find(".note-form-actions").show();
- });
- }
-
// get initial set of notes
NoteList.getContent();
@@ -344,128 +329,11 @@ var NoteList = {
* Replaces the content of #notes-list with the given html.
*/
setContent: function(newNoteIds, html) {
- NoteList.top_id = newNoteIds.first();
- NoteList.bottom_id = newNoteIds.last();
$("#notes-list").html(html);
-
- // for the wall
- if (NoteList.reversed) {
- // init infinite scrolling
- NoteList.initLoadMore();
-
- // init getting new notes
- NoteList.initRefreshNew();
- }
},
/**
- * Handle loading more notes when scrolling to the bottom of the page.
- * The id of the last note in the list is in NoteList.bottom_id.
- *
- * Set up refreshing only new notes after all notes have been loaded.
- */
-
-
- /**
- * Initializes loading more notes when scrolling to the bottom of the page.
- */
- initLoadMore: function() {
- $(document).endlessScroll({
- bottomPixels: 400,
- fireDelay: 1000,
- fireOnce:true,
- ceaseFire: function() {
- return NoteList.loading_more_disabled;
- },
- callback: function(i) {
- NoteList.getMore();
- }
- });
- },
-
- /**
- * Gets an additional set of notes.
- */
- getMore: function() {
- // only load more notes if there are no "new" notes
- $('.loading').show();
- $.ajax({
- url: NoteList.notes_path,
- data: NoteList.target_params + "&loading_more=1&" + (NoteList.reversed ? "before_id" : "after_id") + "=" + NoteList.bottom_id,
- complete: function(){ $('.js-notes-busy').removeClass("loading")},
- beforeSend: function() { $('.js-notes-busy').addClass("loading") },
- dataType: "script"
- });
- },
-
- /**
- * Called in response to getMore().
- * Append notes to #notes-list.
- */
- appendMoreNotes: function(newNoteIds, html) {
- var lastNewNoteId = newNoteIds.last();
- if(lastNewNoteId != NoteList.bottom_id) {
- NoteList.bottom_id = lastNewNoteId;
- $("#notes-list").append(html);
- }
- },
-
- /**
- * Called in response to getMore().
- * Disables loading more notes when scrolling to the bottom of the page.
- */
- finishedLoadingMore: function() {
- NoteList.loading_more_disabled = true;
-
- // make sure we are up to date
- NoteList.updateVotes();
- },
-
-
- /**
- * Handle refreshing and adding of new notes.
- *
- * New notes are all notes that are created after the site has been loaded.
- * The "old" notes are in #notes-list the "new" ones will be in #new-notes-list.
- * The id of the last "old" note is in NoteList.bottom_id.
- */
-
-
- /**
- * Initializes getting new notes every n seconds.
- *
- * Note: only used on wall.
- */
- initRefreshNew: function() {
- setInterval("NoteList.getNew()", 10000);
- },
-
- /**
- * Gets the new set of notes.
- *
- * Note: only used on wall.
- */
- getNew: function() {
- $.ajax({
- url: NoteList.notes_path,
- data: NoteList.target_params + "&loading_new=1&after_id=" + (NoteList.reversed ? NoteList.top_id : NoteList.bottom_id),
- dataType: "script"
- });
- },
-
- /**
- * Called in response to getNew().
- * Replaces the content of #new-notes-list with the given html.
- *
- * Note: only used on wall.
- */
- replaceNewNotes: function(newNoteIds, html) {
- $("#new-notes-list").html(html);
- NoteList.updateVotes();
- },
-
- /**
* Adds a single common note to #notes-list.
*/
appendNewNote: function(id, html) {
@@ -498,15 +366,6 @@ var NoteList = {
},
/**
- * Adds a single wall note to #new-notes-list.
- *
- * Note: only used on wall.
- */
- appendNewWallNote: function(id, html) {
- $("#new-notes-list").prepend(html);
- },
-
- /**
* Called in response the main target form has been successfully submitted.
*
* Removes any errors.