[extensions-web] js: Update configure button visibility on state changes



commit fedcc458462211555af72fda7a8e76436bffae00
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Mon Apr 2 09:34:39 2012 -0400

    js: Update configure button visibility on state changes

 sweettooth/static/js/extensions.js |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)
---
diff --git a/sweettooth/static/js/extensions.js b/sweettooth/static/js/extensions.js
index 4311f69..b030014 100644
--- a/sweettooth/static/js/extensions.js
+++ b/sweettooth/static/js/extensions.js
@@ -90,14 +90,9 @@ function($, messages, dbusProxy, extensionUtils, templates) {
         else
             _state = ExtensionState.UNINSTALLED;
 
-        if (meta && meta.hasPrefs && meta.state !== ExtensionState.OUT_OF_DATE) {
-            $elem
-                .addClass('configurable')
-                .find('.configure-button')
-                .on('click', function() {
-                    dbusProxy.LaunchExtensionPrefs(uuid);
-                });
-        }
+        $elem.find('.configure-button').on('click', function() {
+            dbusProxy.LaunchExtensionPrefs(uuid);
+        });
 
         $elem.data({'elem': $elem,
                     'state': _state,
@@ -144,6 +139,9 @@ function($, messages, dbusProxy, extensionUtils, templates) {
 
         $elem.bind('state-changed', function(e, newState) {
             $elem.data('state', newState);
+
+            $elem.toggleClass('configurable', meta.hasPrefs && newState !== ExtensionState.OUT_OF_DATE);
+
             if (newState == ExtensionState.DISABLED ||
                 newState == ExtensionState.INITIALIZED ||
                 newState == ExtensionState.UNINSTALLED) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]