[extensions-web/feature/uri-handler] extension: added GNOME Software button.



commit 524bb2153db2e2c7989ff6c99c059de2dbd892f7
Author: Yuri Konotopov <ykonotopov gnome org>
Date:   Tue Jan 17 23:44:24 2017 +0400

    extension: added GNOME Software button.
    
    Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=772577

 .../extensions/templates/extensions/detail.html    |    1 +
 sweettooth/static/css/sweettooth.css               |   14 +++++++++++++-
 sweettooth/static/images/gnome-software.png        |  Bin 0 -> 746 bytes
 sweettooth/static/js/extensions.js                 |   15 +++++++++++++++
 4 files changed, 29 insertions(+), 1 deletions(-)
---
diff --git a/sweettooth/extensions/templates/extensions/detail.html 
b/sweettooth/extensions/templates/extensions/detail.html
index c1cde38..17ac799 100644
--- a/sweettooth/extensions/templates/extensions/detail.html
+++ b/sweettooth/extensions/templates/extensions/detail.html
@@ -10,6 +10,7 @@
       <div class="extra-buttons">
         <div class="upgrade-button"></div>
         <div class="configure-button"></div>
+        <div class="gnome-software-button"></div>
       </div>
 
       <div class="extension-header">
diff --git a/sweettooth/static/css/sweettooth.css b/sweettooth/static/css/sweettooth.css
index 9a919a9..1d72516 100644
--- a/sweettooth/static/css/sweettooth.css
+++ b/sweettooth/static/css/sweettooth.css
@@ -379,7 +379,8 @@ li.extension:last-child {
 
 .extension.configurable .configure-button,
 .extension.upgradable .upgrade-button,
-.extension.installed .uninstall-button {
+.extension.installed .uninstall-button,
+.extension .gnome-software-button {
     float: right;
 
     display: block;
@@ -431,6 +432,17 @@ li.extension:last-child {
     border-color: #d92400;
 }
 
+.extension .gnome-software-button {
+    background-color: #d9c128;
+    background-image: url(../images/gnome-software.png);
+    border-color: #a6921f;
+}
+
+.extension .gnome-software-button:hover {
+    background-color: #e6ca2e;
+    border-color: #bfa524;
+}
+
 /* Extension switch */
 
 .extension ._gnome-switch {
diff --git a/sweettooth/static/images/gnome-software.png b/sweettooth/static/images/gnome-software.png
new file mode 100644
index 0000000..1e6d3af
Binary files /dev/null and b/sweettooth/static/images/gnome-software.png differ
diff --git a/sweettooth/static/js/extensions.js b/sweettooth/static/js/extensions.js
index df9efd4..0811bf2 100644
--- a/sweettooth/static/js/extensions.js
+++ b/sweettooth/static/js/extensions.js
@@ -37,6 +37,8 @@ function($, messages, dbusProxy, extensionUtils, templates) {
         messages.addError(templates.get('messages/dummy_proxy')());
 
         $.fn.addExtensionSwitch = function() {
+            enableSoftwareLink($(this), $(this).data('uuid'));
+
             // Don't show our switches -- CSS styles define a clickable
             // area even with no content.
             return this.find('.switch').hide();
@@ -195,6 +197,17 @@ function($, messages, dbusProxy, extensionUtils, templates) {
         elems[uuid] = $elem;
     }
 
+    function enableSoftwareLink(extension, uuid)
+    {
+               extension
+                       .find('.gnome-software-button')
+                       .prop('title', 'Open in GNOME Software')
+                       .on('click', event => {
+                               event.preventDefault();
+                               window.open('web+gnomeshellextension://' + encodeURIComponent(uuid), '_self');
+                       });
+    }
+
     $.fn.addLocalExtensions = function () {
         return this.each(function() {
             var $container = $(this);
@@ -283,6 +296,8 @@ function($, messages, dbusProxy, extensionUtils, templates) {
             var $extension = $(this);
             var uuid = $extension.data('uuid');
 
+            enableSoftwareLink($extension, uuid);
+
             $extension.on('out-of-date', function() {
                 var svm = $extension.data('svm');
                 var nhvOperation = extensionUtils.findNextHighestVersion(svm, dbusProxy.ShellVersion);


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