Select first value by default

This commit is contained in:
Alfredo Sumaran 2016-08-03 20:08:57 -05:00
parent 3b228db1c2
commit e1d86ec914
1 changed files with 11 additions and 2 deletions

View File

@ -6,19 +6,28 @@ class ProtectedBranchCreate {
buildDropdowns() {
// Allowed to Merge dropdowns
const $allowedToMergeDropdown = this.$wrap.find('.js-allowed-to-merge');
const $allowedToPushDropdown = this.$wrap.find('.js-allowed-to-push');
new ProtectedBranchAccessDropdown({
$dropdown: this.$wrap.find('.js-allowed-to-merge'),
$dropdown: $allowedToMergeDropdown,
data: gon.merge_access_levels,
onSelect: this.onSelect.bind(this)
});
// Select default
$allowedToMergeDropdown.data('glDropdown').selectRowAtIndex(document.createEvent('Event'), 0);
// Allowed to Push dropdowns
new ProtectedBranchAccessDropdown({
$dropdown: this.$wrap.find('.js-allowed-to-push'),
$dropdown: $allowedToPushDropdown,
data: gon.push_access_levels,
onSelect: this.onSelect.bind(this)
});
// Select default
$allowedToPushDropdown.data('glDropdown').selectRowAtIndex(document.createEvent('Event'), 0);
new ProtectedBranchDropdowns({
$dropdowns: this.$wrap.find('.js-protected-branch-select'),
onSelect: this.onSelect.bind(this)