diff options
author | Bryce Johnson <bryce@gitlab.com> | 2016-09-08 14:30:32 +0200 |
---|---|---|
committer | Bryce Johnson <bryce@gitlab.com> | 2016-10-05 11:25:01 +0200 |
commit | 45ae34f883b777b83ce4ae319c23cb5396403b5e (patch) | |
tree | bc3126308e63769244f6fe920451f1ffaea856fe | |
parent | cfb03b3d06a3dbd16c6e193a128bb737a0a327fd (diff) | |
download | gitlab-ce-45ae34f883b777b83ce4ae319c23cb5396403b5e.tar.gz |
Properly scope BlobCiYamlSelector and BlobCiYamlSelectors.
-rw-r--r-- | app/assets/javascripts/blob/blob_ci_yaml.js.es6 | 55 | ||||
-rw-r--r-- | app/assets/javascripts/blob_edit/edit_blob.js | 2 |
2 files changed, 32 insertions, 25 deletions
diff --git a/app/assets/javascripts/blob/blob_ci_yaml.js.es6 b/app/assets/javascripts/blob/blob_ci_yaml.js.es6 index 9f219cecc23..5ae6f1a5940 100644 --- a/app/assets/javascripts/blob/blob_ci_yaml.js.es6 +++ b/app/assets/javascripts/blob/blob_ci_yaml.js.es6 @@ -1,32 +1,39 @@ /*= require blob/template_selector */ +((global) => { -class BlobCiYamlSelector extends TemplateSelector { - constructor(...args) { - super(...args); - } + class BlobCiYamlSelector extends TemplateSelector { + constructor(...args) { + super(...args); + } - requestFile(query) { - return Api.gitlabCiYml(query.name, this.requestFileSuccess.bind(this)); + requestFile(query) { + return Api.gitlabCiYml(query.name, this.requestFileSuccess.bind(this)); + }; }; -}; -class BlobCiYamlSelectors { - constructor(opts) { - this.$dropdowns = opts.$dropdowns || $('.js-gitlab-ci-yml-selector'); - this.editor = opts.editor; - this.initSelectors(); - } + global.BlobCiYamlSelector = BlobCiYamlSelector; + + class BlobCiYamlSelectors { + constructor(opts) { + this.$dropdowns = opts.$dropdowns || $('.js-gitlab-ci-yml-selector'); + this.editor = opts.editor; + this.initSelectors(); + } - initSelectors() { - this.$dropdowns.each((i, dropdown) => { - const $dropdown = $(dropdown); - return new BlobCiYamlSelector({ - pattern: /(.gitlab-ci.yml)/, - data: $dropdown.data('data'), - wrapper: $dropdown.closest('.js-gitlab-ci-yml-selector-wrap'), - dropdown: $dropdown, - editor: this.editor + initSelectors() { + this.$dropdowns.each((i, dropdown) => { + const $dropdown = $(dropdown); + return new BlobCiYamlSelector({ + pattern: /(.gitlab-ci.yml)/, + data: $dropdown.data('data'), + wrapper: $dropdown.closest('.js-gitlab-ci-yml-selector-wrap'), + dropdown: $dropdown, + editor: this.editor + }); }); - }); + } } -} + + global.BlobCiYamlSelectors = BlobCiYamlSelectors; + +})(window.gl || (window.gl = {})); diff --git a/app/assets/javascripts/blob_edit/edit_blob.js b/app/assets/javascripts/blob_edit/edit_blob.js index de6cdd851be..0be4b6392bf 100644 --- a/app/assets/javascripts/blob_edit/edit_blob.js +++ b/app/assets/javascripts/blob_edit/edit_blob.js @@ -29,7 +29,7 @@ new BlobGitignoreSelectors({ editor: this.editor }); - new BlobCiYamlSelectors({ + new gl.BlobCiYamlSelectors({ editor: this.editor }); } |