From 5d01173123e46f8a192752eca5d924ebbf2b93c9 Mon Sep 17 00:00:00 2001 From: tfennelly Date: Fri, 5 Feb 2016 12:30:19 +0000 Subject: [PATCH] Store finder show/hide last selection --- war/src/main/js/config-tabbar.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/war/src/main/js/config-tabbar.js b/war/src/main/js/config-tabbar.js index e429d6a362..75db4f84cc 100644 --- a/war/src/main/js/config-tabbar.js +++ b/war/src/main/js/config-tabbar.js @@ -1,4 +1,5 @@ var $ = require('jquery-detached').getJQuery(); +var localStorage = require('./util/jenkinsLocalStorage.js'); $(function() { // Horrible ugly hack... @@ -14,7 +15,6 @@ $(function() { // Only do job configs for now. var configTables = $('.job-config.tabbed'); if (configTables.size() > 0) { - var localStorage = require('./util/jenkinsLocalStorage.js'); var tabBarShowPreferenceKey = 'config:usetabs'; var tabBarShowPreference = localStorage.getGlobalItem(tabBarShowPreferenceKey, "yes"); @@ -63,16 +63,24 @@ $(function() { function addFinderToggle(configTableMetadata) { var findToggle = $('
'); + var finderShowPreferenceKey = 'config:showfinder'; + $('.tabBar', configTableMetadata.configWidgets).append(findToggle); findToggle.click(function() { var findContainer = $('.find-container', configTableMetadata.configWidgets); if (findContainer.hasClass('visible')) { findContainer.removeClass('visible'); + localStorage.setGlobalItem(finderShowPreferenceKey, "no") } else { findContainer.addClass('visible'); $('input', findContainer).focus(); + localStorage.setGlobalItem(finderShowPreferenceKey, "yes") } }); + + if (localStorage.getGlobalItem(finderShowPreferenceKey, "yes") === 'yes') { + findToggle.click(); + } } function fireBottomStickerAdjustEvent() { -- GitLab