Merge lp:~cjohnston/launchpad/IC-usability-ease into lp:launchpad

Proposed by Chris Johnston
Status: Merged
Merged at revision: 17021
Proposed branch: lp:~cjohnston/launchpad/IC-usability-ease
Merge into: lp:launchpad
Diff against target: 347 lines (+75/-46)
10 files modified
lib/canonical/launchpad/icing/css/typography.css (+4/-3)
lib/canonical/launchpad/icing/style.css (+7/-9)
lib/lp/answers/templates/questionmessage-display.pt (+3/-3)
lib/lp/app/javascript/comment.js (+2/-2)
lib/lp/app/javascript/tests/test_hide_comment.html (+2/-2)
lib/lp/app/javascript/tests/test_hide_comment.js (+4/-4)
lib/lp/bugs/templates/bugcomment-box.pt (+3/-3)
lib/lp/code/javascript/branchmergeproposal.inlinecomments.js (+40/-9)
lib/lp/code/templates/codereviewcomment-body.pt (+0/-10)
lib/lp/services/comments/templates/comment.pt (+10/-1)
To merge this branch: bzr merge lp:~cjohnston/launchpad/IC-usability-ease
Reviewer Review Type Date Requested Status
William Grant code Approve
Review via email: mp+221298@code.launchpad.net

Commit message

Updated style for comment actions across bugs, answers, and MPs. Added new usability links for editing, deleting, and replying to ICs using this new style.

Description of the change

- Add boardCommentFooter to IC's
- Added the ability to 'Edit' 'Delete' 'Reply' to IC's via a link
- Modified the look of boardCommentFooter to lighten the color and make it shorter
- Modified Hide/Unhide comment on bugs and answers to remove duplicated "Comment" in text

To post a comment you must log in.
Revision history for this message
William Grant (wgrant) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/canonical/launchpad/icing/css/typography.css'
2--- lib/canonical/launchpad/icing/css/typography.css 2014-05-14 09:23:56 +0000
3+++ lib/canonical/launchpad/icing/css/typography.css 2014-05-28 21:44:50 +0000
4@@ -50,15 +50,15 @@
5 word-wrap: break-word;
6 }
7
8-:link, :visited {
9+:link, :visited a.js-action {
10 /* Links are blue, brighter when clicked, and greyer once visited. */
11 color: #03a;
12 text-decoration: none;
13 }
14-:link:hover, :visited:hover {
15+:link:hover, :visited:hover a.js-action {
16 text-decoration: underline;
17 }
18-:link:active, :visited:active {
19+:link:active, :visited:active a.js-action:active {
20 color: #36c;
21 }
22 a[onclick], .collapsible legend a, a.js-action,
23@@ -66,6 +66,7 @@
24 a.js-action:active {
25 /* Links that don't open separate pages are green. */
26 color: #093;
27+ cursor: pointer;
28 }
29 a.help {
30 border-bottom: 1px dotted #03a;
31
32=== modified file 'lib/canonical/launchpad/icing/style.css'
33--- lib/canonical/launchpad/icing/style.css 2014-05-21 00:59:56 +0000
34+++ lib/canonical/launchpad/icing/style.css 2014-05-28 21:44:50 +0000
35@@ -248,10 +248,14 @@
36 }
37 .boardCommentContent { line-height: 1.4em;}
38 .boardCommentFooter {
39- background-color: #eee;
40+ background-color: #F8F8F8;
41 color: #666;
42- padding: 0.5em 12px;
43+ padding: 0.15em 12px;
44 border-top: 1px solid #ddd;
45+ text-align: right;
46+}
47+.boardCommentFooter a {
48+ margin-left: 1.5em;
49 }
50 .from-superseded {background-color: #ffffcc;}
51 .adminHiddenComment {background-color:gray;}
52@@ -569,9 +573,6 @@
53 .commentVote {
54 float: right;
55 }
56-.replyLink {
57- text-align: right;
58-}
59 .codereviewcomment .attachment, #review-diff .attachment,
60 div.diff .attachmentBody {
61 background-color: #f6f6f6;
62@@ -607,22 +608,19 @@
63 table.diff .inline-comments > td > div {
64 margin: 0 1em 1.5em 1em;
65 }
66-
67 table.diff .inline-comments .yui3-ieditor { padding-right:0!important; }
68 table.diff .inline-comments .yui3-ieditor-multiline .yui3-ieditor-btns
69 .bg-top-label button.lazr-btn {
70 word-wrap: normal;
71 }
72-
73 table.diff .inline-comments .boardComment {
74 margin: 1em 0;
75 }
76-
77 table.diff .inline-comments .boardCommentBody {
78 word-wrap: break-word;
79 font-family: monospace;
80+ padding-bottom: 0.5em;
81 }
82-
83 table.diff .inline-comments .yui3-ieditor-multiline .yui3-ieditor-btns
84 .bg-top-label {
85 background-image: none!important;
86
87=== modified file 'lib/lp/answers/templates/questionmessage-display.pt'
88--- lib/lp/answers/templates/questionmessage-display.pt 2011-11-29 20:36:46 +0000
89+++ lib/lp/answers/templates/questionmessage-display.pt 2014-05-28 21:44:50 +0000
90@@ -60,10 +60,10 @@
91 tal:condition="view/canSeeSpamControls"
92 class="boardCommentFooter">
93 <a tal:attributes="id string:mark-spam-${context/index};"
94- class="js-action sprite edit mark-spam" href="#">
95+ class="js-action mark-spam" href="#">
96 <tal:not-spam
97- condition="not: context/visible">Unhide comment</tal:not-spam>
98- <tal:spam condition="context/visible">Hide comment</tal:spam>
99+ condition="not: context/visible">Unhide</tal:not-spam>
100+ <tal:spam condition="context/visible">Hide</tal:spam>
101 </a>
102 </div>
103 </div>
104
105=== modified file 'lib/lp/app/javascript/comment.js'
106--- lib/lp/app/javascript/comment.js 2014-05-19 17:06:17 +0000
107+++ lib/lp/app/javascript/comment.js 2014-05-28 21:44:50 +0000
108@@ -85,8 +85,8 @@
109 }, {
110 ATTRS: {
111 hidden_class: { value: "adminHiddenComment" },
112- hide_text: { value: "Hide comment" },
113- unhide_text: { value: "Unhide comment" },
114+ hide_text: { value: "Hide" },
115+ unhide_text: { value: "Unhide" },
116 comment_list_container: {
117 valueFn: function () {
118 return Y.one('#maincontentsub');
119
120=== modified file 'lib/lp/app/javascript/tests/test_hide_comment.html'
121--- lib/lp/app/javascript/tests/test_hide_comment.html 2012-10-26 09:54:28 +0000
122+++ lib/lp/app/javascript/tests/test_hide_comment.html 2014-05-28 21:44:50 +0000
123@@ -51,7 +51,7 @@
124 <div class="boardCommentBody"><p>Foo bar baz.</p></div>
125 <div class="boardCommentFooter">
126 <a id="mark-spam-0" class="mark-spam js-action sprite edit"
127- href="#">Hide comment</a>
128+ href="#">Hide</a>
129 </div>
130 </div>
131
132@@ -60,7 +60,7 @@
133 <div class="boardCommentBody"><p>Click here for a diploma!</p></div>
134 <div class="boardCommentFooter">
135 <a id="mark-spam-1" class="mark-spam js-action sprite edit"
136- href="#">Unhide comment
137+ href="#">Unhide
138 </a>
139 </div>
140 </div>
141
142=== modified file 'lib/lp/app/javascript/tests/test_hide_comment.js'
143--- lib/lp/app/javascript/tests/test_hide_comment.js 2012-10-26 10:00:20 +0000
144+++ lib/lp/app/javascript/tests/test_hide_comment.js 2014-05-28 21:44:50 +0000
145@@ -44,8 +44,8 @@
146 var comment_node = Y.one('.boardComment');
147 link.simulate('click');
148 Y.Assert.isTrue(comment_node.hasClass('adminHiddenComment'));
149- Y.Assert.areEqual('Unhide comment', link.get('text'),
150- 'Link text should be \'Unhide comment\'');
151+ Y.Assert.areEqual('Unhide', link.get('text'),
152+ 'Link text should be \'Unhide\'');
153 Y.Assert.areEqual(
154 'https://launchpad.dev/api/devel/some/comment/',
155 LP.cache.call_data.called_url, 'Call with wrong url.');
156@@ -64,8 +64,8 @@
157 var comment_node = Y.one('#hidden-comment');
158 link.simulate('click');
159 Y.Assert.isFalse(comment_node.hasClass('adminHiddenComment'));
160- Y.Assert.areEqual('Hide comment', link.get('text'),
161- 'Link text should be \'Hide comment\'');
162+ Y.Assert.areEqual('Hide', link.get('text'),
163+ 'Link text should be \'Hide\'');
164 Y.Assert.areEqual(
165 'https://launchpad.dev/api/devel/some/comment/',
166 LP.cache.call_data.called_url, 'Call with wrong url.');
167
168=== modified file 'lib/lp/bugs/templates/bugcomment-box.pt'
169--- lib/lp/bugs/templates/bugcomment-box.pt 2012-06-15 16:23:50 +0000
170+++ lib/lp/bugs/templates/bugcomment-box.pt 2014-05-28 21:44:50 +0000
171@@ -96,11 +96,11 @@
172 <div class="boardCommentFooter" tal:condition="comment/show_footer">
173 <a tal:attributes="id string:mark-spam-${context/index};"
174 tal:condition="view/show_spam_controls"
175- class="js-action sprite edit mark-spam" href="#">
176+ class="js-action mark-spam" href="#">
177 <tal:not-spam condition="not: context/visible"
178- >Unhide comment</tal:not-spam>
179+ >Unhide</tal:not-spam>
180 <tal:spam condition="context/visible"
181- >Hide comment</tal:spam>
182+ >Hide</tal:spam>
183 </a>
184 <tal:activity
185 define="activity_list comment/activity"
186
187=== modified file 'lib/lp/code/javascript/branchmergeproposal.inlinecomments.js'
188--- lib/lp/code/javascript/branchmergeproposal.inlinecomments.js 2014-05-26 12:44:57 +0000
189+++ lib/lp/code/javascript/branchmergeproposal.inlinecomments.js 2014-05-28 21:44:50 +0000
190@@ -25,17 +25,31 @@
191 });
192 };
193
194+namespace.find_line_number = function(element) {
195+ var text_row = element.ancestor('tr', true);
196+ if (text_row.hasClass('inline-comments')) {
197+ text_row = text_row.previous();
198+ }
199+ return text_row.one('.line-no').get('text');
200+};
201+
202+namespace.delete_draft = function(draft_div) {
203+ var line_number = namespace.find_line_number(draft_div);
204+ delete namespace.inlinecomments[line_number];
205+ draft_div.remove(true);
206+ namespace.cleanup_empty_comment_containers();
207+}
208+
209 namespace.add_doubleclick_handler = function() {
210 var handling_request = false;
211- handler = function(e) {
212+ var edit_handler = function(e) {
213 if (handling_request === true) {
214 return;
215 }
216 handling_request = true;
217- var text_row = e.currentTarget.ancestor('tr', true);
218- var line_number = text_row.one('.line-no').get('text');
219 // Retrieve or create a container for the comment editor.
220- var draft_div = Y.one('#comments-' + text_row.get('id') + ' .draft');
221+ var line_number = namespace.find_line_number(e.currentTarget);
222+ var draft_div = Y.one('#comments-diff-line-' + line_number + ' .draft');
223 if (draft_div === null) {
224 draft_div = namespace.create_row({'line_number': line_number});
225 }
226@@ -50,9 +64,7 @@
227 widget.editor.on('save', function() {
228 namespace.inlinecomments[line_number] = this.get('value');
229 if (this.get('value') === '') {
230- delete namespace.inlinecomments[line_number];
231- draft_div.remove(true);
232- namespace.cleanup_empty_comment_containers();
233+ namespace.delete_draft(draft_div);
234 }
235 var config = {
236 on: {
237@@ -68,9 +80,11 @@
238 namespace.lp_client.named_post(
239 LP.cache.context.self_link, 'saveDraftInlineComment', config);
240 handling_request = false;
241+ draft_div.one('.boardCommentFooter').show();
242 });
243 widget.editor.on('cancel', function(e) {
244 handling_request = false;
245+ draft_div.one('.boardCommentFooter').show();
246 // If there's no saved comment to return to, just remove the
247 // draft UI.
248 if (namespace.inlinecomments[line_number] === undefined) {
249@@ -79,14 +93,25 @@
250 }
251 });
252 widget._triggerEdit(e);
253+ draft_div.one('.boardCommentFooter').hide();
254+ };
255+ var delete_handler = function(e) {
256+ var line_number = namespace.find_line_number(e.currentTarget);
257+ var draft_div = Y.one('#comments-diff-line-' + line_number + ' .draft');
258+ namespace.delete_draft(draft_div);
259 };
260
261 // The editor can be invoked by double-clicking a diff line or
262 // clicking the line number. Hovering over a line shows an edit icon
263 // near the line number, to hint that it's clickable.
264 // XXX: Introduce a separate comment column.
265- Y.one('.diff').delegate('dblclick', handler, 'tr[id^="diff-line"]');
266- Y.one('.diff').delegate('click', handler, 'tr[id^="diff-line"] .line-no');
267+ Y.one('.diff').delegate(
268+ 'click', edit_handler, '.boardCommentFooter a.draft-edit');
269+ Y.one('.diff').delegate(
270+ 'click', delete_handler, '.boardCommentFooter a.draft-delete');
271+ Y.one('.diff').delegate('dblclick', edit_handler, 'tr[id^="diff-line"]');
272+ Y.one('.diff').delegate(
273+ 'click', edit_handler, 'tr[id^="diff-line"] .line-no');
274 Y.one('.diff').delegate('hover',
275 function(e) {
276 e.currentTarget.one('.line-no').addClass('active');
277@@ -114,6 +139,7 @@
278 '<div class="boardComment">' +
279 '<div class="boardCommentDetails"></div>' +
280 '<div class="boardCommentBody"><div></div></div>' +
281+ '<div class="boardCommentFooter"></div>' +
282 '</div>');
283 if (Y.Lang.isUndefined(comment.person)) {
284 // Creates a draft inline comment area.
285@@ -122,6 +148,9 @@
286 newrow.one('.boardCommentBody div')
287 .append('<span class="yui3-editable_text-text"></span>')
288 .append('<div class="yui3-editable_text-trigger"></div>');
289+ newrow.one('.boardCommentFooter')
290+ .append('<a class="js-action draft-edit">Edit</a>')
291+ .append('<a class="js-action draft-delete">Delete</a>');
292 if (!Y.Lang.isUndefined(comment.text)) {
293 namespace.inlinecomments[comment.line_number] = comment.text;
294 newrow.one('span').set('text', comment.text);
295@@ -133,6 +162,8 @@
296 // Wrap resources coming from LP.cache, as they come from
297 // the LP API (updates during the page life-span). This way
298 // the handling code can be unified.
299+ newrow.one('.boardCommentFooter')
300+ .append('<a class="js-action draft-edit">Reply</a>');
301 if (Y.Lang.isUndefined(comment.person.get)) {
302 comment.person = namespace.lp_client.wrap_resource(
303 null, comment.person);
304
305=== modified file 'lib/lp/code/templates/codereviewcomment-body.pt'
306--- lib/lp/code/templates/codereviewcomment-body.pt 2012-02-01 15:26:32 +0000
307+++ lib/lp/code/templates/codereviewcomment-body.pt 2014-05-28 21:44:50 +0000
308@@ -11,14 +11,4 @@
309 </div>
310 </tal:good-attachments>
311
312- <div class="replyLink" itemprop="replyToUrl"
313- tal:define="link context/menu:context/reply"
314- tal:condition="link/enabled"
315- tal:attributes="url link/fmt:url">
316- <tal:reply
317- tal:replace="structure link/render">
318- Reply
319- </tal:reply>
320- </div>
321-
322 </tal:root>
323
324=== modified file 'lib/lp/services/comments/templates/comment.pt'
325--- lib/lp/services/comments/templates/comment.pt 2012-01-20 19:24:59 +0000
326+++ lib/lp/services/comments/templates/comment.pt 2014-05-28 21:44:50 +0000
327@@ -17,10 +17,19 @@
328 tal:content="structure context/@@+comment-body">
329 The comment body
330 </div>
331- <div class="boardCommentFooter"
332+ <div class="boardBugActivityBody"
333 tal:condition="context/has_footer"
334 tal:content="structure context/@@+comment-footer">
335 Activity or other footer details.
336 </div>
337+ <div class="boardCommentFooter">
338+ <a itemprop="replyToUrl"
339+ tal:define="link context/menu:context/reply"
340+ tal:condition="link/enabled"
341+ tal:attributes="href link/fmt:url"
342+ tal:content="link/escapedtext">
343+ Reply
344+ </a>
345+ </div>
346 </div>
347 </tal:root>