##// END OF EJS Templates
frontend: prepare for plugin registration and life-cycle handling
ergo -
r373:379025d6 default
parent child Browse files
Show More
@@ -0,0 +1,14 b''
1 <%
2 from pyramid.renderers import render as pyramid_render
3 from pyramid.threadlocal import get_current_registry, get_current_request
4 pyramid_registry = get_current_registry()
5 %>
6 % for plugin, config in pyramid_registry.rhodecode_plugins.items():
7 % if config['template_hooks'].get('plugin_init_template'):
8 ${pyramid_render(config['template_hooks'].get('plugin_init_template'),
9 {'config':config}, request=get_current_request(), package='rc_ae')|n}
10 % endif
11 % endfor
12 <script>
13 $.Topic('/plugins/__REGISTER__').publish({});
14 </script>
@@ -23,8 +23,6 b' def get_plugin_settings(prefix, settings'
23 23 """
24 24 Returns plugin settings. Use::
25 25
26
27
28 26 :param prefix:
29 27 :param settings:
30 28 :return:
@@ -45,21 +43,15 b' def register_rhodecode_plugin(config, pl'
45 43 'javascript': None,
46 44 'static': None,
47 45 'css': None,
48 'top_nav': None,
46 'nav': None,
49 47 'fulltext_indexer': None,
50 48 'sqlalchemy_migrations': None,
51 49 'default_values_setter': None,
52 'resource_types': [],
53 'url_gen': None
50 'url_gen': None,
51 'template_hooks': {}
54 52 }
55 53 config.registry.rhodecode_plugins[plugin_name].update(
56 54 plugin_config)
57 # inform RC what kind of resource types we have available
58 # so we can avoid failing when a plugin is removed but data
59 # is still present in the db
60 if plugin_config.get('resource_types'):
61 config.registry.resource_types.extend(
62 plugin_config['resource_types'])
63 55
64 56 config.action(
65 57 'register_rhodecode_plugin={}'.format(plugin_name), register)
@@ -397,5 +397,4 b' function offsetScroll(element, offset){'
397 397 }
398 398
399 399 collapsableContent();
400 $.Topic('/plugins/__REGISTER__').prepare({});
401 400 });
@@ -140,6 +140,8 b''
140 140 <%def name="head_extra()"></%def>
141 141 ${self.head_extra()}
142 142
143 <%include file="/base/plugins_base.html"/>
144
143 145 ## extra stuff
144 146 %if c.pre_code:
145 147 ${c.pre_code|n}
General Comments 0
You need to be logged in to leave comments. Login now