Merge lp:~rharding/launchpad/info_portlet_1052551 into lp:launchpad

Proposed by Richard Harding on 2012-10-15
Status: Merged
Approved by: Richard Harding on 2012-10-15
Approved revision: no longer in the source branch.
Merged at revision: 16150
Proposed branch: lp:~rharding/launchpad/info_portlet_1052551
Merge into: lp:launchpad
Diff against target: 85 lines (+26/-18)
4 files modified
lib/lp/blueprints/javascript/addspec.js (+1/-1)
lib/lp/blueprints/templates/blueprint-portlet-privacy.pt (+12/-5)
lib/lp/blueprints/templates/specification-index.pt (+4/-4)
lib/lp/bugs/templates/bug-portlet-privacy.pt (+9/-8)
To merge this branch: bzr merge lp:~rharding/launchpad/info_portlet_1052551
Reviewer Review Type Date Requested Status
Benji York (community) code 2012-10-15 Approve on 2012-10-15
Review via email: mp+129706@code.launchpad.net

Commit Message

Update the JS initialization for the blueprint information type portlet.

Description of the Change

= Summary =

See the bug for details on how users are unable to change the InformationType
on the bluesprints from the portlet.

== Implementation Notes ==

This fixes a couple of manual styles added to the choice widget setup as well
as a missed rename for the javascript method setup_information_type_choice to
setup_choice.

#24 Removes manual display:none set on the Edit action icon.

#47 Removes the manual setting of the icon to display:inline

The rest is mainly some matching of the layout of the HTML to the same thing
in the bug portlet so that I could compare the html and css classes required
to get things to work correctly.

There's also the drive by update of adding the JS module dep lp.app.choice to the addspec.js. It's indirectly gotten from requiring information_type.js, but it does use lp.app.choice directly and should be required as well.

== Q/A ==

When viewing a blueprint you should see the privacy portlet on the right side
and the edit icon should be available to change the information type.

To post a comment you must log in.
Benji York (benji) wrote :

Looks good. A couple of minor points:

It would be nice to fix the long line on line 26 of the diff.

Would it be possible to put the explicit style attributes on line 31 and 79 into a stylesheet?

review: Approve (code)
Richard Harding (rharding) wrote :

> Looks good. A couple of minor points:
>
> It would be nice to fix the long line on line 26 of the diff.

Doh, thanks for the heads up on that.

> Would it be possible to put the explicit style attributes on line 31 and 79
> into a stylesheet?

If there was a true widget with CSS properties I'd definitely move it off. As it is, the best shortcut might be to try to turn the div's into p's of textual content, however they're set to have 0 padding and margin (ugh!).

So for now I'm going to leave this as existing bad code and hope someone gets a change to come behind and do a nice portlet widget with CSS that can be reused rather than stick such a specific rule on #information-type-description which seems just as bad.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/blueprints/javascript/addspec.js'
2--- lib/lp/blueprints/javascript/addspec.js 2012-09-21 15:39:22 +0000
3+++ lib/lp/blueprints/javascript/addspec.js 2012-10-15 23:44:19 +0000
4@@ -17,4 +17,4 @@
5 choice_data);
6 };
7
8-}, "0.1", {"requires": ['lp.app.information_type']});
9+}, "0.1", {"requires": ['lp.app.information_type', 'lp.app.choice']});
10
11=== modified file 'lib/lp/blueprints/templates/blueprint-portlet-privacy.pt'
12--- lib/lp/blueprints/templates/blueprint-portlet-privacy.pt 2012-08-03 19:41:22 +0000
13+++ lib/lp/blueprints/templates/blueprint-portlet-privacy.pt 2012-10-15 23:44:19 +0000
14@@ -6,11 +6,18 @@
15 tal:attributes="class view/privacy_portlet_css"
16 tal:define="link context/menu:context/information_type"
17 >
18+
19+ <div id="privacy-text">
20 <span id="information-type-summary"
21- tal:attributes="class view/information_type_css;">This blueprint
22- contains <strong id="information-type" tal:content="view/information_type"></strong> information</span>&nbsp;<a class="sprite edit action-icon"
23- id="privacy-link" tal:attributes="href link/path"
24- tal:condition="link/enabled" style="display: none" >Edit</a>
25+ tal:attributes="class view/information_type_css;">This blueprint contains
26+ <strong id="information-type" tal:content="view/information_type">
27+ </strong> information</span>&nbsp;<a class="sprite edit action-icon"
28+ id="privacy-link"
29+ tal:attributes="href link/path"
30+ tal:condition="link/enabled">Edit</a>
31
32- <div id="information-type-description" style="padding-top: 5px" tal:content="view/information_type_description"></div>
33+ <div id="information-type-description" style="padding-top: 5px"
34+ tal:content="view/information_type_description">
35+ </div>
36+ </div>
37 </div>
38
39=== modified file 'lib/lp/blueprints/templates/specification-index.pt'
40--- lib/lp/blueprints/templates/specification-index.pt 2012-08-30 18:19:51 +0000
41+++ lib/lp/blueprints/templates/specification-index.pt 2012-10-15 23:44:19 +0000
42@@ -314,10 +314,10 @@
43 'lp.app.information_type', 'node', 'widget', function(Y) {
44 Y.on('domready', function(){
45 var privacy_link = Y.one('#privacy-link');
46- Y.lp.app.information_type.setup_information_type_choice(
47- privacy_link, new Y.lp.client.Launchpad(), LP.cache.context,
48- null);
49- privacy_link.setStyle('display', 'inline');
50+ Y.lp.app.information_type.setup_choice(
51+ privacy_link,
52+ new Y.lp.client.Launchpad(),
53+ LP.cache.context);
54 });
55
56 Y.on('lp:context:implementation_status:changed', function(e) {
57
58=== modified file 'lib/lp/bugs/templates/bug-portlet-privacy.pt'
59--- lib/lp/bugs/templates/bug-portlet-privacy.pt 2012-06-20 05:25:44 +0000
60+++ lib/lp/bugs/templates/bug-portlet-privacy.pt 2012-10-15 23:44:19 +0000
61@@ -9,15 +9,16 @@
62 tal:define="link context/menu:context/visibility"
63 >
64 <div id="privacy-text">
65- <span id="information-type-summary"
66- tal:attributes="class view/information_type_css;">This report
67- contains
68+ <span id="information-type-summary"
69+ tal:attributes="class view/information_type_css;">This report contains
70 <strong id="information-type" tal:content="view/information_type" />
71 information
72- </span>&nbsp;<a class="sprite edit action-icon" id="privacy-link"
73- tal:attributes="href link/path" tal:condition="link/enabled"
74- >Edit</a>
75- <div id="information-type-description" style="padding-top: 5px"
76- tal:content="view/information_type_description"></div>
77+ </span>&nbsp;<a class="sprite edit action-icon" id="privacy-link"
78+ tal:attributes="href link/path" tal:condition="link/enabled"
79+ >Edit</a>
80+
81+ <div id="information-type-description" style="padding-top: 5px"
82+ tal:content="view/information_type_description">
83+ </div>
84 </div>
85 </div>