[extensions-web] js: Gray out incompatible extensions when we have no filter



commit 21c3ae7dd206dca6260981cf3f68c4f47ade393a
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Tue Feb 14 13:46:45 2012 -0500

    js: Gray out incompatible extensions when we have no filter
    
    The indicator is useless, but the opacity change is somewhat useful.

 sweettooth/static/js/extensions.js |   20 ++++++++++++++++++++
 sweettooth/static/js/main.js       |    1 +
 2 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/sweettooth/static/js/extensions.js b/sweettooth/static/js/extensions.js
index 6e1e9c0..7b1c720 100644
--- a/sweettooth/static/js/extensions.js
+++ b/sweettooth/static/js/extensions.js
@@ -60,6 +60,10 @@ function($, messages, dbusProxy, extensionUtils) {
             return this;
         };
 
+        $.fn.grayOutIfOutOfDate = function() {
+            return this;
+        };
+
         $.fn.addLaunchExtensionPrefsButton = function() {
             return this;
         };
@@ -239,6 +243,9 @@ function($, messages, dbusProxy, extensionUtils) {
                         if (extension.hasPrefs && extension.state !== ExtensionState.OUT_OF_DATE)
                             $elem.addLaunchExtensionPrefsButton(true);
 
+                        if (extension.state === ExtensionState.OUT_OF_DATE)
+                            $elem.addClass('out-of-date');
+
                         $.ajax({
                             url: "/ajax/detail/",
                             dataType: "json",
@@ -336,6 +343,19 @@ function($, messages, dbusProxy, extensionUtils) {
         });
     };
 
+    $.fn.grayOutIfOutOfDate = function() {
+        return this.each(function() {
+            var $elem = $(this);
+            var svm = $elem.data('svm');
+            if (!svm)
+                return;
+
+            var vpk = extensionUtils.grabProperExtensionVersion(svm, dbusProxy.ShellVersion);
+            if (vpk === null)
+                $elem.addClass('out-of-date');
+        });
+    };
+
     $.fn.addLaunchExtensionPrefsButton = function(force) {
         function launchExtensionPrefsButton($elem, uuid) {
             $elem.
diff --git a/sweettooth/static/js/main.js b/sweettooth/static/js/main.js
index 79611f6..3137373 100644
--- a/sweettooth/static/js/main.js
+++ b/sweettooth/static/js/main.js
@@ -120,6 +120,7 @@ require(['jquery', 'messages', 'modal',
         $('#extensions-list').
             paginatorify('/ajax/extensions-list/').
             bind('page-loaded', function() {
+                $('li.extension').grayOutIfOutOfDate();
                 $('#extensions-list .before-paginator').fsUIify();
 
                 // Scroll the page back up to the top.



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