Merge lp:~hatch/juju-gui/linkify-charm-descriptions into lp:juju-gui/experimental

Proposed by Jeff Pihach
Status: Merged
Merged at revision: 1182
Proposed branch: lp:~hatch/juju-gui/linkify-charm-descriptions
Merge into: lp:juju-gui/experimental
Diff against target: 115 lines (+44/-4) (has conflicts)
3 files modified
app/subapps/browser/templates/browser_charm.handlebars (+3/-3)
app/subapps/browser/views/charm.js (+40/-1)
lib/views/browser/charm-full.less (+1/-0)
Text conflict in app/subapps/browser/views/charm.js
To merge this branch: bzr merge lp:~hatch/juju-gui/linkify-charm-descriptions
Reviewer Review Type Date Requested Status
Juju GUI Hackers Pending
Review via email: mp+193254@code.launchpad.net

Description of the change

Linkify links in the charm/bundle details pages

Landing for Ant

https://codereview.appspot.com/19790044/

To post a comment you must log in.
Revision history for this message
Jeff Pihach (hatch) wrote :
Download full text (5.3 KiB)

Reviewers: mp+193254_code.launchpad.net,

Message:
Please take a look.

Description:
Linkify links in the charm/bundle details pages

Landing for Ant

https://code.launchpad.net/~hatch/juju-gui/linkify-charm-descriptions/+merge/193254

(do not edit description out of merge proposal)

Please review this at https://codereview.appspot.com/19790044/

Affected files (+35, -6 lines):
   A [revision details]
   M app/subapps/browser/templates/browser_charm.handlebars
   M app/subapps/browser/views/charm.js
   M lib/views/browser/charm-full.less

Index: [revision details]
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: <email address hidden>
+New revision: <email address hidden>

Index: lib/views/browser/charm-full.less
=== modified file 'lib/views/browser/charm-full.less'
--- lib/views/browser/charm-full.less 2013-10-25 21:31:55 +0000
+++ lib/views/browser/charm-full.less 2013-10-28 10:05:42 +0000
@@ -174,6 +174,7 @@
      #bws-summary,
      #bws-readme {
          padding-top: 10px;
+ padding-bottom: 50px;
      }
      #bws-readme {
          ul {

Index: app/subapps/browser/templates/browser_charm.handlebars
=== modified file 'app/subapps/browser/templates/browser_charm.handlebars'
--- app/subapps/browser/templates/browser_charm.handlebars 2013-10-23
21:10:55 +0000
+++ app/subapps/browser/templates/browser_charm.handlebars 2013-10-28
10:05:42 +0000
@@ -89,7 +89,7 @@
                              <p><em>This is a local charm; only limited
information will be available</em></p>
                          {{/if}}
                          <h2>Description</h2>
- <p class="respect-whitespace">{{#if
isFullscreen}}{{ description }}{{else}}{{ truncate description 300
}}{{/if}}</p>
+ <p>{{#if isFullscreen}}{{{ description
}}}{{else}}{{{ truncate description 300 }}}{{/if}}</p>
                      </div>

                      <div class="changelog">
@@ -115,7 +115,7 @@
                                          {{prettyCommits.first.prettyDate}}
                                      </span>

<strong>{{prettyCommits.first.author.name}}</strong>
- <span
class="respect-whitespace">{{prettyCommits.first.message}}</span> -
+
<span>{{{prettyCommits.first.message}}}</span> -
                                      <a href="{{
prettyCommits.first.revnoLink }}">
                                        REVNO{{prettyCommits.first.revno}}
                                      </a>
@@ -134,7 +134,7 @@
                                                      {{prettyDate}}
                                                  </span>

<strong>{{author.name}}</strong>
- <span
class="respect-whitespace">{{message}}</span> -
+ <span>{{{message}}}</span>
-
             ...

Read more...

Revision history for this message
Jeff Pihach (hatch) wrote :

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 14:25:24 +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 14:25:24 +0000
35@@ -334,6 +334,7 @@
36 templateData.emailText = escape(
37 'Check out this great charm on ' + siteDomain + ': ' + link);
38
39+<<<<<<< TREE
40 if (Y.Object.isEmpty(templateData.requires)) {
41 templateData.requires = false;
42 }
43@@ -344,6 +345,21 @@
44 var template = this.template(templateData);
45
46 // Set the content then update the container so that it reloads
47+=======
48+ if (Y.Object.isEmpty(tplData.requires)) {
49+ tplData.requires = false;
50+ }
51+ if (Y.Object.isEmpty(tplData.provides)) {
52+ tplData.provides = false;
53+ }
54+ // Wrap plain text links in descriptions and commit messages with a tags
55+ tplData.description = this.Linkify(tplData.description);
56+ tplData.recent_commits.forEach(function(commit) {
57+ commit.message = this.Linkify(commit.message);
58+ }, this);
59+ var tpl = this.template(tplData);
60+ // Set the content then update the container so that it reload
61+>>>>>>> MERGE-SOURCE
62 // events.
63 var renderTo = this.get('renderTo');
64 renderTo.setHTML(container.setHTML(template));
65@@ -375,6 +391,30 @@
66 },
67
68 /**
69+ Sanitize links.
70+
71+ Linkify links in the plain text descriptions and commit messages.
72+ Wrap launchpad branch locations in spans to wrap them.
73+
74+ @method Linkify
75+ */
76+ Linkify: function(text) {
77+ if (text) {
78+ // Wraps an a tag around links.
79+ var links =
80+ /(\b(https?|http):\/\/[-A-Za-z0-9+&@#\/%?=~_()|!:,.;]*[-A-Za-z0-9+&@#\/%=~_()|]+)/ig;
81+ text = text.replace(links,
82+ '<a href="$1" target="_blank" class="respect-whitespace">$1</a>');
83+
84+ // Puts lp branch addresses in spans with respect-whitespace
85+ var lp_links = /(\b(lp:~)[^ ]*[0-9A-Za-z_]+)/ig;
86+ text = text.replace(lp_links,
87+ '<span class="respect-whitespace">$1</span>');
88+ }
89+ return text;
90+ },
91+
92+ /**
93 Render out the view to the DOM.
94
95 The View might be given either a entityId, which means go fetch the
96@@ -387,7 +427,6 @@
97 render: function() {
98 var isFullscreen = this.get('isFullscreen');
99 this.showIndicator(this.get('renderTo'));
100-
101 if (this.get('entity')) {
102 this._renderCharmView(this.get('entity'), isFullscreen);
103 this.hideIndicator(this.get('renderTo'));
104
105=== modified file 'lib/views/browser/charm-full.less'
106--- lib/views/browser/charm-full.less 2013-10-30 12:54:32 +0000
107+++ lib/views/browser/charm-full.less 2013-10-30 14:25:24 +0000
108@@ -180,6 +180,7 @@
109 #bws-summary,
110 #bws-readme {
111 padding-top: 10px;
112+ padding-bottom: 50px;
113 }
114 #bws-readme {
115 ul {

Subscribers

People subscribed via source and target branches