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 { ...@@ -5,7 +5,7 @@ class ProtectedBranchCreate {
} }
buildDropdowns() { buildDropdowns() {
// Allowed to Merge dropdowns // Allowed to Merge dropdown
const $allowedToMergeDropdown = this.$wrap.find('.js-allowed-to-merge'); const $allowedToMergeDropdown = this.$wrap.find('.js-allowed-to-merge');
const $allowedToPushDropdown = this.$wrap.find('.js-allowed-to-push'); const $allowedToPushDropdown = this.$wrap.find('.js-allowed-to-push');
...@@ -18,7 +18,7 @@ class ProtectedBranchCreate { ...@@ -18,7 +18,7 @@ class ProtectedBranchCreate {
// Select default // Select default
$allowedToMergeDropdown.data('glDropdown').selectRowAtIndex(0); $allowedToMergeDropdown.data('glDropdown').selectRowAtIndex(0);
// Allowed to Push dropdowns // Allowed to Push dropdown
new ProtectedBranchAccessDropdown({ new ProtectedBranchAccessDropdown({
$dropdown: $allowedToPushDropdown, $dropdown: $allowedToPushDropdown,
data: gon.push_access_levels, data: gon.push_access_levels,
...@@ -28,8 +28,9 @@ class ProtectedBranchCreate { ...@@ -28,8 +28,9 @@ class ProtectedBranchCreate {
// Select default // Select default
$allowedToPushDropdown.data('glDropdown').selectRowAtIndex(0); $allowedToPushDropdown.data('glDropdown').selectRowAtIndex(0);
new ProtectedBranchDropdowns({ // Protected branch dropdown
$dropdowns: this.$wrap.find('.js-protected-branch-select'), new ProtectedBranchDropdown({
$dropdown: this.$wrap.find('.js-protected-branch-select'),
onSelect: this.onSelect.bind(this) 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