[extensions-web] js: Remove the Undo? button



commit f5611c9538651157962b19ce086c1264648c848c
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Mon May 14 14:00:49 2012 -0300

    js: Remove the Undo? button
    
    I'm not sure it's a good idea. Users can always click on the extension name in
    the message to reinstall it. It also removes another use of the client-side SVM,
    which is always a good idea.

 sweettooth/static/js/extensions.js                 |   32 +------------------
 .../js/templates/extensions/uninstall.mustache     |    2 +-
 sweettooth/static/js/templates/templatedata.js     |    2 +-
 3 files changed, 4 insertions(+), 32 deletions(-)
---
diff --git a/sweettooth/static/js/extensions.js b/sweettooth/static/js/extensions.js
index ba14476..326bea2 100644
--- a/sweettooth/static/js/extensions.js
+++ b/sweettooth/static/js/extensions.js
@@ -102,9 +102,7 @@ function($, messages, dbusProxy, extensionUtils, templates) {
         });
 
         $elem.data({'elem': $elem,
-                    'state': _state,
-                    'uninstalled': false,
-                    'undo-uninstall-message': null});
+                    'state': _state});
 
         $switch.data('elem', $elem);
         $switch.switchify();
@@ -163,15 +161,6 @@ function($, messages, dbusProxy, extensionUtils, templates) {
                 $elem.addClass('out-of-date');
                 $switch.switchify('customize', "OUTDATED", 'outdated');
             }
-
-            if ($elem.data('uninstalled') && (newState == ExtensionState.ENABLED ||
-                                              newState == ExtensionState.ERROR ||
-                                              newState == ExtensionState.OUT_OF_DATE)) {
-                $elem.fadeIn({ queue: false }).slideDown();
-                $elem.data('uninstalled', false);
-                $elem.data('undo-uninstall-message').slideUp();
-            }
-
         });
         $elem.trigger('state-changed', _state);
         elems[uuid] = $elem;
@@ -200,28 +189,11 @@ function($, messages, dbusProxy, extensionUtils, templates) {
                     extensionValues.forEach(function(extension) {
                         var uuid = extension.uuid;
 
-                        function reinstall() {
-                            dbusProxy.InstallExtension(uuid);
-
-                            // If the user clicks "Install" we need to show that we
-                            // installed it by reattaching the element, but we can't do
-                            // that here -- the user might click "Cancel".
-                            $elem.data('uninstalled', true);
-                        }
-
                         function uninstall() {
-                            var svm = extension.shell_version_map;
-                            var wantUndo = (extensionUtils.grabProperExtensionVersion(svm, dbusProxy.ShellVersion) !== null);
-
                             dbusProxy.UninstallExtension(uuid).done(function(result) {
                                 if (result) {
                                     $elem.fadeOut({ queue: false }).slideUp({ queue: false });
-
-                                    if (wantUndo) {
-                                        var $message = messages.addInfo(templates.extensions.uninstall(extension));
-                                        $message.on('click', 'a', reinstall);
-                                        $elem.data('undo-uninstall-message', $message);
-                                    }
+                                    messages.addInfo(templates.extensions.uninstall(extension));
                                 }
                             });
                         }
diff --git a/sweettooth/static/js/templates/extensions/uninstall.mustache b/sweettooth/static/js/templates/extensions/uninstall.mustache
index ce579ff..8a350ce 100644
--- a/sweettooth/static/js/templates/extensions/uninstall.mustache
+++ b/sweettooth/static/js/templates/extensions/uninstall.mustache
@@ -1 +1 @@
-You uninstalled <b>{{name}}. <a href="#">Undo?</a>
+You uninstalled <b>{{name}}</b>.
diff --git a/sweettooth/static/js/templates/templatedata.js b/sweettooth/static/js/templates/templatedata.js
index 73819c9..3716bfa 100644
--- a/sweettooth/static/js/templates/templatedata.js
+++ b/sweettooth/static/js/templates/templatedata.js
@@ -7,7 +7,7 @@ define({
     "info": "<div class=\"extension\" data-uuid=\"{{uuid}}\">\n  {{>extensions.info_contents}}\n</div>", 
     "info_contents": "<div class=\"switch\"></div>\n<div class=\"extra-buttons\">\n  <div class=\"upgrade-button\"></div>\n  <div class=\"configure-button\"></div>\n</div>\n<img class=\"icon\" src=\"{{icon}}\">\n<h3 class=\"extension-name\">\n  {{#link}}\n    <a href=\"{{link}}\" class=\"title-link\"> <img src=\"{{icon}}\" class=\"icon\"> {{name}} </a>\n  {{/link}}\n  {{^link}}\n  {{name}}\n  {{/link}}\n</h3>\n{{#creator}}\n  <span class=\"author\">by <a href=\"{{creator_url}}\"> {{creator}} </a></span>\n{{/creator}}\n<p class=\"description\">\n  {{first_line_of_description}}\n</p>\n{{#want_uninstall}}\n  <button class=\"uninstall\" title=\"Uninstall\">Uninstall</button>\n{{/want_uninstall}}", 
     "info_list": "<ul class=\"extensions\">\n{{#extensions}}\n  <li class=\"extension\" data-svm=\"{{shell_version_map}}\">\n    {{>extensions.info_contents}}\n  </li>\n{{/extensions}}\n</ul>", 
-    "uninstall": "You uninstalled <b>{{name}}. <a href=\"#\">Undo?</a>"
+    "uninstall": "You uninstalled <b>{{name}}</b>."
   }, 
   "messages": {
     "cannot_list_errors": "GNOME Shell Extensions cannot automatically detect any errors.", 



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