# HG changeset patch # User Marcin Lulek # Date 2016-07-04 15:41:42 # Node ID 21804de5d24c30f68b81b57688ebc8f591a952e5 # Parent 47b7ed9f1e0e6f63b31f681712207ac93a5184d9 frontend: remove unused chat code and convert it to topics diff --git a/rhodecode/public/js/src/rhodecode.js b/rhodecode/public/js/src/rhodecode.js --- a/rhodecode/public/js/src/rhodecode.js +++ b/rhodecode/public/js/src/rhodecode.js @@ -385,29 +385,17 @@ function offsetScroll(element, offset){ if (lineno.length > 0){ var tr = lineno.parents('tr.line'); tr.addClass('selected'); + $.Topic('/ui/plugins/code/anchor_focus').prepare({ + tr:tr, + remainder:remainder}); - // once we scrolled into our line, trigger chat app - if (remainder){ - tr.find('.add-comment-line a').trigger( "click" ); - setTimeout(function(){ - var nextNode = $(tr).next(); - if(nextNode.hasClass('inline-comments')){ - nextNode.next().find('.switch-to-chat').trigger( "click" ); - } - else{ - nextNode.find('.switch-to-chat').trigger( "click" ); - } - // trigger scroll into, later so all elements are already loaded - tr[0].scrollIntoView(); - }, 250); - - } - else{ + if (!remainder){ tr[0].scrollIntoView(); } } } - }; + } collapsableContent(); + $.Topic('/plugins/__REGISTER__').prepare({}); }); diff --git a/rhodecode/public/js/src/rhodecode/comments.js b/rhodecode/public/js/src/rhodecode/comments.js --- a/rhodecode/public/js/src/rhodecode/comments.js +++ b/rhodecode/public/js/src/rhodecode/comments.js @@ -150,19 +150,6 @@ var injectInlineForm = function(tr){ var _form = $(f).find('.inline-form').get(0); - $('.switch-to-chat', _form).on('click', function(evt){ - var fParent = $(_parent).closest('.injected_diff').parent().prev('*[fid]'); - var fid = fParent.attr('fid'); - - // activate chat and trigger subscription to channels - $.Topic('/chat_controller').publish({ - action:'subscribe_to_channels', - data: ['/chat${0}$/fid/{1}/{2}'.format(templateContext.repo_name, fid, lineno)] - }); - $(_form).closest('td').find('.comment-inline-form').addClass('hidden'); - $(_form).closest('td').find('.chat-holder').removeClass('hidden'); - }); - var pullRequestId = templateContext.pull_request_data.pull_request_id; var commitId = templateContext.commit_data.commit_id; @@ -224,6 +211,10 @@ var injectInlineForm = function(tr){ } }, 10); + $.Topic('/ui/plugins/code/comment_form_built').prepare({ + form:_form, + parent:_parent} + ); }; var deleteComment = function(comment_id) { diff --git a/rhodecode/public/js/topics_list.txt b/rhodecode/public/js/topics_list.txt new file mode 100644 --- /dev/null +++ b/rhodecode/public/js/topics_list.txt @@ -0,0 +1,3 @@ +/plugins/__REGISTER__ - launched after the onDomReady() code from rhodecode.js is executed +/ui/plugins/code/anchor_focus - launched when rc starts to scroll on load to anchor on PR/Codeview +/ui/plugins/code/comment_form_built - launched when injectInlineForm() is executed and the form object is created