Merge lp:~ya-bo-ng/juju-gui/linkify-charm-descriptions into lp:juju-gui/experimental

Proposed by Anthony Dillon
Status: Merged
Merged at revision: 1182
Proposed branch: lp:~ya-bo-ng/juju-gui/linkify-charm-descriptions
Merge into: lp:juju-gui/experimental
Diff against target: 102 lines (+34/-7)
3 files modified
app/subapps/browser/templates/browser_charm.handlebars (+3/-3)
app/subapps/browser/views/charm.js (+30/-4)
lib/views/browser/charm-full.less (+1/-0)
To merge this branch: bzr merge lp:~ya-bo-ng/juju-gui/linkify-charm-descriptions
Reviewer Review Type Date Requested Status
Juju GUI Hackers Pending
Review via email: mp+192852@code.launchpad.net

Description of the change

Fixes word wrapping in charm description.

Removed respect-whitespace class from entire description and commits and only applied it to links and launchpad branches.

To post a comment you must log in.
1158. By Huw Wilkins

Remove old inspector styles

We had all the styles from the old inspector left in the stylesheet. I've merged the few styles that were being used by the new inspector.

One change that will be difference after the removal is that the font weight should now be 300 instead of 400. This was a change confirmed with Luca and Spencer that 300 is the correct weight.

R=
CC=
https://codereview.appspot.com/17470043

1159. By Huw Wilkins

Big CSS cleanup

Apologies for the size of this branch.

In this branch:
Moved mixins to own file.
Removed old @vars and those only used once (no need for them to remain a var).
Removed classes that are no longer being used.
Added comments to classes.
Changed remaining font sizes to use px (to be consistent with the web team).
Added some documentation on class ordering.
Redesigned login/connecting to juju/unsupported browser notice to fit with the current GUI style.

R=jeff.pihach
CC=
https://codereview.appspot.com/18970043

1160. By Huw Wilkins

Fix fullscreen bundles

The fullscreen bundles page was quite broken. Added the appropriate classes to make it work.

R=jeff.pihach
CC=
https://codereview.appspot.com/18980043

1161. By Jeff Pihach

Add Deploy tab to bundle details view

Also adds:
bundle location into bundle details view header
bzr branch command to Code tab
moved the Readme tab to the second tab spot as per UX

R=bac
CC=
https://codereview.appspot.com/18630045

1162. By Jeff Pihach

Adds confirmation to bundle deploy

When clicking the 'add to canvas' button in the bundle
details page it will now show a notification above the
button and require an additional click on the button
which now reads, 'Yes, I'm sure'.

R=gary.poster
CC=
https://codereview.appspot.com/19570043

1163. By Huw Wilkins

Remove "charms" from section titles

With the addition of bundles the section headers no longer make sense. Under the feature flag that adds bundles I've removed "charms" from the titles in the browser.

R=jeff.pihach
CC=
https://codereview.appspot.com/18950044

1164. By Huw Wilkins

More sprite and CSS cleanups

Moved images that are only used via background-image out of the sprites folder.
Changed some images to be used as sprites.
Removed some unused images.
Added a new mixin to handle using sprites for hover.
Removed some CSS that is no longer being used.
Cleaned up a little CSS for the sake of file size.
Removed old slider images from the Makefile as they were no longer being used.
Drive-by fix for bug #1245907 where extra scrollbars where appearing in the ghost inspector.

R=
CC=
https://codereview.appspot.com/19700044

1165. By Brad Crittenden

Show bundle change log.

Other changes:
 * Change date format for charm and bundle change logs to be like 2013-10-31.
 * Lots of drive-by typo fixes. Sorry for the noise but I cannot help myself.

R=jeff.pihach, benji
CC=
https://codereview.appspot.com/19380044

1166. By Richard Harding

Provide a 'deploy' button in quicksearch results.

- Add the control to the tokens for both charms and bundles
- Wire up a new event that the search widget can fire EVT_DEPLOY
- Make views that extend view.js (fullscree/sidebar) watch for that event and
build a proper deploy command.
- Make sure those views get access to the deploy and bundleDeploy helpers from
the browser.js
- Deploying does not actual perform a selection so no search or details takes
place. It's an alternate behavior for quicksearch.

Several drive-by fixes for things. Documented in the reviewer comments.

QA:

The button is feature flagged due to the fact that this quick deploy doesn't
involve the charm cache and causes the inspector to 'hang' for a sec when you
hit the deploy button. It's not an ideal experience.

http://gui:8888/:flags:/searchDeploy

Search for apa and then click on the + next to apache2. It should deploy to
the canvas. No text is in the quicksearch box, no charm highlighted, etc.

You can also QA this with a bundle.

http://gui:8888/:flags:/searchDeploy/charmworldv3/

Now enter "TestB" and get the TestBundle result. Press the + to deploy the
bundle.

R=gary.poster, jeff.pihach
CC=
https://codereview.appspot.com/18920045

1167. By Anthony Dillon

Merged with live and resolved conflicts

1168. By Anthony Dillon

Fixed the QA issue

Revision history for this message
Gary Poster (gary) wrote :

This is a great idea, and I have been struggling with how to include it without introducing new XSS vectors. I think it can be done, but it takes more time than I have now.

Revision history for this message
Gary Poster (gary) wrote :

I ran with this in a bit of an obsession: https://codereview.appspot.com/22200045

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'app/subapps/browser/templates/browser_charm.handlebars'
2--- app/subapps/browser/templates/browser_charm.handlebars 2013-10-30 13:11:05 +0000
3+++ app/subapps/browser/templates/browser_charm.handlebars 2013-10-30 15:20:50 +0000
4@@ -101,7 +101,7 @@
5 <p><em>This is a local charm; only limited information will be available</em></p>
6 {{/if}}
7 <h2>Description</h2>
8- <p class="respect-whitespace">{{#if isFullscreen}}{{ description }}{{else}}{{ truncate description 300 }}{{/if}}</p>
9+ <p>{{#if isFullscreen}}{{{ description }}}{{else}}{{{ truncate description 300 }}}{{/if}}</p>
10 </div>
11
12 <div class="changelog">
13@@ -127,7 +127,7 @@
14 {{prettyCommits.first.prettyDate}}
15 </span>
16 <strong>{{prettyCommits.first.author.name}}</strong>
17- <span class="respect-whitespace">{{prettyCommits.first.message}}</span> -
18+ <span>{{{prettyCommits.first.message}}}</span> -
19 <a href="{{ prettyCommits.first.revnoLink }}">
20 REVNO{{prettyCommits.first.revno}}
21 </a>
22@@ -146,7 +146,7 @@
23 {{prettyDate}}
24 </span>
25 <strong>{{author.name}}</strong>
26- <span class="respect-whitespace">{{message}}</span> -
27+ <span>{{{message}}}</span> -
28 <a href="{{ revnoLink }}">
29 REVNO{{revno}}
30 </a>
31
32=== modified file 'app/subapps/browser/views/charm.js'
33--- app/subapps/browser/views/charm.js 2013-10-30 13:23:16 +0000
34+++ app/subapps/browser/views/charm.js 2013-10-30 15:20:50 +0000
35@@ -340,10 +340,13 @@
36 if (Y.Object.isEmpty(templateData.provides)) {
37 templateData.provides = false;
38 }
39-
40+ // Wrap plain text links in descriptions and commit messages with a tags
41+ templateData.description = this.Linkify(templateData.description);
42+ templateData.recentCommits.forEach(function(commit) {
43+ commit.message = this.Linkify(commit.message);
44+ }, this);
45 var template = this.template(templateData);
46-
47- // Set the content then update the container so that it reloads
48+ // Set the content then update the container so that it reload
49 // events.
50 var renderTo = this.get('renderTo');
51 renderTo.setHTML(container.setHTML(template));
52@@ -375,6 +378,30 @@
53 },
54
55 /**
56+ Sanitize links.
57+
58+ Linkify links in the plain text descriptions and commit messages.
59+ Wrap launchpad branch locations in spans to wrap them.
60+
61+ @method Linkify
62+ */
63+ Linkify: function(text) {
64+ if (text) {
65+ // Wraps an a tag around links.
66+ var links =
67+ /(\b(https?|http):\/\/[-A-Za-z0-9+&@#\/%?=~_()|!:,.;]*[-A-Za-z0-9+&@#\/%=~_()|]+)/ig;
68+ text = text.replace(links,
69+ '<a href="$1" target="_blank" class="respect-whitespace">$1</a>');
70+
71+ // Puts lp branch addresses in spans with respect-whitespace
72+ var lp_links = /(\b(lp:~)[^ ]*[0-9A-Za-z_]+)/ig;
73+ text = text.replace(lp_links,
74+ '<span class="respect-whitespace">$1</span>');
75+ }
76+ return text;
77+ },
78+
79+ /**
80 Render out the view to the DOM.
81
82 The View might be given either a entityId, which means go fetch the
83@@ -387,7 +414,6 @@
84 render: function() {
85 var isFullscreen = this.get('isFullscreen');
86 this.showIndicator(this.get('renderTo'));
87-
88 if (this.get('entity')) {
89 this._renderCharmView(this.get('entity'), isFullscreen);
90 this.hideIndicator(this.get('renderTo'));
91
92=== modified file 'lib/views/browser/charm-full.less'
93--- lib/views/browser/charm-full.less 2013-10-30 12:54:32 +0000
94+++ lib/views/browser/charm-full.less 2013-10-30 15:20:50 +0000
95@@ -180,6 +180,7 @@
96 #bws-summary,
97 #bws-readme {
98 padding-top: 10px;
99+ padding-bottom: 50px;
100 }
101 #bws-readme {
102 ul {

Subscribers

People subscribed via source and target branches