From a7d7e9a51889a276f2d057207fba8d095fa8fc8d Mon Sep 17 00:00:00 2001
From: Alfredo Sumaran <alfredo@gitlab.com>
Date: Sun, 21 Aug 2016 00:21:32 -0500
Subject: Set default label if user unselects the option from dropdown

---
 app/assets/javascripts/protected_branch_access_dropdown.js.es6 | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

(limited to 'app')

diff --git a/app/assets/javascripts/protected_branch_access_dropdown.js.es6 b/app/assets/javascripts/protected_branch_access_dropdown.js.es6
index 2fbb088fa04..7aeb5f92514 100644
--- a/app/assets/javascripts/protected_branch_access_dropdown.js.es6
+++ b/app/assets/javascripts/protected_branch_access_dropdown.js.es6
@@ -10,8 +10,12 @@
         selectable: true,
         inputId: $dropdown.data('input-id'),
         fieldName: $dropdown.data('field-name'),
-        toggleLabel(item) {
-          return item.text;
+        toggleLabel(item, el) {
+          if (el.is('.is-active')) {
+            return item.text;
+          } else {
+            return 'Select';
+          }
         },
         clicked(item, $el, e) {
           e.preventDefault();
-- 
cgit v1.2.1