summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/protected_branches/protected_branch_access_dropdown.js.es6
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/protected_branches/protected_branch_access_dropdown.js.es6')
-rw-r--r--app/assets/javascripts/protected_branches/protected_branch_access_dropdown.js.es628
1 files changed, 28 insertions, 0 deletions
diff --git a/app/assets/javascripts/protected_branches/protected_branch_access_dropdown.js.es6 b/app/assets/javascripts/protected_branches/protected_branch_access_dropdown.js.es6
new file mode 100644
index 00000000000..7aeb5f92514
--- /dev/null
+++ b/app/assets/javascripts/protected_branches/protected_branch_access_dropdown.js.es6
@@ -0,0 +1,28 @@
+(global => {
+ global.gl = global.gl || {};
+
+ gl.ProtectedBranchAccessDropdown = class {
+ constructor(options) {
+ const { $dropdown, data, onSelect } = options;
+
+ $dropdown.glDropdown({
+ data: data,
+ selectable: true,
+ inputId: $dropdown.data('input-id'),
+ fieldName: $dropdown.data('field-name'),
+ toggleLabel(item, el) {
+ if (el.is('.is-active')) {
+ return item.text;
+ } else {
+ return 'Select';
+ }
+ },
+ clicked(item, $el, e) {
+ e.preventDefault();
+ onSelect();
+ }
+ });
+ }
+ }
+
+})(window);