From 1d01a7ba105bcee8cb30e5a0d1eb92dd2efc3e2e Mon Sep 17 00:00:00 2001 From: Marcin Lulek Date: Wed, 7 Sep 2016 16:48:13 +0200 Subject: [PATCH] frontend: reorganize how we handle plugins --- .../public/js/src/rhodecode/connection_controller.js | 8 +++++++- rhodecode/templates/base/plugins_base.html | 3 --- rhodecode/templates/base/root.html | 6 ++++-- rhodecode/templates/channelstream/plugin_init.html | 8 -------- 4 files changed, 11 insertions(+), 14 deletions(-) diff --git a/rhodecode/public/js/src/rhodecode/connection_controller.js b/rhodecode/public/js/src/rhodecode/connection_controller.js index 877b95fe..f212f980 100644 --- a/rhodecode/public/js/src/rhodecode/connection_controller.js +++ b/rhodecode/public/js/src/rhodecode/connection_controller.js @@ -199,8 +199,14 @@ var registerViewChannels; }; $.Topic('/plugins/__REGISTER__').subscribe(function (data) { - // enable chat controller if (window.CHANNELSTREAM_SETTINGS && window.CHANNELSTREAM_SETTINGS.enabled) { + connCtrlr = new ConnectionController( + CHANNELSTREAM_SETTINGS.webapp_location, + CHANNELSTREAM_SETTINGS.ws_location, + CHANNELSTREAM_URLS + ); + registerViewChannels(); + $(document).ready(function () { connCtrlr.run(); }); diff --git a/rhodecode/templates/base/plugins_base.html b/rhodecode/templates/base/plugins_base.html index b2f64751..2b198ef8 100644 --- a/rhodecode/templates/base/plugins_base.html +++ b/rhodecode/templates/base/plugins_base.html @@ -9,6 +9,3 @@ ${pyramid_render(config['template_hooks'].get('plugin_init_template'), {'config':config}, request=get_current_request(), package='rc_ae')|n} % endif % endfor - diff --git a/rhodecode/templates/base/root.html b/rhodecode/templates/base/root.html index d35ea12e..0e314da1 100644 --- a/rhodecode/templates/base/root.html +++ b/rhodecode/templates/base/root.html @@ -111,6 +111,7 @@ c.template_context['visual']['default_renderer'] = h.get_visual_attr(c, 'default } }; + <%include file="/base/plugins_base.html"/> @@ -144,8 +145,9 @@ c.template_context['visual']['default_renderer'] = h.get_visual_attr(c, 'default <%def name="head_extra()"> ${self.head_extra()} - <%include file="/base/plugins_base.html"/> - + ## extra stuff %if c.pre_code: ${c.pre_code|n} diff --git a/rhodecode/templates/channelstream/plugin_init.html b/rhodecode/templates/channelstream/plugin_init.html index d64bc0cb..fbb9f210 100644 --- a/rhodecode/templates/channelstream/plugin_init.html +++ b/rhodecode/templates/channelstream/plugin_init.html @@ -13,12 +13,4 @@ 'webapp_location': ''}; %endif -if (CHANNELSTREAM_SETTINGS.enabled) { - connCtrlr = new ConnectionController( - CHANNELSTREAM_SETTINGS.webapp_location, - CHANNELSTREAM_SETTINGS.ws_location, - CHANNELSTREAM_URLS - ); - registerViewChannels(); -}