summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/protected_branches
diff options
context:
space:
mode:
authorEric Eastwood <contact@ericeastwood.com>2017-03-27 21:27:25 -0500
committerEric Eastwood <contact@ericeastwood.com>2017-03-27 21:27:25 -0500
commit550adacb3e5cdb161b41cf72309a5d65498f5906 (patch)
tree2f6f72bd8826ff3df8f8a5956c42cf7c854af1b4 /app/assets/javascripts/protected_branches
parentd4c99f644a2da2aa340aee8bc10c1dcf7c9e0d18 (diff)
downloadgitlab-ce-550adacb3e5cdb161b41cf72309a5d65498f5906.tar.gz
Fix custom protected branch pattern jumping scroll position to top
Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/30149 Use more semantic `<button>` element and prevent the form from submitting.
Diffstat (limited to 'app/assets/javascripts/protected_branches')
-rw-r--r--app/assets/javascripts/protected_branches/protected_branch_dropdown.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/app/assets/javascripts/protected_branches/protected_branch_dropdown.js b/app/assets/javascripts/protected_branches/protected_branch_dropdown.js
index 5cf28aa7a73..1d4bb8a13d6 100644
--- a/app/assets/javascripts/protected_branches/protected_branch_dropdown.js
+++ b/app/assets/javascripts/protected_branches/protected_branch_dropdown.js
@@ -6,7 +6,7 @@ class ProtectedBranchDropdown {
this.$dropdown = options.$dropdown;
this.$dropdownContainer = this.$dropdown.parent();
this.$dropdownFooter = this.$dropdownContainer.find('.dropdown-footer');
- this.$protectedBranch = this.$dropdownContainer.find('.create-new-protected-branch');
+ this.$protectedBranch = this.$dropdownContainer.find('.js-create-new-protected-branch');
this.buildDropdown();
this.bindEvents();
@@ -46,7 +46,9 @@ class ProtectedBranchDropdown {
this.$protectedBranch.on('click', this.onClickCreateWildcard.bind(this));
}
- onClickCreateWildcard() {
+ onClickCreateWildcard(e) {
+ e.preventDefault();
+
// Refresh the dropdown's data, which ends up calling `getProtectedBranches`
this.$dropdown.data('glDropdown').remote.execute();
this.$dropdown.data('glDropdown').selectRowAtIndex();
@@ -69,7 +71,7 @@ class ProtectedBranchDropdown {
if (branchName) {
this.$dropdownContainer
- .find('.create-new-protected-branch code')
+ .find('.js-create-new-protected-branch code')
.text(branchName);
}