launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #06072
[Merge] lp:~deryck/launchpad/remove-mochikit-connectRemoteCommentReply into lp:launchpad
Deryck Hodge has proposed merging lp:~deryck/launchpad/remove-mochikit-connectRemoteCommentReply into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~deryck/launchpad/remove-mochikit-connectRemoteCommentReply/+merge/88089
Kill off another Mochikit-based method.
This makes bugwatch comments expand to show or hide without using Mochkit. To QA, find a bug with comments imported from a bug watch. The "Reply on $BUGTRACKER" link should be green and when clicked should show the reply form. When clicked again, the form should hide.
Sample data in local dev has a bug to play with:
https://bugs.launchpad.dev/redfish/+bug/15
--
https://code.launchpad.net/~deryck/launchpad/remove-mochikit-connectRemoteCommentReply/+merge/88089
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~deryck/launchpad/remove-mochikit-connectRemoteCommentReply into lp:launchpad.
=== modified file 'lib/lp/app/javascript/lp-mochi.js'
--- lib/lp/app/javascript/lp-mochi.js 2011-06-30 17:38:28 +0000
+++ lib/lp/app/javascript/lp-mochi.js 2012-01-10 17:19:26 +0000
@@ -183,45 +183,6 @@
}
}
-function collapseRemoteCommentReply(comment_index) {
- var prefix = 'remote_comment_reply_';
- $(prefix + 'tree_icon_' + comment_index).src = '/@@/treeCollapsed';
- $(prefix + 'div_' + comment_index).style.display = 'none';
-}
-
-function expandRemoteCommentReply(comment_index) {
- var prefix = 'remote_comment_reply_';
- $(prefix + 'tree_icon_' + comment_index).src = '/@@/treeExpanded';
- $(prefix + 'div_' + comment_index).style.display = 'block';
-}
-
-function toggleRemoteCommentReply(comment_index) {
- var imgname = $('remote_comment_reply_tree_icon_' + comment_index)
- .src.split('/')
- .pop();
- var expanded = (imgname == 'treeExpanded');
- if (expanded) {
- collapseRemoteCommentReply(comment_index);
- } else {
- expandRemoteCommentReply(comment_index);
- }
-}
-
-function connectRemoteCommentReply(comment_index) {
- LPS.use('event', function(Y) {
- var toggleFunc = function() {
- toggleRemoteCommentReply(comment_index);
- return false;
- };
-
- var prefix = 'remote_comment_reply_expand_link_';
-
- Y.on('load', function(e) {
- $(prefix + comment_index).onclick = toggleFunc;
- }, window);
- });
-}
-
function unescapeHTML(unescaped_string) {
// Based on prototype's unescapeHTML method.
// See launchpad bug #78788 for details.
=== modified file 'lib/lp/bugs/javascript/bugtask_index.js'
--- lib/lp/bugs/javascript/bugtask_index.js 2011-12-20 02:00:43 +0000
+++ lib/lp/bugs/javascript/bugtask_index.js 2012-01-10 17:19:26 +0000
@@ -155,6 +155,7 @@
setup_add_attachment();
setup_link_branch_picker();
namespace.setup_load_comments(true);
+ namespace.setup_bugwatch_expand_comments();
}, window);
};
@@ -1486,6 +1487,27 @@
};
+/**
+ * Setup click handling for expanding comments added
+ * via a bugwatch, which start hidden initially.
+ *
+ * @method setup_bugwatch_expand_comments
+ */
+namespace.setup_bugwatch_expand_comments = function() {
+ var bw_comments = Y.all('.remote-comment-reply-parent');
+ bw_comments.each(function(el) {
+ var link = el.one('.remote-comment-reply-link');
+ link.addClass('js-action');
+ var content_node = el.one('.remote-comment-reply');
+ var content_form = el.one('form');
+ var expander = new Y.lp.app.widgets.expander.Expander(
+ link, content_node, { animate_node: content_form});
+ expander.setUp();
+ });
+
+}
+
+
}, "0.1", {"requires": ["base", "oop", "node", "event", "io-base",
"json-parse", "substitute", "widget-position-ext",
"lazr.formoverlay", "lp.anim", "lazr.base",
=== modified file 'lib/lp/bugs/stories/bugs/xx-remote-bug-comments.txt'
--- lib/lp/bugs/stories/bugs/xx-remote-bug-comments.txt 2011-12-30 06:14:56 +0000
+++ lib/lp/bugs/stories/bugs/xx-remote-bug-comments.txt 2012-01-10 17:19:26 +0000
@@ -34,11 +34,6 @@
>>> print extract_text(footer)
Reply on Debian Bug tracker...
-If javascript is available, we can expand the form inline.
-
- >>> print footer.script
- <script type="text/javascript">connectRemoteCommentReply(1);</script>
-
When javascript is not available, the link simply takes us to the
individual comment page, where the inline form is displayed.
=== modified file 'lib/lp/bugs/templates/bugcomment-box.pt'
--- lib/lp/bugs/templates/bugcomment-box.pt 2011-11-29 20:38:53 +0000
+++ lib/lp/bugs/templates/bugcomment-box.pt 2012-01-10 17:19:26 +0000
@@ -117,16 +117,12 @@
</tal:activity>
<tal:bugwatch-footer condition="comment/bugwatch">
<div>
- <table style="width: 100%">
+ <table class="remote-comment-reply-parent" style="width: 100%">
<tr>
<td style="text-align: left; vertical-align: middle">
<tal:reply-link condition="view/user">
- <a tal:attributes="id string:remote_comment_reply_expand_link_${comment/index};
- href comment/fmt:url"
- href="#">
- <img tal:attributes="id string:remote_comment_reply_tree_icon_${comment/index};
- src python: '/@@/tree' + (view.expand_reply_box and 'Expanded' or 'Collapsed')"
- class="collapseIcon" height="14" width="14" />
+ <a class="remote-comment-reply-link"
+ tal:attributes="href comment/fmt:url" href="#">
Reply on <tal:bugtracker replace="comment/bugwatch/bugtracker/title"/>
</a>
</tal:reply-link>
@@ -138,10 +134,8 @@
</tal:sync-state>
</td>
</tr>
- <tr tal:condition="view/user">
+ <tr class="remote-comment-reply" al:condition="view/user">
<td colspan="2">
- <div tal:attributes="id string:remote_comment_reply_div_${comment/index};
- style python: 'display: ' + (view.expand_reply_box and 'block' or 'none')">
<form tal:attributes="action comment/add_comment_url"
name="launchpadform" method="post"
enctype="multipart/form-data"
@@ -166,14 +160,10 @@
</table>
</div>
</form>
- </div>
</td>
</tr>
</table>
</div>
- <script type="text/javascript"
- tal:condition="view/user"
- tal:content="string:connectRemoteCommentReply(${comment/index});" />
</tal:bugwatch-footer>
</div>
</div>
Follow ups