Select first value by default

This commit is contained in:
Alfredo Sumaran 2016-08-03 20:08:57 -05:00
parent 3b228db1c2
commit e1d86ec914

View file

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