summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlfredo Sumaran <alfredo@gitlab.com>2016-08-04 03:35:49 -0500
committerAlfredo Sumaran <alfredo@gitlab.com>2016-08-05 17:19:01 -0500
commit2df9bae7163601ba28e8367ed121dc04b99836ac (patch)
tree5718842cb6ab4bf981ed8d85d61f7349e98d9fd1
parent416d21987e77479eb95ce51c09ea8d07800e30c9 (diff)
downloadgitlab-ce-2df9bae7163601ba28e8367ed121dc04b99836ac.tar.gz
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.
-rw-r--r--app/assets/javascripts/protected_branch_create.js.es69
-rw-r--r--app/assets/javascripts/protected_branch_dropdowns.js.es612
2 files changed, 5 insertions, 16 deletions
diff --git a/app/assets/javascripts/protected_branch_create.js.es6 b/app/assets/javascripts/protected_branch_create.js.es6
index a3115c8d0b5..659ed04d81a 100644
--- a/app/assets/javascripts/protected_branch_create.js.es6
+++ b/app/assets/javascripts/protected_branch_create.js.es6
@@ -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)
});
}
diff --git a/app/assets/javascripts/protected_branch_dropdowns.js.es6 b/app/assets/javascripts/protected_branch_dropdowns.js.es6
deleted file mode 100644
index 51df4b02026..00000000000
--- a/app/assets/javascripts/protected_branch_dropdowns.js.es6
+++ /dev/null
@@ -1,12 +0,0 @@
-class ProtectedBranchDropdowns {
- constructor(options) {
- const { $dropdowns, onSelect } = options;
-
- $dropdowns.each((i, el) => {
- new ProtectedBranchDropdown({
- $dropdown: $(el),
- onSelect: onSelect
- });
- });
- }
- }