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
=== modified file 'lib/lp/app/javascript/inlineedit/assets/skins/sam/editor-skin.css'
--- lib/lp/app/javascript/inlineedit/assets/skins/sam/editor-skin.css 2012-08-23 19:56:15 +0000
+++ lib/lp/app/javascript/inlineedit/assets/skins/sam/editor-skin.css 2014-04-09 19:59:19 +0000
@@ -204,3 +204,52 @@
204 background: url('edit.png') top left no-repeat;204 background: url('edit.png') top left no-repeat;
205 padding: 2px 0 0 18px;205 padding: 2px 0 0 18px;
206}206}
207
208tr.ict-header {
209 margin: 20px 0 0 0;
210}
211td.ic-header {
212 border: 1px solid rgb(221, 221, 221);
213 border-right: 0;
214 padding: .5em 12px;
215 font-family: Ubuntu,"Bitstream Vera Sans","DejaVu Sans",Tahoma,sans-serif;
216 font-size: 12px;
217}
218td.inline-comment {
219 border: 1px solid rgb(221, 221, 221);
220 border-right: 0;
221 margin: 0 0 20px 0;
222 line-height: 25px;
223 background-color: rgb(248, 248, 255);
224 font-family: Ubuntu,"Bitstream Vera Sans","DejaVu Sans",Tahoma,sans-serif;
225 font-size: 12px;
226 padding: 0 12px 0;
227 word-break: break-word;
228}
229
230.inline-comment>div { line-height: 25px; }
231.inline-comment .yui3-ieditor { padding-right:0 !important }
232.inline-comment .yui3-ieditor > yui3-ieditor-input { width: auto!important }
233.inline-comment .yui3-ieditor-input {
234 width: auto!important;
235 margin-right: 0;
236 margin-bottom: 5px;
237 margin-top: -6px!important;
238 overflow: hidden;
239}
240.inline-comment .yui3-ieditor-content {top: 5px; left: -5px;}
241.inline-comment .yui3-ieditor-input textarea {
242 width: 92%;
243 max-width: 92%;
244 border-top: 1px solid rgb(214, 214, 214);
245 float: left;
246}
247.inline-comment .yui3-ieditor-input .bg-top-label { margin-right: 10px; }
248.inline-comment .bg-top-label {
249 margin-right: -7px!important;
250 background-image: none!important;
251 margin-top: 18px!important;
252}
253tr.ict-content .yui3-ieditor-multiline .yui3-ieditor-btns .bg-top-label button.lazr-btn { text-indent: -9999px; }
254.inline-comment .bg-top-label button.lazr-btn { text-indent: -9999px; }
255.diff-content .boardCommentBody { padding: 0!important }
207256
=== modified file 'lib/lp/code/javascript/branchmergeproposal.inlinecomments.js'
--- lib/lp/code/javascript/branchmergeproposal.inlinecomments.js 2014-04-04 05:23:48 +0000
+++ lib/lp/code/javascript/branchmergeproposal.inlinecomments.js 2014-04-09 19:59:19 +0000
@@ -50,6 +50,7 @@
50 handling_request = false;50 handling_request = false;
51 if (namespace.inlinecomments[line_number] === undefined) {51 if (namespace.inlinecomments[line_number] === undefined) {
52 header_row.remove(true);52 header_row.remove(true);
53 content_row.remove(true);
53 }54 }
54 return;55 return;
55 }56 }
@@ -83,8 +84,8 @@
8384
84namespace.create_row = function(comment) {85namespace.create_row = function(comment) {
85 var ident = comment.line_number + '-draft';86 var ident = comment.line_number + '-draft';
86 var headerrow = Y.Node.create(87 var headerrow = Y.Node.create('<tr><td class="line-no"></td>' +
87 '<tr><td colspan="2"></td></tr>').addClass('ict-header');88 '<td class="ic-header"></td></tr>').addClass('ict-header');
88 var headerspan;89 var headerspan;
89 var newrow;90 var newrow;
90 if (Y.Lang.isUndefined(comment.person)) {91 if (Y.Lang.isUndefined(comment.person)) {
@@ -92,8 +93,9 @@
92 headerspan = Y.Node.create('<span></span>').set(93 headerspan = Y.Node.create('<span></span>').set(
93 'text', 'Draft comment.');94 'text', 'Draft comment.');
94 headerrow.set('id', 'ict-' + ident + '-header');95 headerrow.set('id', 'ict-' + ident + '-header');
95 newrow = Y.Node.create('<tr><td></td><td><div>' +96 newrow = Y.Node.create('<tr><td class="line-no"></td>' +
96 '<span class="yui3-editable_text-text"></span>' +97 '<td class="inline-comment"><div>' +
98 '<span class="yui3-editable_text-text inline-comment"></span>' +
97 '<div class="yui3-editable_text-trigger"></div>' +99 '<div class="yui3-editable_text-trigger"></div>' +
98 '</div></td></tr>').set('id', 'ict-' + ident);100 '</div></td></tr>').set('id', 'ict-' + ident);
99 newrow.one('td>div').set('id', 'inlinecomment-' + ident);101 newrow.one('td>div').set('id', 'inlinecomment-' + ident);
@@ -123,10 +125,12 @@
123 var fmt_date = 'on ' + Y.Date.format(125 var fmt_date = 'on ' + Y.Date.format(
124 new Date(comment.date), {format: '%Y-%m-%d'});126 new Date(comment.date), {format: '%Y-%m-%d'});
125 headerspan.one('span').set('text', fmt_date);127 headerspan.one('span').set('text', fmt_date);
126 newrow = Y.Node.create('<tr><td></td><td><span></span></td></tr>');128 newrow = Y.Node.create('<tr><td class="line-no"></td>' +
129 '<td class="inline-comment"><span></span></td></tr>');
127 newrow.one('span').set('text', comment.text);130 newrow.one('span').set('text', comment.text);
128 }131 }
129 headerrow.one('td').appendChild(headerspan);132 var lineno = headerrow.one('td')
133 lineno.get('nextSibling').appendChild(headerspan);
130134
131 // We want to have the comments in order after the line.135 // We want to have the comments in order after the line.
132 var tr = Y.one('#diff-line-' + (parseInt(comment.line_number, 10) + 1));136 var tr = Y.one('#diff-line-' + (parseInt(comment.line_number, 10) + 1));
133137
=== modified file 'lib/lp/code/javascript/tests/test_branchmergeproposal.inlinecomments.js'
--- lib/lp/code/javascript/tests/test_branchmergeproposal.inlinecomments.js 2014-04-04 05:23:48 +0000
+++ lib/lp/code/javascript/tests/test_branchmergeproposal.inlinecomments.js 2014-04-09 19:59:19 +0000
@@ -145,6 +145,18 @@
145 Y.Assert.areEqual('diff-line-2', line.next().get('id'));145 Y.Assert.areEqual('diff-line-2', line.next().get('id'));
146 },146 },
147147
148 test_edit_cancelling: function() {
149 // Cancelling a inline comment attempt on a row with
150 // no comments does not leave an empty row behind.
151 module.add_doubleclick_handler();
152 var line = Y.one('#diff-line-1');
153 line.simulate('dblclick');
154 ic_area = line.next().next();
155 ic_area.one('.yui3-ieditor-input>textarea').set('value', '');
156 ic_area.one('.lazr-neg').simulate('click');
157 Y.Assert.areEqual('diff-line-2', line.next().get('id'));
158 },
159
148 test_feature_flag_off: function() {160 test_feature_flag_off: function() {
149 var called = false;161 var called = false;
150 add_doubleclick_handler = function() {162 add_doubleclick_handler = function() {