Merge lp:~cjohnston/launchpad/ic-view into lp:launchpad

Proposed by Chris Johnston
Status: Merged
Approved by: Celso Providelo
Approved revision: no longer in the source branch.
Merged at revision: 16999
Proposed branch: lp:~cjohnston/launchpad/ic-view
Merge into: lp:launchpad
Diff against target: 129 lines (+71/-6)
3 files modified
lib/lp/app/javascript/inlineedit/assets/skins/sam/editor-skin.css (+49/-0)
lib/lp/code/javascript/branchmergeproposal.inlinecomments.js (+10/-6)
lib/lp/code/javascript/tests/test_branchmergeproposal.inlinecomments.js (+12/-0)
To merge this branch: bzr merge lp:~cjohnston/launchpad/ic-view
Reviewer Review Type Date Requested Status
Celso Providelo (community) Approve
Review via email: mp+214851@code.launchpad.net

Commit message

Improve styling to inline comments. Props to daker for the CSS help.

Description of the change

Props to daker for helping out with the CSS. Also includes a fix from cprov to remove left over code when cancelling an editing function.

To post a comment you must log in.
Revision history for this message
Adnane Belmadiaf (daker) wrote :

+1 from me

Revision history for this message
Celso Providelo (cprov) wrote :

Looks great, Chris!

I am not particularly sure about the font & line-height changes at this point, because they make inline comments too sparse. But that's more a personal taste issue than a opposition to land the changes.

Soon we will get some time with UI experts and they will guide the final tweaks to get this released.

Thanks for working on this.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/app/javascript/inlineedit/assets/skins/sam/editor-skin.css'
2--- lib/lp/app/javascript/inlineedit/assets/skins/sam/editor-skin.css 2012-08-23 19:56:15 +0000
3+++ lib/lp/app/javascript/inlineedit/assets/skins/sam/editor-skin.css 2014-04-09 19:59:19 +0000
4@@ -204,3 +204,52 @@
5 background: url('edit.png') top left no-repeat;
6 padding: 2px 0 0 18px;
7 }
8+
9+tr.ict-header {
10+ margin: 20px 0 0 0;
11+}
12+td.ic-header {
13+ border: 1px solid rgb(221, 221, 221);
14+ border-right: 0;
15+ padding: .5em 12px;
16+ font-family: Ubuntu,"Bitstream Vera Sans","DejaVu Sans",Tahoma,sans-serif;
17+ font-size: 12px;
18+}
19+td.inline-comment {
20+ border: 1px solid rgb(221, 221, 221);
21+ border-right: 0;
22+ margin: 0 0 20px 0;
23+ line-height: 25px;
24+ background-color: rgb(248, 248, 255);
25+ font-family: Ubuntu,"Bitstream Vera Sans","DejaVu Sans",Tahoma,sans-serif;
26+ font-size: 12px;
27+ padding: 0 12px 0;
28+ word-break: break-word;
29+}
30+
31+.inline-comment>div { line-height: 25px; }
32+.inline-comment .yui3-ieditor { padding-right:0 !important }
33+.inline-comment .yui3-ieditor > yui3-ieditor-input { width: auto!important }
34+.inline-comment .yui3-ieditor-input {
35+ width: auto!important;
36+ margin-right: 0;
37+ margin-bottom: 5px;
38+ margin-top: -6px!important;
39+ overflow: hidden;
40+}
41+.inline-comment .yui3-ieditor-content {top: 5px; left: -5px;}
42+.inline-comment .yui3-ieditor-input textarea {
43+ width: 92%;
44+ max-width: 92%;
45+ border-top: 1px solid rgb(214, 214, 214);
46+ float: left;
47+}
48+.inline-comment .yui3-ieditor-input .bg-top-label { margin-right: 10px; }
49+.inline-comment .bg-top-label {
50+ margin-right: -7px!important;
51+ background-image: none!important;
52+ margin-top: 18px!important;
53+}
54+tr.ict-content .yui3-ieditor-multiline .yui3-ieditor-btns .bg-top-label button.lazr-btn { text-indent: -9999px; }
55+.inline-comment .bg-top-label button.lazr-btn { text-indent: -9999px; }
56+.diff-content .boardCommentBody { padding: 0!important }
57
58=== modified file 'lib/lp/code/javascript/branchmergeproposal.inlinecomments.js'
59--- lib/lp/code/javascript/branchmergeproposal.inlinecomments.js 2014-04-04 05:23:48 +0000
60+++ lib/lp/code/javascript/branchmergeproposal.inlinecomments.js 2014-04-09 19:59:19 +0000
61@@ -50,6 +50,7 @@
62 handling_request = false;
63 if (namespace.inlinecomments[line_number] === undefined) {
64 header_row.remove(true);
65+ content_row.remove(true);
66 }
67 return;
68 }
69@@ -83,8 +84,8 @@
70
71 namespace.create_row = function(comment) {
72 var ident = comment.line_number + '-draft';
73- var headerrow = Y.Node.create(
74- '<tr><td colspan="2"></td></tr>').addClass('ict-header');
75+ var headerrow = Y.Node.create('<tr><td class="line-no"></td>' +
76+ '<td class="ic-header"></td></tr>').addClass('ict-header');
77 var headerspan;
78 var newrow;
79 if (Y.Lang.isUndefined(comment.person)) {
80@@ -92,8 +93,9 @@
81 headerspan = Y.Node.create('<span></span>').set(
82 'text', 'Draft comment.');
83 headerrow.set('id', 'ict-' + ident + '-header');
84- newrow = Y.Node.create('<tr><td></td><td><div>' +
85- '<span class="yui3-editable_text-text"></span>' +
86+ newrow = Y.Node.create('<tr><td class="line-no"></td>' +
87+ '<td class="inline-comment"><div>' +
88+ '<span class="yui3-editable_text-text inline-comment"></span>' +
89 '<div class="yui3-editable_text-trigger"></div>' +
90 '</div></td></tr>').set('id', 'ict-' + ident);
91 newrow.one('td>div').set('id', 'inlinecomment-' + ident);
92@@ -123,10 +125,12 @@
93 var fmt_date = 'on ' + Y.Date.format(
94 new Date(comment.date), {format: '%Y-%m-%d'});
95 headerspan.one('span').set('text', fmt_date);
96- newrow = Y.Node.create('<tr><td></td><td><span></span></td></tr>');
97+ newrow = Y.Node.create('<tr><td class="line-no"></td>' +
98+ '<td class="inline-comment"><span></span></td></tr>');
99 newrow.one('span').set('text', comment.text);
100 }
101- headerrow.one('td').appendChild(headerspan);
102+ var lineno = headerrow.one('td')
103+ lineno.get('nextSibling').appendChild(headerspan);
104
105 // We want to have the comments in order after the line.
106 var tr = Y.one('#diff-line-' + (parseInt(comment.line_number, 10) + 1));
107
108=== modified file 'lib/lp/code/javascript/tests/test_branchmergeproposal.inlinecomments.js'
109--- lib/lp/code/javascript/tests/test_branchmergeproposal.inlinecomments.js 2014-04-04 05:23:48 +0000
110+++ lib/lp/code/javascript/tests/test_branchmergeproposal.inlinecomments.js 2014-04-09 19:59:19 +0000
111@@ -145,6 +145,18 @@
112 Y.Assert.areEqual('diff-line-2', line.next().get('id'));
113 },
114
115+ test_edit_cancelling: function() {
116+ // Cancelling a inline comment attempt on a row with
117+ // no comments does not leave an empty row behind.
118+ module.add_doubleclick_handler();
119+ var line = Y.one('#diff-line-1');
120+ line.simulate('dblclick');
121+ ic_area = line.next().next();
122+ ic_area.one('.yui3-ieditor-input>textarea').set('value', '');
123+ ic_area.one('.lazr-neg').simulate('click');
124+ Y.Assert.areEqual('diff-line-2', line.next().get('id'));
125+ },
126+
127 test_feature_flag_off: function() {
128 var called = false;
129 add_doubleclick_handler = function() {