Commit 45ae34f8 authored by Bryce Johnson's avatar Bryce Johnson

Properly scope BlobCiYamlSelector and BlobCiYamlSelectors.

parent cfb03b3d
/*= require blob/template_selector */ /*= require blob/template_selector */
((global) => {
class BlobCiYamlSelector extends TemplateSelector { class BlobCiYamlSelector extends TemplateSelector {
constructor(...args) { constructor(...args) {
super(...args); super(...args);
} }
requestFile(query) { requestFile(query) {
return Api.gitlabCiYml(query.name, this.requestFileSuccess.bind(this)); return Api.gitlabCiYml(query.name, this.requestFileSuccess.bind(this));
};
}; };
};
class BlobCiYamlSelectors { global.BlobCiYamlSelector = BlobCiYamlSelector;
constructor(opts) {
this.$dropdowns = opts.$dropdowns || $('.js-gitlab-ci-yml-selector'); class BlobCiYamlSelectors {
this.editor = opts.editor; constructor(opts) {
this.initSelectors(); this.$dropdowns = opts.$dropdowns || $('.js-gitlab-ci-yml-selector');
} this.editor = opts.editor;
this.initSelectors();
}
initSelectors() { initSelectors() {
this.$dropdowns.each((i, dropdown) => { this.$dropdowns.each((i, dropdown) => {
const $dropdown = $(dropdown); const $dropdown = $(dropdown);
return new BlobCiYamlSelector({ return new BlobCiYamlSelector({
pattern: /(.gitlab-ci.yml)/, pattern: /(.gitlab-ci.yml)/,
data: $dropdown.data('data'), data: $dropdown.data('data'),
wrapper: $dropdown.closest('.js-gitlab-ci-yml-selector-wrap'), wrapper: $dropdown.closest('.js-gitlab-ci-yml-selector-wrap'),
dropdown: $dropdown, dropdown: $dropdown,
editor: this.editor editor: this.editor
});
}); });
}); }
} }
}
global.BlobCiYamlSelectors = BlobCiYamlSelectors;
})(window.gl || (window.gl = {}));
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
new BlobGitignoreSelectors({ new BlobGitignoreSelectors({
editor: this.editor editor: this.editor
}); });
new BlobCiYamlSelectors({ new gl.BlobCiYamlSelectors({
editor: this.editor editor: this.editor
}); });
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment