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 @@ -384,7 +384,7 @@ function offsetScroll(element, offset){ tr[0].scrollIntoView(); - $.Topic('/ui/plugins/code/anchor_focus').prepare({ + $.Topic('/ui/plugins/code/anchor_focus').prepareOrPublish({ tr:tr, remainder:remainder}); } 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 @@ -210,7 +210,7 @@ var injectInlineForm = function(tr){ } }, 10); - $.Topic('/ui/plugins/code/comment_form_built').prepare({ + $.Topic('/ui/plugins/code/comment_form_built').prepareOrPublish({ form:_form, parent:_parent} ); diff --git a/rhodecode/public/js/src/rhodecode/utils/topics.js b/rhodecode/public/js/src/rhodecode/utils/topics.js --- a/rhodecode/public/js/src/rhodecode/utils/topics.js +++ b/rhodecode/public/js/src/rhodecode/utils/topics.js @@ -32,6 +32,14 @@ jQuery.Topic = function (id) { this.unhandledData.push(arguments[i]); } }, + prepareOrPublish: function(){ + if (callbacks.has() === true){ + this.publish.apply(this, arguments); + } + else{ + this.prepare.apply(this, arguments); + } + }, processPrepared: function(){ var data = this.unhandledData; this.unhandledData = []; @@ -40,7 +48,8 @@ jQuery.Topic = function (id) { } }, subscribe: callbacks.add, - unsubscribe: callbacks.remove + unsubscribe: callbacks.remove, + callbacks: callbacks }; if (id) { topics[id] = topic; diff --git a/rhodecode/templates/base/plugins_base.html b/rhodecode/templates/base/plugins_base.html --- a/rhodecode/templates/base/plugins_base.html +++ b/rhodecode/templates/base/plugins_base.html @@ -10,5 +10,5 @@ pyramid_registry = get_current_registry( % endif % endfor