[extensions-web] Add the out of date indicator on the local extensions page



commit 42464b26e24cc7adec231cb92fe22f665e51b876
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Sun Dec 18 02:32:46 2011 -0500

    Add the out of date indicator on the local extensions page

 sweettooth/static/js/extensions.js |   38 ++++++++++++++++-------------------
 sweettooth/static/js/main.js       |    6 +++++
 2 files changed, 23 insertions(+), 21 deletions(-)
---
diff --git a/sweettooth/static/js/extensions.js b/sweettooth/static/js/extensions.js
index cc3bc4a..7ee8fb6 100644
--- a/sweettooth/static/js/extensions.js
+++ b/sweettooth/static/js/extensions.js
@@ -30,8 +30,21 @@ function($, messages, dbusProxy, extensionUtils) {
         });
     };
 
-    var $extList = $('#extensions-list');
-    $extList.paginatorify('/ajax/extensions-list/');
+    $.fn.addOutOfDateIndicator = function() {
+        return this.each(function() {
+            var svm = $(this).data('svm');
+            if (!svm)
+                return;
+
+            var vpk = extensionUtils.grabProperExtensionVersion(svm, dbusProxy.ShellVersion);
+            if (vpk === null) {
+                $(this).
+                    addClass('out-of-date').
+                    attr('title', "This extension is incompatible with your version of GNOME").
+                    tipsy({ gravity: 'c', fade: true });
+            }
+        });
+    };
 
     // While technically we shouldn't have mismatched API versions,
     // the plugin doesn't check whether the Shell matches, so if someone
@@ -230,7 +243,8 @@ function($, messages, dbusProxy, extensionUtils) {
                                 $elem.
                                     data('pk', result.pk).
                                     data('svm', $.parseJSON(result.shell_version_map)).
-                                    append($('<button>', {'class': 'uninstall', 'title': "Uninstall"}).text("Uninstall").bind('click', uninstall));
+                                    append($('<button>', {'class': 'uninstall', 'title': "Uninstall"}).text("Uninstall").bind('click', uninstall)).
+                                    addOutOfDateIndicator();
                             }
 
                             addExtensionSwitch(uuid, extension, $elem);
@@ -310,22 +324,4 @@ function($, messages, dbusProxy, extensionUtils) {
         });
     };
 
-    function addOutOfDateIndicator() {
-        $('li.extension').each(function() {
-            var svm = $(this).data('svm');
-            if (!svm)
-                return;
-
-            var vpk = extensionUtils.grabProperExtensionVersion(svm, dbusProxy.ShellVersion);
-            if (vpk === null) {
-                $(this).
-                    addClass('out-of-date').
-                    attr('title', "This extension is incompatible with your version of GNOME").
-                    tipsy({ gravity: 'c', fade: true });
-            }
-        });
-    }
-
-    $extList.bind('page-loaded', addOutOfDateIndicator);
-
 });
diff --git a/sweettooth/static/js/main.js b/sweettooth/static/js/main.js
index 7808012..0cac953 100644
--- a/sweettooth/static/js/main.js
+++ b/sweettooth/static/js/main.js
@@ -102,6 +102,12 @@ require(['jquery', 'messages', 'extensions', 'uploader',
 
         $('#extension_shell_versions_info').buildShellVersionsInfo();
 
+        $('#extensions-list').
+            paginatorify('/ajax/extensions-list/').
+            bind('page-loaded', function() {
+                $('li.extension').addOutOfDateIndicator();
+            });
+
         $('.extension_status_toggle a').click(function() {
             var $link = $(this);
             var $tr = $link.parents('tr');



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