##// END OF EJS Templates
frontend: remove unused chat code and convert it to topics
ergo -
r372:21804de5 default
parent child Browse files
Show More
@@ -0,0 +1,3 b''
1 /plugins/__REGISTER__ - launched after the onDomReady() code from rhodecode.js is executed
2 /ui/plugins/code/anchor_focus - launched when rc starts to scroll on load to anchor on PR/Codeview
3 /ui/plugins/code/comment_form_built - launched when injectInlineForm() is executed and the form object is created
@@ -385,29 +385,17 b' function offsetScroll(element, offset){'
385 if (lineno.length > 0){
385 if (lineno.length > 0){
386 var tr = lineno.parents('tr.line');
386 var tr = lineno.parents('tr.line');
387 tr.addClass('selected');
387 tr.addClass('selected');
388 $.Topic('/ui/plugins/code/anchor_focus').prepare({
389 tr:tr,
390 remainder:remainder});
388
391
389 // once we scrolled into our line, trigger chat app
392 if (!remainder){
390 if (remainder){
391 tr.find('.add-comment-line a').trigger( "click" );
392 setTimeout(function(){
393 var nextNode = $(tr).next();
394 if(nextNode.hasClass('inline-comments')){
395 nextNode.next().find('.switch-to-chat').trigger( "click" );
396 }
397 else{
398 nextNode.find('.switch-to-chat').trigger( "click" );
399 }
400 // trigger scroll into, later so all elements are already loaded
401 tr[0].scrollIntoView();
402 }, 250);
403
404 }
405 else{
406 tr[0].scrollIntoView();
393 tr[0].scrollIntoView();
407 }
394 }
408 }
395 }
409 }
396 }
410 };
397 }
411
398
412 collapsableContent();
399 collapsableContent();
400 $.Topic('/plugins/__REGISTER__').prepare({});
413 });
401 });
@@ -150,19 +150,6 b' var injectInlineForm = function(tr){'
150
150
151 var _form = $(f).find('.inline-form').get(0);
151 var _form = $(f).find('.inline-form').get(0);
152
152
153 $('.switch-to-chat', _form).on('click', function(evt){
154 var fParent = $(_parent).closest('.injected_diff').parent().prev('*[fid]');
155 var fid = fParent.attr('fid');
156
157 // activate chat and trigger subscription to channels
158 $.Topic('/chat_controller').publish({
159 action:'subscribe_to_channels',
160 data: ['/chat${0}$/fid/{1}/{2}'.format(templateContext.repo_name, fid, lineno)]
161 });
162 $(_form).closest('td').find('.comment-inline-form').addClass('hidden');
163 $(_form).closest('td').find('.chat-holder').removeClass('hidden');
164 });
165
166 var pullRequestId = templateContext.pull_request_data.pull_request_id;
153 var pullRequestId = templateContext.pull_request_data.pull_request_id;
167 var commitId = templateContext.commit_data.commit_id;
154 var commitId = templateContext.commit_data.commit_id;
168
155
@@ -224,6 +211,10 b' var injectInlineForm = function(tr){'
224 }
211 }
225 }, 10);
212 }, 10);
226
213
214 $.Topic('/ui/plugins/code/comment_form_built').prepare({
215 form:_form,
216 parent:_parent}
217 );
227 };
218 };
228
219
229 var deleteComment = function(comment_id) {
220 var deleteComment = function(comment_id) {
General Comments 0
You need to be logged in to leave comments. Login now