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:
authorMike Greiling <mike@pixelcog.com>2016-11-11 00:24:52 +0300
committerMike Greiling <mike@pixelcog.com>2016-12-03 02:32:37 +0300
commit2de245c7bad211cd85a4a23f9110aac82f2bb0a2 (patch)
tree5db680b349ee47eee4bae00f026111c52a61e999 /app/assets/javascripts/single_file_diff.js
parent3ebb815a38ba86e4133557f77b94c292c8fc2e7e (diff)
temporarily revert "Added forceLoad ability to singleFileDiffs, added callback to getContentHTML, added conditional force load if a collapsed diff line anchor is found"
This reverts commit d2ee380816fa161d94da54c1f7e594c9a2ba2241.
Diffstat (limited to 'app/assets/javascripts/single_file_diff.js')
-rw-r--r--app/assets/javascripts/single_file_diff.js19
1 files changed, 7 insertions, 12 deletions
diff --git a/app/assets/javascripts/single_file_diff.js b/app/assets/javascripts/single_file_diff.js
index 2767849e673..f5e06e6c817 100644
--- a/app/assets/javascripts/single_file_diff.js
+++ b/app/assets/javascripts/single_file_diff.js
@@ -13,7 +13,7 @@
COLLAPSED_HTML = '<div class="nothing-here-block diff-collapsed">This diff is collapsed. <a class="click-to-expand">Click to expand it.</a></div>';
- function SingleFileDiff(file, forceLoad, cb) {
+ function SingleFileDiff(file) {
this.file = file;
this.toggleDiff = bind(this.toggleDiff, this);
this.content = $('.diff-content', this.file);
@@ -32,12 +32,9 @@
this.$toggleIcon.addClass('fa-caret-down');
}
$('.file-title, .click-to-expand', this.file).on('click', this.toggleDiff);
- if (forceLoad) {
- this.toggleDiff(null, cb);
- }
}
- SingleFileDiff.prototype.toggleDiff = function(e, cb) {
+ SingleFileDiff.prototype.toggleDiff = function(e) {
var $target = $(e.target);
if (!$target.hasClass('file-title') && !$target.hasClass('click-to-expand') && !$target.hasClass('diff-toggle-caret')) return;
this.isOpen = !this.isOpen;
@@ -57,11 +54,11 @@
}
} else {
this.$toggleIcon.addClass('fa-caret-down').removeClass('fa-caret-right');
- return this.getContentHTML(cb);
+ return this.getContentHTML();
}
};
- SingleFileDiff.prototype.getContentHTML = function(cb) {
+ SingleFileDiff.prototype.getContentHTML = function() {
this.collapsedContent.hide();
this.loadingContent.show();
$.get(this.diffForPath, (function(_this) {
@@ -79,8 +76,6 @@
if (typeof gl.diffNotesCompileComponents !== 'undefined') {
gl.diffNotesCompileComponents();
}
-
- if (cb) cb();
};
})(this));
};
@@ -89,10 +84,10 @@
})();
- $.fn.singleFileDiff = function(forceLoad, cb) {
+ $.fn.singleFileDiff = function() {
return this.each(function() {
- if (!$.data(this, 'singleFileDiff') || forceLoad) {
- return $.data(this, 'singleFileDiff', new SingleFileDiff(this, forceLoad, cb));
+ if (!$.data(this, 'singleFileDiff')) {
+ return $.data(this, 'singleFileDiff', new SingleFileDiff(this));
}
});
};