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.
This commit is contained in:
Alfredo Sumaran 2016-08-04 03:35:49 -05:00
parent 416d21987e
commit 2df9bae716
2 changed files with 5 additions and 16 deletions

View file

@ -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)
});
}

View file

@ -1,12 +0,0 @@
class ProtectedBranchDropdowns {
constructor(options) {
const { $dropdowns, onSelect } = options;
$dropdowns.each((i, el) => {
new ProtectedBranchDropdown({
$dropdown: $(el),
onSelect: onSelect
});
});
}
}