diff options
author | Phil Hughes <me@iamphill.com> | 2017-01-23 16:08:57 +0000 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2017-01-23 16:08:57 +0000 |
commit | 0421793ba3acb7bc8612bfac915d783470ba233d (patch) | |
tree | d804450257e2cde0cbb3a4674ec62fb0064fecbe /app/assets | |
parent | 99d5838fb1fdbba1f494ce8baaf7b8d5d4341712 (diff) | |
download | gitlab-ce-0421793ba3acb7bc8612bfac915d783470ba233d.tar.gz |
Correctly resets the default template on destroyfiltered-search-hidden-dont-render
Diffstat (limited to 'app/assets')
-rw-r--r-- | app/assets/javascripts/droplab/droplab_ajax.js | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/app/assets/javascripts/droplab/droplab_ajax.js b/app/assets/javascripts/droplab/droplab_ajax.js index a732525e606..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,15 +53,15 @@ 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; } } - if (!hook.list.hidden) { - 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); @@ -68,6 +69,10 @@ require('../window')(function(w){ }, destroy: function() { + if (this.listTemplate) { + var dynamicList = this.hook.list.list.querySelector('[data-dynamic]'); + dynamicList.outerHTML = this.listTemplate; + } } }; }); |