Convert BlobLicenseSelctors to ES6.
This commit is contained in:
parent
53541e2691
commit
2c5bd97dc4
2 changed files with 21 additions and 25 deletions
|
@ -1,25 +0,0 @@
|
|||
(function() {
|
||||
this.BlobLicenseSelectors = (function() {
|
||||
function BlobLicenseSelectors(opts) {
|
||||
var ref;
|
||||
this.$dropdowns = (ref = opts.$dropdowns) != null ? ref : $('.js-license-selector'), this.editor = opts.editor;
|
||||
this.$dropdowns.each((function(_this) {
|
||||
return function(i, dropdown) {
|
||||
var $dropdown;
|
||||
$dropdown = $(dropdown);
|
||||
return new BlobLicenseSelector({
|
||||
pattern: /^(.+\/)?(licen[sc]e|copying)($|\.)/i,
|
||||
data: $dropdown.data('data'),
|
||||
wrapper: $dropdown.closest('.js-license-selector-wrap'),
|
||||
dropdown: $dropdown,
|
||||
editor: _this.editor
|
||||
});
|
||||
};
|
||||
})(this));
|
||||
}
|
||||
|
||||
return BlobLicenseSelectors;
|
||||
|
||||
})();
|
||||
|
||||
}).call(this);
|
21
app/assets/javascripts/blob/blob_license_selectors.js.es6
Normal file
21
app/assets/javascripts/blob/blob_license_selectors.js.es6
Normal file
|
@ -0,0 +1,21 @@
|
|||
((global) => {
|
||||
class BlobLicenseSelectors() {
|
||||
constructor({ $dropdowns, editor }) {
|
||||
this.$dropdowns = $('.js-license-selector');
|
||||
this.editor = editor;
|
||||
this.$dropdowns.each((dropdown) => {
|
||||
const $dropdown = $(dropdown);
|
||||
return new BlobLicenseSelector({
|
||||
editor,
|
||||
pattern: /^(.+\/)?(licen[sc]e|copying)($|\.)/i,
|
||||
data: $dropdown.data('data'),
|
||||
wrapper: $dropdown.closest('.js-license-selector-wrap'),
|
||||
dropdown: $dropdown,
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
global.BlobLicenseSelectors = BlobLicenseSelectors;
|
||||
|
||||
})(window.gl || (window.gl = {}));
|
Loading…
Reference in a new issue