Commit 3b228db1 authored by Alfredo Sumaran's avatar Alfredo Sumaran

Remove unnecesary classes to generate dropdowns

Since there are only one dropdown of each type there are no need to create a class to initialize multiple elements with the same CSS class name.
parent bc5bc7cb
class AllowedToMergeDropdowns {
constructor (options) {
const { $dropdowns, onSelect } = options;
$dropdowns.each((i, el) => {
new ProtectedBranchAccessDropdown({
$dropdown: $(el),
data: gon.merge_access_levels,
onSelect: onSelect
});
});
}
}
class AllowedToPushDropdowns {
constructor (options) {
const { $dropdowns, onSelect } = options;
$dropdowns.each((i, el) => {
new ProtectedBranchAccessDropdown({
$dropdown: $(el),
data: gon.push_access_levels,
onSelect: onSelect
});
});
}
}
\ No newline at end of file
......@@ -6,14 +6,16 @@ class ProtectedBranchCreate {
buildDropdowns() {
// Allowed to Merge dropdowns
new AllowedToMergeDropdowns({
$dropdowns: this.$wrap.find('.js-allowed-to-merge'),
new ProtectedBranchAccessDropdown({
$dropdown: this.$wrap.find('.js-allowed-to-merge'),
data: gon.merge_access_levels,
onSelect: this.onSelect.bind(this)
});
// Allowed to Push dropdowns
new AllowedToPushDropdowns({
$dropdowns: this.$wrap.find('.js-allowed-to-push'),
new ProtectedBranchAccessDropdown({
$dropdown: this.$wrap.find('.js-allowed-to-push'),
data: gon.push_access_levels,
onSelect: this.onSelect.bind(this)
});
......
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