← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~huwshimi/launchpad/private-objects-298152 into lp:launchpad

 

Huw Wilkins has proposed merging lp:~huwshimi/launchpad/private-objects-298152 into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #298152 in Launchpad itself: "privacy portlet is not visible enough for indicating private objects"
  https://bugs.launchpad.net/launchpad/+bug/298152

For more details, see:
https://code.launchpad.net/~huwshimi/launchpad/private-objects-298152/+merge/53195

The current style for notifying private bugs is not obvious enough. After some discussion I created a new style that overlays a banner at the top of the page that scrolls with it.

The banner can be closed, and when closed the privacy portlet should fade to red.

To test the notification you'll need a bug that has been marked private and you'll need to set the flag with 'bugs.private_notification.enabled default 1 on' on https://launchpad.dev/+feature-rules
-- 
https://code.launchpad.net/~huwshimi/launchpad/private-objects-298152/+merge/53195
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~huwshimi/launchpad/private-objects-298152 into lp:launchpad.
=== removed file 'lib/canonical/launchpad/icing/icon-sprites'
Binary files lib/canonical/launchpad/icing/icon-sprites	2011-02-16 04:32:34 +0000 and lib/canonical/launchpad/icing/icon-sprites	1970-01-01 00:00:00 +0000 differ
=== modified file 'lib/canonical/launchpad/icing/icon-sprites.positioning'
--- lib/canonical/launchpad/icing/icon-sprites.positioning	2011-02-16 04:32:34 +0000
+++ lib/canonical/launchpad/icing/icon-sprites.positioning	2011-03-14 06:11:25 +0000
@@ -13,9 +13,9 @@
         0, 
         -3440
     ], 
-    "../images/build-needed.png": [
+    "../images/zoom-out.png": [
         0, 
-        -13442
+        -11966
     ], 
     "../images/team.png": [
         0, 
@@ -65,9 +65,9 @@
         0, 
         -12458
     ], 
-    "../images/zoom-out.png": [
+    "../images/build-needed.png": [
         0, 
-        -11966
+        -13442
     ], 
     "../images/purple-bar.png": [
         0, 
@@ -441,6 +441,10 @@
         0, 
         -4096
     ], 
+    "../images/notification-close.png": [
+        0, 
+        -20725
+    ], 
     "../images/merge-proposal-large.png": [
         0, 
         -17868
@@ -453,6 +457,10 @@
         0, 
         -1968
     ], 
+    "../images/notification-private.png": [
+        0, 
+        -20554
+    ], 
     "../images/bug.png": [
         0, 
         -4260

=== modified file 'lib/canonical/launchpad/icing/style-3-0.css.in'
--- lib/canonical/launchpad/icing/style-3-0.css.in	2011-03-08 00:40:50 +0000
+++ lib/canonical/launchpad/icing/style-3-0.css.in	2011-03-14 06:11:25 +0000
@@ -24,6 +24,7 @@
       * Header, footer, side, help
       * Colors
       * Sprites
+      * Global notifications
       * Application or page specifc styles that do not belong in this file.
 */
 
@@ -1081,7 +1082,7 @@
     font-size: 12px;
     text-decoration: underline;
     }
-.unseen {
+.unseen, .hidden {
     display: none;
     }
 .invisible-link {
@@ -1293,8 +1294,14 @@
     background: #fbfbfb;
     }
 #privacy.private {
-      background: url(/@@/private-bg) top left repeat-x; /* 8px high */
-      padding-top: 12px; /* = 8px + the usual 4px top padding */
+    background: url(/@@/private-bg) top left repeat-x; /* 8px high */
+    padding-top: 12px; /* = 8px + the usual 4px top padding */
+    }
+/* Override for when the feature flag is active */
+.feature-flag-bugs-private-notification-enabled #privacy.private {
+    background-image: none;
+    background-color: #FBFBFB;
+    padding-top: 0.5em;
     }
 .downloads li {
     margin: 0;
@@ -2110,6 +2117,10 @@
     background-image: url(/@@/private.png); /* sprite-ref: icon-sprites */
     background-repeat: no-repeat;
     }
+/* Override for when the feature flag is active */
+.feature-flag-bugs-private-notification-enabled.private {
+    background-image: none;
+    }
 .meeting {
     background-image: url(/@@/meeting.png); /* sprite-ref: icon-sprites */
     background-repeat: no-repeat;
@@ -2340,6 +2351,75 @@
     background-image: url(/@@/trash-logo.png); /* sprite-ref: icon-sprites */
     background-repeat: no-repeat;
     }
+.notification-private {
+    background-image: url(/@@/notification-private.png); /* sprite-ref: icon-sprites */
+    background-repeat: no-repeat;
+    }
+.notification-close {
+    background-image: url(/@@/notification-close.png); /* sprite-ref: icon-sprites */
+    background-repeat: no-repeat;
+    }
+
+
+/* ====================
+   Global notifications
+*/
+/* Move the content down so the notification banner doesn't hide any content. */
+body.global-notification-visible {
+    padding-top: 40px;
+    }
+body.global-notification-visible .login-logout {
+    top: 45px;
+    }
+.global-notification {
+    position: fixed;
+    z-index: 10;
+    top: 0;
+    left: 0;
+    right: 0;
+    padding: 8px 20px;
+    /* Define colour for browsers that don't support transparency */
+    background-color: #8d1f1f;
+    /* Set transparent background for browsers that support it */
+    background-color: rgba(125,0,0,0.9);
+    color: #fff;
+    text-shadow: 0 -1px 0 #631616;
+    font-size: 14px;
+    line-height: 21px;
+    font-weight: bold;
+    -moz-box-shadow: 0 0 5px #333;
+    -webkit-box-shadow: 0 0 5px #333;
+    box-shadow: 0 0 5px #333;
+    }
+.global-notification .sprite.notification-private {
+    float: left;
+    display: inline-block;
+    height: 21px;
+    width: 20px;
+    margin-right: 10px;
+    padding: 0;
+    }
+.global-notification-close, .global-notification-close:active,
+.global-notification-close:visited {
+    color: #e47a7a;
+    }
+.global-notification-close {
+    display: block;
+    position: absolute;
+    top: 11px;
+    right: 20px;
+    font-size: 12px;
+    font-weight: normal;
+    line-height: 14px;
+    }
+.global-notification-close .sprite.notification-close {
+    float: right;
+    display: block;
+    height: 9px;
+    width: 8px;
+    margin: 3px 0 0 7px;
+    padding: 0;
+    }
 
 
 /*

=== added file 'lib/canonical/launchpad/images/notification-close.png'
Binary files lib/canonical/launchpad/images/notification-close.png	1970-01-01 00:00:00 +0000 and lib/canonical/launchpad/images/notification-close.png	2011-03-14 06:11:25 +0000 differ
=== added file 'lib/canonical/launchpad/images/notification-private.png'
Binary files lib/canonical/launchpad/images/notification-private.png	1970-01-01 00:00:00 +0000 and lib/canonical/launchpad/images/notification-private.png	2011-03-14 06:11:25 +0000 differ
=== modified file 'lib/lp/bugs/templates/bugtask-index.pt'
--- lib/lp/bugs/templates/bugtask-index.pt	2011-02-25 22:09:46 +0000
+++ lib/lp/bugs/templates/bugtask-index.pt	2011-03-14 06:11:25 +0000
@@ -69,6 +69,67 @@
     </metal:heading>
 
     <div metal:fill-slot="main" tal:define="context_menu context/menu:context">
+      <tal:if condition="context/bug/private">
+        <tal:if condition="request/features/bugs.private_notification.enabled">
+            <script type="text/javascript">
+                LPS.use('anim-base', function(Y) {
+                  Y.on('domready', function() {
+                      /* Set a temporary class on the body for the feature flag,
+                         this is because we have no way to use feature flags in
+                         css directly. This should be remove if the feature
+                         is accepted. */
+                      Y.one('body').addClass('feature-flag-bugs-private-notification-enabled');
+                      /* Set the visible flag so that the content moves down. */
+                      Y.one('body').addClass('global-notification-visible');
+                      var fade_out = new Y.Anim({
+                          node: '.global-notification',
+                          to: {opacity: 0},
+                          duration: 0.3
+                      });
+                      var body_space = new Y.Anim({
+                          node: 'body',
+                          to: {'padding-top': 0},
+                          duration: 0.2,
+                          easing: Y.Easing.easeOut
+                      });
+                      var login_space = new Y.Anim({
+                          node: '.login-logout',
+                          to: {'top': '6px'},
+                          duration: 0.2,
+                          easing: Y.Easing.easeOut
+                      });
+                      var portlet = Y.one('.portlet.private');
+                      var portlet_colour = new Y.Anim({
+                          node: portlet,
+                          to: {
+                              color: '#fff',
+                              backgroundColor:'#8d1f1f'
+                          },
+                          duration: 0.4,
+                      });
+                      fade_out.on('end', function() {
+                          fade_out.get('node').addClass('hidden');
+                      });
+                      Y.on('click', function(e) {
+                          e.halt();
+                          fade_out.run();
+                          body_space.run();
+                          login_space.run();
+                          portlet_colour.run();
+                      }, '.global-notification-close');
+                  });
+                });
+            </script>
+            <div class="global-notification" tal:condition="request/features/bugs.private_notification.enabled">
+              <span class="sprite notification-private"></span>
+              This bug is private
+              <a href="#" class="global-notification-close">
+                <span class="sprite notification-close"></span>
+                Hide
+              </a>
+            </div>
+        </tal:if>
+      </tal:if>
       <div id="tags-autocomplete">
        <div id="tags-autocomplete-content"></div>
       </div>

=== modified file 'lib/lp/services/features/flags.py'
--- lib/lp/services/features/flags.py	2011-03-11 12:27:31 +0000
+++ lib/lp/services/features/flags.py	2011-03-14 06:11:25 +0000
@@ -85,6 +85,10 @@
      'boolean',
      'Shows the server-side page render time in the login widget.',
      ''),
+    ('bugs.private_notification.enabled',
+     'boolean',
+     'Changes the appearance of notifications on private bugs.',
+     ''),
     ])
 
 # The set of all flag names that are documented.


Follow ups