Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
0e730a14
Commit
0e730a14
authored
Aug 05, 2016
by
Alfredo Sumaran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cache onSelect callback before passing to each dropdown instance
parent
cd086eba
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
+9
-7
app/assets/javascripts/protected_branch_create.js.es6
app/assets/javascripts/protected_branch_create.js.es6
+9
-7
No files found.
app/assets/javascripts/protected_branch_create.js.es6
View file @
0e730a14
...
@@ -8,38 +8,40 @@
...
@@ -8,38 +8,40 @@
}
}
buildDropdowns() {
buildDropdowns() {
// 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');
// Cache callback
this.onSelectCallback = this.onSelect.bind(this);
// Allowed to Merge dropdown
new gl.ProtectedBranchAccessDropdown({
new gl.ProtectedBranchAccessDropdown({
$dropdown: $allowedToMergeDropdown,
$dropdown: $allowedToMergeDropdown,
data: gon.merge_access_levels,
data: gon.merge_access_levels,
onSelect: this.onSelect
.bind(this)
onSelect: this.onSelect
Callback
});
});
// Select default
$allowedToMergeDropdown.data('glDropdown').selectRowAtIndex(0);
// Allowed to Push dropdown
// Allowed to Push dropdown
new gl.ProtectedBranchAccessDropdown({
new gl.ProtectedBranchAccessDropdown({
$dropdown: $allowedToPushDropdown,
$dropdown: $allowedToPushDropdown,
data: gon.push_access_levels,
data: gon.push_access_levels,
onSelect: this.onSelect
.bind(this)
onSelect: this.onSelect
Callback
});
});
// Select default
// Select default
$allowedToPushDropdown.data('glDropdown').selectRowAtIndex(0);
$allowedToPushDropdown.data('glDropdown').selectRowAtIndex(0);
$allowedToMergeDropdown.data('glDropdown').selectRowAtIndex(0);
// Protected branch dropdown
// Protected branch dropdown
new ProtectedBranchDropdown({
new ProtectedBranchDropdown({
$dropdown: this.$wrap.find('.js-protected-branch-select'),
$dropdown: this.$wrap.find('.js-protected-branch-select'),
onSelect: this.onSelect
.bind(this)
onSelect: this.onSelect
Callback
});
});
}
}
// This will run after clicked callback
// This will run after clicked callback
onSelect() {
onSelect() {
// Enable submit button
// Enable submit button
const $branchInput = this.$wrap.find('input[name="protected_branch[name]"]');
const $branchInput = this.$wrap.find('input[name="protected_branch[name]"]');
const $allowedToMergeInput = this.$wrap.find('input[name="protected_branch[merge_access_level_attributes][access_level]"]');
const $allowedToMergeInput = this.$wrap.find('input[name="protected_branch[merge_access_level_attributes][access_level]"]');
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment