summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/droplab
diff options
context:
space:
mode:
authorJacob Schatz <jschatz@gitlab.com>2017-01-25 04:30:10 +0000
committerJacob Schatz <jschatz@gitlab.com>2017-01-25 04:30:10 +0000
commit1138afe7c0c0ae2b80b5282aff42e6399328eea8 (patch)
tree3c556b169e4f92c87b70e8868d9d8932780fc517 /app/assets/javascripts/droplab
parenta84656fcadac7339853bfa591bc132c68be3a363 (diff)
parent0421793ba3acb7bc8612bfac915d783470ba233d (diff)
downloadgitlab-ce-1138afe7c0c0ae2b80b5282aff42e6399328eea8.tar.gz
Merge branch 'filtered-search-hidden-dont-render' into 'master'
Only render the list if it is visible See merge request !8710
Diffstat (limited to 'app/assets/javascripts/droplab')
-rw-r--r--app/assets/javascripts/droplab/droplab_ajax.js14
1 files changed, 11 insertions, 3 deletions
diff --git a/app/assets/javascripts/droplab/droplab_ajax.js b/app/assets/javascripts/droplab/droplab_ajax.js
index f20610b3811..f7fed0987a2 100644
--- a/app/assets/javascripts/droplab/droplab_ajax.js
+++ b/app/assets/javascripts/droplab/droplab_ajax.js
@@ -29,6 +29,7 @@ require('../window')(function(w){
init: function init(hook) {
var self = this;
var config = hook.config.droplabAjax;
+ this.hook = hook;
if (!config || !config.endpoint || !config.method) {
return;
@@ -52,19 +53,26 @@ require('../window')(function(w){
this._loadUrlData(config.endpoint)
.then(function(d) {
if (config.loadingTemplate) {
- var dataLoadingTemplate = hook.list.list.querySelector('[data-loading-template]');
+ var dataLoadingTemplate = self.hook.list.list.querySelector('[data-loading-template]');
if (dataLoadingTemplate) {
dataLoadingTemplate.outerHTML = self.listTemplate;
}
}
- hook.list[config.method].call(hook.list, d);
+
+ if (!self.hook.list.hidden) {
+ self.hook.list[config.method].call(self.hook.list, d);
+ }
}).catch(function(e) {
throw new droplabAjaxException(e.message || e);
});
},
destroy: function() {
+ if (this.listTemplate) {
+ var dynamicList = this.hook.list.list.querySelector('[data-dynamic]');
+ dynamicList.outerHTML = this.listTemplate;
+ }
}
};
});
@@ -76,4 +84,4 @@ module.exports = function(callback) {
};
},{}]},{},[1])(1)
-}); \ No newline at end of file
+});