frontend: remove unused chat code and convert it to topics

This commit is contained in:
Marcin Lulek 2016-07-04 17:41:42 +02:00
parent 834f1a2fdb
commit aab9035ccd
3 changed files with 13 additions and 31 deletions

View file

@ -385,29 +385,17 @@ $(document).ready(function() {
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({});
});

View file

@ -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) {

View file

@ -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