From b95610846f40a6445bff1dd13922b44f899ff404 Mon Sep 17 00:00:00 2001 From: Mathieu Pillard Date: Thu, 26 Jul 2018 12:53:23 +0200 Subject: [PATCH] Follow changes in the theme name immediately in static theme wizard --- static/js/zamboni/static_theme.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/static/js/zamboni/static_theme.js b/static/js/zamboni/static_theme.js index 1264d2b24d..9c8396ce8a 100644 --- a/static/js/zamboni/static_theme.js +++ b/static/js/zamboni/static_theme.js @@ -48,6 +48,10 @@ $(document).ready(function() { function updateManifest() { textarea = $wizard.find('#manifest').val(generateManifest()); + toggleSubmitIfNeeded(); + } + + function toggleSubmitIfNeeded() { $wizard.find('button.upload').attr('disabled', ! required_fields_present()); } @@ -120,9 +124,16 @@ $(document).ready(function() { updateManifest(); } }); - /* force the pop-up panel ltr or the images end up in the wrong position. */ + /* Force the pop-up panel ltr or the images end up in the wrong + position. */ $wizard.find('div.minicolors-panel').attr('dir', 'ltr'); + /* The submit button availability needs to follow changes to the theme + name as soon as they happen, to react properly if it's modified but + the user hasn't focused something else yet */ + $wizard.on('input', '#theme-name', toggleSubmitIfNeeded); + /* We update the full manifest when a proper change event is triggered, + the user has finished editing the name at this point. */ $wizard.on('change', '#theme-name', updateManifest); $wizard.on('click', 'button.upload', _pd(function(event) {