Merge lp:~rharding/juju-gui/design-updates into lp:juju-gui/experimental
Proposed by
Richard Harding
Status: | Needs review |
---|---|
Proposed branch: | lp:~rharding/juju-gui/design-updates |
Merge into: | lp:juju-gui/experimental |
Diff against target: |
151 lines (+56/-19) 3 files modified
app/subapps/browser/templates/browser_charm.handlebars (+9/-19) app/views/utils.js (+15/-0) test/test_utils.js (+32/-0) |
To merge this branch: | bzr merge lp:~rharding/juju-gui/design-updates |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Juju GUI Hackers | Pending | ||
Review via email: mp+158363@code.launchpad.net |
Description of the change
Adjust design per review, add truncate helper
- Per UX reviews adjust some of the design of the browser
- Add a truncate handlebars helper to aid in fitting content nicely
To post a comment you must log in.
Unmerged revisions
- 598. By Richard Harding
-
Pull in huws changes
Reviewers: mp+158363_ code.launchpad. net,
Message:
Please take a look.
Description:
Adjust design per review, add truncate helper
- Per UX reviews adjust some of the design of the browser
- Add a truncate handlebars helper to aid in fitting content nicely
https:/ /code.launchpad .net/~rharding/ juju-gui/ design- updates/ +merge/ 158363
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/8662043/
Affected files: images/ charm_commits_ icon.jpg images/ charm_downloads _icon.jpg browser/ templates/ browser_ charm.handlebar s
A [revision details]
D app/assets/
D app/assets/
M app/subapps/
M app/views/utils.js
M test/test_utils.js
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: test/test_utils.js utils.js'
assert. equal(' fooi', html);
=== modified file 'test/test_
--- test/test_utils.js 2013-04-10 21:17:18 +0000
+++ test/test_utils.js 2013-04-11 13:11:02 +0000
@@ -599,6 +599,38 @@
});
+ it('truncates a string', function() { compile( source) , compile( source) , compile( source) , compile( source) , 'showStatus' , function() {
+ var source = '{{ truncate text 30 }}',
+ template = Y.Handlebars.
+ context = {text: 'Lorem ipsum dolor sit amet consectetur'},
+ html = template(context);
+ assert.equal('Lorem ipsum dolor sit amet con...', html);
+ });
+
+ it('truncates a string with a trailing space', function() {
+ var source = '{{ truncate text 30 }}',
+ template = Y.Handlebars.
+ context = {text: 'Lorem ipsum dolor sit ametuco sectetur'},
+ html = template(context);
+ assert.equal('Lorem ipsum dolor sit ametuco...', html);
+ });
+
+ it('does not truncate a shorter string', function() {
+ var source = '{{ truncate text 30 }}',
+ template = Y.Handlebars.
+ context = {text: 'Lorem ipsum dolor sit amet'},
+ html = template(context);
+ assert.equal('Lorem ipsum dolor sit amet', html);
+ });
+
+ it('truncate handles an undefined value', function() {
+ var source = '{{ truncate text 30 }}is empty',
+ template = Y.Handlebars.
+ context = {text: undefined},
+ html = template(context);
+ assert.equal('is empty', html);
+ });
+
describe(
var html, obj, template;
Index: app/views/utils.js utils.js'
=== modified file 'app/views/
--- app/views/utils.js 2013-04-10 21:17:18 +0000
+++ app/views/utils.js 2013-04-11 12:47:10 +0000
@@ -1250,6 +1250,21 @@
}
});
+ /** registerHelper( 'truncate' , function(string, length) { trimRight( string. substring( 0, length)) + '...';
+ * Truncate helper to keep text sizes to a specified limit.
+ *
+ * {{truncate field 100}}
+ *
+ */
+ Y.Handlebars.
+ if (string && string.length > length) {
+ return Y.Lang.
+ }
+ else {
+ return string;
+ }
+ });
+
}, '0.1.0', {
re...