launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #08605
[Merge] lp:~sinzui/launchpad/unlock-sprite into lp:launchpad
Curtis Hovey has proposed merging lp:~sinzui/launchpad/unlock-sprite into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #246964 in Launchpad itself: "The privacy/security portlet should use lock icons"
https://bugs.launchpad.net/launchpad/+bug/246964
For more details, see:
https://code.launchpad.net/~sinzui/launchpad/unlock-sprite/+merge/109206
Pre-implementation: purple squad
The information type portlet could show a lock icon to re-enforce the
lock shown in privacy banner. This branch adds the public lock icon that
was provided by mpt many years ago. Sorry about the svg in the diff :(
--------------------------------------------------------------------
RULES
* Update the mixin view to provide the needed css to show the two locks.
* Update the template to use the view's css.
* Update the change information success handler to replace the css classes
to match the new state.
QA
* Visit https://bugs.qastaging.launchpad.net/launchpad/+bug/246964
* Verify you see the unlocked public icon at the start of the information
type portlet.
* Change the bug to embargoed security.
* Verify you see the locked private icon at the start of the information
type portlet when the privacy banner appears.
See http://people.canonical.com/~curtis/public-information-type.png
and http://people.canonical.com/~curtis/private-information-type.png
LINT
lib/canonical/launchpad/icing/inline-sprites-1.css.in
lib/canonical/launchpad/icing/css/base.css
lib/canonical/launchpad/images/public.png
lib/canonical/launchpad/images/src/public.svg
lib/lp/app/browser/informationtype.py
lib/lp/bugs/browser/tests/test_bugview.py
lib/lp/bugs/javascript/information_type_choice.js
lib/lp/bugs/javascript/tests/test_information_type_choice.html
lib/lp/bugs/javascript/tests/test_information_type_choice.js
lib/lp/bugs/templates/bug-portlet-privacy.pt
lib/lp/code/templates/branch-portlet-privacy.pt
^ There is some formatting issues in the CSS that I can fix after the
review.
TEST
./bin/test -vvc -t information_type lp.bugs.browser.tests.test_bugview
./bin/test -vvc -t information_type lp.bugs.tests.test_yuitests
IMPLEMENTATION
Added the images attached to the bug:
lib/canonical/launchpad/images/public.png
lib/canonical/launchpad/images/src/public.svg
Added a sprite for public. Added a rule to not show the sprite on the body
element -- seeing that was quite a surprise as I was testing.
lib/canonical/launchpad/icing/inline-sprites-1.css.in
lib/canonical/launchpad/icing/css/base.css
Added information_type_css to InformationTypeViewMixin to provide the CSS
that matches the current aretefact state. The icon is shown at the start
of the portlet as the lock was shown in the original portlet.
lib/lp/app/browser/informationtype.py
lib/lp/bugs/browser/tests/test_bugview.py
lib/lp/bugs/templates/bug-portlet-privacy.pt
lib/lp/code/templates/branch-portlet-privacy.pt
Updated the success handler to replace the public or private class in the
portlet to match what happens with the privacy banner is updated.
lib/lp/bugs/javascript/information_type_choice.js
lib/lp/bugs/javascript/tests/test_information_type_choice.html
lib/lp/bugs/javascript/tests/test_information_type_choice.js
--
https://code.launchpad.net/~sinzui/launchpad/unlock-sprite/+merge/109206
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~sinzui/launchpad/unlock-sprite into lp:launchpad.
=== modified file 'lib/canonical/launchpad/icing/css/base.css'
--- lib/canonical/launchpad/icing/css/base.css 2012-05-17 21:04:18 +0000
+++ lib/canonical/launchpad/icing/css/base.css 2012-06-07 18:16:23 +0000
@@ -4,7 +4,7 @@
line-height: 18px; /* The same as the sprite height. */
color: #333;
}
-body.private {
+body.private, body.public {
/* It must be obvious to the user that the context is private */
background-image: none;
}
=== modified file 'lib/canonical/launchpad/icing/inline-sprites-1.css.in'
--- lib/canonical/launchpad/icing/inline-sprites-1.css.in 2012-06-02 03:10:14 +0000
+++ lib/canonical/launchpad/icing/inline-sprites-1.css.in 2012-06-07 18:16:23 +0000
@@ -277,6 +277,10 @@
background-image: url(/@@/private.png); /* sprite-ref: icon-sprites */
background-repeat: no-repeat;
}
+.public {
+ background-image: url(/@@/public.png); /* sprite-ref: icon-sprites */
+ background-repeat: no-repeat;
+ }
.meeting {
background-image: url(/@@/meeting.png); /* sprite-ref: icon-sprites */
background-repeat: no-repeat;
=== added file 'lib/canonical/launchpad/images/public.png'
Binary files lib/canonical/launchpad/images/public.png 1970-01-01 00:00:00 +0000 and lib/canonical/launchpad/images/public.png 2012-06-07 18:16:23 +0000 differ
=== added file 'lib/canonical/launchpad/images/src/public.svg'
--- lib/canonical/launchpad/images/src/public.svg 1970-01-01 00:00:00 +0000
+++ lib/canonical/launchpad/images/src/public.svg 2012-06-07 18:16:23 +0000
@@ -0,0 +1,141 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 13.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 14948) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="78px" height="53px" viewBox="0 0 78 53" enable-background="new 0 0 78 53" xml:space="preserve">
+<g>
+ <defs>
+ <path id="SVGID_1_" d="M52.937,35.938c-0.553,0-0.999-0.447-0.999-1v-2.905c0-0.012,0-0.021,0-0.032c0.037-1.205,0.875-3,3.031-3
+ H57c0.006,0,0.014,0,0.021,0c1.209,0.025,2.511,0.661,2.511,2.001c0,0.304-0.139,0.592-0.376,0.78l-0.782,0.625
+ c-0.18,0.146-0.4,0.219-0.624,0.219c-0.121,0-0.242-0.021-0.358-0.065c-0.262-0.101-0.466-0.306-0.568-0.56
+ c-0.247,0-1.77,0-1.823,0c0,0.062,0,2.938,0,2.938c0,0.553-0.447,1-1,1H52.937"/>
+ </defs>
+ <clipPath id="SVGID_2_">
+ <use xlink:href="#SVGID_1_" overflow="visible"/>
+ </clipPath>
+ <g clip-path="url(#SVGID_2_)">
+ <defs>
+ <rect id="SVGID_3_" width="78" height="53"/>
+ </defs>
+ <clipPath id="SVGID_4_">
+ <use xlink:href="#SVGID_3_" overflow="visible"/>
+ </clipPath>
+
+ <image overflow="visible" clip-path="url(#SVGID_4_)" width="78" height="53" xlink:href="data:image/jpeg;base64,/9j/4AAQSkZJRgABAgEASABIAAD/7AARRHVja3kAAQAEAAAAHgAA/+4AIUFkb2JlAGTAAAAAAQMA
+EAMCAwYAAAGDAAABjgAAAa//2wCEABALCwsMCxAMDBAXDw0PFxsUEBAUGx8XFxcXFx8eFxoaGhoX
+Hh4jJSclIx4vLzMzLy9AQEBAQEBAQEBAQEBAQEABEQ8PERMRFRISFRQRFBEUGhQWFhQaJhoaHBoa
+JjAjHh4eHiMwKy4nJycuKzU1MDA1NUBAP0BAQEBAQEBAQEBAQP/CABEIADUATgMBIgACEQEDEQH/
+xABfAAEBAQAAAAAAAAAAAAAAAAAABgcBAQAAAAAAAAAAAAAAAAAAAAAQAQEAAAAAAAAAAAAAAAAA
+AEBgEQEAAAAAAAAAAAAAAAAAAABgEgEAAAAAAAAAAAAAAAAAAABA/9oADAMBAAIRAxEAAADQAAAA
+AAAIG+gQBfQN8AAIG+gQBfQN8AAAAAf/2gAIAQIAAQUAJ//aAAgBAwABBQAn/9oACAEBAAEFAIb/
+2gAIAQICBj8AJ//aAAgBAwIGPwAn/9oACAEBAQY/AA3/2Q==">
+ </image>
+ </g>
+</g>
+<g>
+ <defs>
+ <path id="SVGID_5_" d="M56.969,31.001h-2c0,0-0.97,0-0.97,0.968v2.969h-1.062v-2.905c0,0,0.063-2.032,2.032-2.032H57
+ c0,0,1.531,0.031,1.531,1.001l-0.782,0.625C57.749,31.626,57.656,31.062,56.969,31.001z"/>
+ </defs>
+ <clipPath id="SVGID_6_">
+ <use xlink:href="#SVGID_5_" overflow="visible"/>
+ </clipPath>
+ <g clip-path="url(#SVGID_6_)">
+ <defs>
+ <rect id="SVGID_7_" width="78" height="53"/>
+ </defs>
+ <clipPath id="SVGID_8_">
+ <use xlink:href="#SVGID_7_" overflow="visible"/>
+ </clipPath>
+
+ <image overflow="visible" clip-path="url(#SVGID_8_)" width="78" height="53" xlink:href="data:image/jpeg;base64,/9j/4AAQSkZJRgABAgEASABIAAD/7AARRHVja3kAAQAEAAAAHgAA/+4AIUFkb2JlAGTAAAAAAQMA
+EAMCAwYAAAGPAAABpAAAAcj/2wCEABALCwsMCxAMDBAXDw0PFxsUEBAUGx8XFxcXFx8eFxoaGhoX
+Hh4jJSclIx4vLzMzLy9AQEBAQEBAQEBAQEBAQEABEQ8PERMRFRISFRQRFBEUGhQWFhQaJhoaHBoa
+JjAjHh4eHiMwKy4nJycuKzU1MDA1NUBAP0BAQEBAQEBAQEBAQP/CABEIADUATgMBIgACEQEDEQH/
+xABpAAEBAQEBAAAAAAAAAAAAAAAABQYCBwEBAAAAAAAAAAAAAAAAAAAAABAAAgMBAQAAAAAAAAAA
+AAAAABFAAhIgUBEBAQEBAAAAAAAAAAAAAAAAMQBAUBIBAAAAAAAAAAAAAAAAAAAAQP/aAAwDAQAC
+EQMRAAAA9AAAAAAAAlVZQAqyqoAAz2hzh05HWhzmjAAAAAP/2gAIAQIAAQUAif/aAAgBAwABBQCJ
+/9oACAEBAAEFAPDYxj73c3c3c3eN/9oACAECAgY/ACf/2gAIAQMCBj8AJ//aAAgBAQEGPwDmszOb
+/9k=">
+ </image>
+ </g>
+</g>
+<g>
+ <defs>
+ <rect id="SVGID_9_" x="51" y="34.031" width="9.969" height="7.938"/>
+ </defs>
+ <clipPath id="SVGID_10_">
+ <use xlink:href="#SVGID_9_" overflow="visible"/>
+ </clipPath>
+ <g clip-path="url(#SVGID_10_)">
+ <defs>
+ <rect id="SVGID_11_" width="78" height="53"/>
+ </defs>
+ <clipPath id="SVGID_12_">
+ <use xlink:href="#SVGID_11_" overflow="visible"/>
+ </clipPath>
+
+ <image overflow="visible" clip-path="url(#SVGID_12_)" width="78" height="53" xlink:href="data:image/jpeg;base64,/9j/4AAQSkZJRgABAgEASABIAAD/7AARRHVja3kAAQAEAAAAHgAA/+4AIUFkb2JlAGTAAAAAAQMA
+EAMCAwYAAAGFAAABkAAAAbH/2wCEABALCwsMCxAMDBAXDw0PFxsUEBAUGx8XFxcXFx8eFxoaGhoX
+Hh4jJSclIx4vLzMzLy9AQEBAQEBAQEBAQEBAQEABEQ8PERMRFRISFRQRFBEUGhQWFhQaJhoaHBoa
+JjAjHh4eHiMwKy4nJycuKzU1MDA1NUBAP0BAQEBAQEBAQEBAQP/CABEIADUATgMBIgACEQEDEQH/
+xABfAAEBAQAAAAAAAAAAAAAAAAAABgcBAQAAAAAAAAAAAAAAAAAAAAAQAQEAAAAAAAAAAAAAAAAA
+AEBgEQEAAAAAAAAAAAAAAAAAAABgEgEAAAAAAAAAAAAAAAAAAABA/9oADAMBAAIRAxEAAADQAAAA
+AAACBL5Ai+QN8AAIG+gQBfQN8AAIEAF8H//aAAgBAgABBQAn/9oACAEDAAEFACf/2gAIAQEAAQUA
+hv/aAAgBAgIGPwAn/9oACAEDAgY/ACf/2gAIAQEBBj8ADf/Z">
+ </image>
+ </g>
+</g>
+<g>
+ <defs>
+ <rect id="SVGID_13_" x="52" y="34.97" width="8" height="5.999"/>
+ </defs>
+ <clipPath id="SVGID_14_">
+ <use xlink:href="#SVGID_13_" overflow="visible"/>
+ </clipPath>
+ <g clip-path="url(#SVGID_14_)">
+ <defs>
+ <rect id="SVGID_15_" width="78" height="53"/>
+ </defs>
+ <clipPath id="SVGID_16_">
+ <use xlink:href="#SVGID_15_" overflow="visible"/>
+ </clipPath>
+
+ <image overflow="visible" clip-path="url(#SVGID_16_)" width="78" height="53" xlink:href="data:image/jpeg;base64,/9j/4AAQSkZJRgABAgEASABIAAD/7AARRHVja3kAAQAEAAAAHgAA/+4AIUFkb2JlAGTAAAAAAQMA
+EAMCAwYAAAGNAAABoAAAAcT/2wCEABALCwsMCxAMDBAXDw0PFxsUEBAUGx8XFxcXFx8eFxoaGhoX
+Hh4jJSclIx4vLzMzLy9AQEBAQEBAQEBAQEBAQEABEQ8PERMRFRISFRQRFBEUGhQWFhQaJhoaHBoa
+JjAjHh4eHiMwKy4nJycuKzU1MDA1NUBAP0BAQEBAQEBAQEBAQP/CABEIADUATgMBIgACEQEDEQH/
+xABnAAEBAQEBAAAAAAAAAAAAAAAABAUGBwEBAAAAAAAAAAAAAAAAAAAAABAAAwEBAAAAAAAAAAAA
+AAAAAAMUQFARAQEBAQAAAAAAAAAAAAAAADEAQFASAQAAAAAAAAAAAAAAAAAAAED/2gAMAwEAAhED
+EQAAAPQAAAAAAACEuQi5DcAAMjX5E12QNfX5HrgAAAAD/9oACAECAAEFAMn/2gAIAQMAAQUAyf/a
+AAgBAQABBQDm2qLVFqi1Wb//2gAIAQICBj8AJ//aAAgBAwIGPwAn/9oACAEBAQY/AOazM5v/2Q==">
+ </image>
+ </g>
+</g>
+<g>
+ <defs>
+ <rect id="SVGID_17_" x="52.977" y="35.958" width="5.984" height="4.021"/>
+ </defs>
+ <clipPath id="SVGID_18_">
+ <use xlink:href="#SVGID_17_" overflow="visible"/>
+ </clipPath>
+ <g clip-path="url(#SVGID_18_)">
+ <defs>
+ <rect id="SVGID_19_" width="78" height="53"/>
+ </defs>
+ <clipPath id="SVGID_20_">
+ <use xlink:href="#SVGID_19_" overflow="visible"/>
+ </clipPath>
+
+ <image overflow="visible" clip-path="url(#SVGID_20_)" width="78" height="53" xlink:href="data:image/jpeg;base64,/9j/4AAQSkZJRgABAgEASABIAAD/7AARRHVja3kAAQAEAAAAHgAA/+4AIUFkb2JlAGTAAAAAAQMA
+EAMCAwYAAAGOAAABoQAAAcX/2wCEABALCwsMCxAMDBAXDw0PFxsUEBAUGx8XFxcXFx8eFxoaGhoX
+Hh4jJSclIx4vLzMzLy9AQEBAQEBAQEBAQEBAQEABEQ8PERMRFRISFRQRFBEUGhQWFhQaJhoaHBoa
+JjAjHh4eHiMwKy4nJycuKzU1MDA1NUBAP0BAQEBAQEBAQEBAQP/CABEIADUATgMBIgACEQEDEQH/
+xABmAAEBAQEAAAAAAAAAAAAAAAAABgcFAQEAAAAAAAAAAAAAAAAAAAAAEAADAQEAAAAAAAAAAAAA
+AAAAAxRAUBEBAQEBAAAAAAAAAAAAAAAAMQBAUBIBAAAAAAAAAAAAAAAAAAAAQP/aAAwDAQACEQMR
+AAAA0AAAAAAAAjCzRgs0ZZgACFuszOk5o6V1memAAAAAH//aAAgBAgABBQDJ/9oACAEDAAEFAMn/
+2gAIAQEAAQUA5tiSxJYksTm//9oACAECAgY/ACf/2gAIAQMCBj8AJ//aAAgBAQEGPwDmszOb/9k=">
+ </image>
+ </g>
+</g>
+</svg>
=== modified file 'lib/lp/app/browser/informationtype.py'
--- lib/lp/app/browser/informationtype.py 2012-06-01 05:11:24 +0000
+++ lib/lp/app/browser/informationtype.py 2012-06-07 18:16:23 +0000
@@ -62,3 +62,10 @@
'Visible only to users with whom the project has '
'shared private information.')
return description
+
+ @property
+ def information_type_css(self):
+ if self.context.information_type in PRIVATE_INFORMATION_TYPES:
+ return 'sprite private'
+ else:
+ return 'sprite public'
=== modified file 'lib/lp/bugs/browser/tests/test_bugview.py'
--- lib/lp/bugs/browser/tests/test_bugview.py 2012-06-02 13:52:34 +0000
+++ lib/lp/bugs/browser/tests/test_bugview.py 2012-06-07 18:16:23 +0000
@@ -67,6 +67,14 @@
self.bug.information_type.description,
self.view.information_type_description)
+ def test_information_type_css_class(self):
+ self.bug.transitionToInformationType(
+ InformationType.USERDATA, self.bug.owner)
+ self.assertEqual('sprite private', self.view.information_type_css)
+ self.bug.transitionToInformationType(
+ InformationType.UNEMBARGOEDSECURITY, self.bug.owner)
+ self.assertEqual('sprite public', self.view.information_type_css)
+
def test_userdata_shown_as_private(self):
# When the display_userdata_as_private feature flag is enabled, the
# information_type is shown as 'Private'.
=== modified file 'lib/lp/bugs/javascript/information_type_choice.js'
--- lib/lp/bugs/javascript/information_type_choice.js 2012-06-05 08:10:16 +0000
+++ lib/lp/bugs/javascript/information_type_choice.js 2012-06-07 18:16:23 +0000
@@ -65,6 +65,7 @@
namespace.information_type_save_success = function(value) {
var body = Y.one('body');
+ var summary = Y.one('#information-type-summary');
var private_type = (Y.Array.indexOf(LP.cache.private_types, value) >= 0);
var subscription_ns = Y.lp.bugs.bugtask_index.portlets.subscription;
var privacy_banner = Y.lp.app.banner.privacy.getPrivacyBanner();
@@ -72,9 +73,11 @@
if (private_type) {
var banner_text = namespace.get_information_type_banner_text(value);
privacy_banner.updateText(banner_text);
+ summary.replaceClass('public', 'private');
body.replaceClass('public', 'private');
privacy_banner.show();
} else {
+ summary.replaceClass('private', 'public');
body.replaceClass('private', 'public');
privacy_banner.hide();
}
=== modified file 'lib/lp/bugs/javascript/tests/test_information_type_choice.html'
--- lib/lp/bugs/javascript/tests/test_information_type_choice.html 2012-06-05 08:10:16 +0000
+++ lib/lp/bugs/javascript/tests/test_information_type_choice.html 2012-06-07 18:16:23 +0000
@@ -90,7 +90,11 @@
<script type="text/x-template" id="portlet-template">
<div id="privacy">
<div id="privacy-text">
- This report contains <strong id="information-type">Public</strong> information
+ <span id="information-type-summary" class="sprite public">
+ This report contains
+ <strong id="information-type">Public</strong>
+ information
+ </span>
<a class="sprite edit" id="privacy-link" href="#">edit</a>
<div id='information-type-description'>Everyone can see this information.</div>
</div>
=== modified file 'lib/lp/bugs/javascript/tests/test_information_type_choice.js'
--- lib/lp/bugs/javascript/tests/test_information_type_choice.js 2012-06-05 08:10:16 +0000
+++ lib/lp/bugs/javascript/tests/test_information_type_choice.js 2012-06-07 18:16:23 +0000
@@ -111,8 +111,11 @@
Y.on('test:banner:hide', function() {
flag = true;
});
+ var summary = Y.one('#information-type-summary');
+ summary.replaceClass('public', 'private');
ns.information_type_save_success('Public');
+ Y.Assert.isTrue(summary.hasClass('public'));
var body = Y.one('body');
Y.Assert.isTrue(body.hasClass('public'));
Y.Assert.isTrue(flag);
=== modified file 'lib/lp/bugs/templates/bug-portlet-privacy.pt'
--- lib/lp/bugs/templates/bug-portlet-privacy.pt 2012-06-07 12:21:49 +0000
+++ lib/lp/bugs/templates/bug-portlet-privacy.pt 2012-06-07 18:16:23 +0000
@@ -10,8 +10,12 @@
>
<div id="privacy-text">
<tal:information_type tal:condition="view/show_information_type_in_ui">
- This report contains <strong id="information-type"
- tal:content="view/information_type"></strong> information <a
+ <span id="information-type-summary"
+ tal:attributes="class view/information_type_css;">This report
+ contains
+ <strong id="information-type" tal:content="view/information_type" />
+ information
+ </span> <a
class="sprite edit" id="privacy-link"
tal:attributes="href link/path" tal:condition="link/enabled"></a>
<div id='information-type-description' style='padding-top: 5px'
=== modified file 'lib/lp/code/templates/branch-portlet-privacy.pt'
--- lib/lp/code/templates/branch-portlet-privacy.pt 2012-05-30 05:04:40 +0000
+++ lib/lp/code/templates/branch-portlet-privacy.pt 2012-06-07 18:16:23 +0000
@@ -8,7 +8,9 @@
"
>
<tal:information_type tal:condition="view/show_information_type_in_ui">
- This branch contains <strong id="information-type" tal:content="view/information_type"></strong> information
+ <span id="information-type-summary"
+ tal:attributes="class view/information_type_css;">This branch
+ contains <strong id="information-type" tal:content="view/information_type"></strong> information</span>
<div id='information-type-description' style='padding-top: 5px' tal:content="view/information_type_description"></div>
</tal:information_type>
<tal:privacy tal:condition="not:view/show_information_type_in_ui">
Follow ups