Commit 2df9bae7 authored by Alfredo Sumaran's avatar Alfredo Sumaran

Create protected branch dropdown directly

Since there’s only one dropdown of this type we don’t need a class to create this dropdown masively.
parent 416d2198
......@@ -5,7 +5,7 @@ class ProtectedBranchCreate {
}
buildDropdowns() {
// Allowed to Merge dropdowns
// Allowed to Merge dropdown
const $allowedToMergeDropdown = this.$wrap.find('.js-allowed-to-merge');
const $allowedToPushDropdown = this.$wrap.find('.js-allowed-to-push');
......@@ -18,7 +18,7 @@ class ProtectedBranchCreate {
// Select default
$allowedToMergeDropdown.data('glDropdown').selectRowAtIndex(0);
// Allowed to Push dropdowns
// Allowed to Push dropdown
new ProtectedBranchAccessDropdown({
$dropdown: $allowedToPushDropdown,
data: gon.push_access_levels,
......@@ -28,8 +28,9 @@ class ProtectedBranchCreate {
// Select default
$allowedToPushDropdown.data('glDropdown').selectRowAtIndex(0);
new ProtectedBranchDropdowns({
$dropdowns: this.$wrap.find('.js-protected-branch-select'),
// Protected branch dropdown
new ProtectedBranchDropdown({
$dropdown: this.$wrap.find('.js-protected-branch-select'),
onSelect: this.onSelect.bind(this)
});
}
......
class ProtectedBranchDropdowns {
constructor(options) {
const { $dropdowns, onSelect } = options;
$dropdowns.each((i, el) => {
new ProtectedBranchDropdown({
$dropdown: $(el),
onSelect: onSelect
});
});
}
}
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