##// END OF EJS Templates
plugins: allow more custom keys into js configs
ergo -
Show More
@@ -76,6 +76,7 def register_appenlight_plugin(config, plugin_name, plugin_config):
76 76 'fulltext_indexer': None,
77 77 'sqlalchemy_migrations': None,
78 78 'default_values_setter': None,
79 'header_html': None,
79 80 'resource_types': [],
80 81 'url_gen': None
81 82 }
@@ -2742,7 +2742,7 angular.module('appenlight.services', [
2742 2742
2743 2743 var pluginsToLoad = _.map(decodeEncodedJSON(window.AE.plugins),
2744 2744 function(item){
2745 return item.config.angular_module
2745 return item.config.javascript.angular_module
2746 2746 });
2747 2747 console.info(pluginsToLoad);
2748 2748
@@ -110,7 +110,7 def add_renderer_globals(event):
110 110 renderer_globals['_'] = _
111 111 renderer_globals['security'] = security
112 112 renderer_globals['flash_msgs'] = []
113 renderer_globals['js_plugins'] = []
113 renderer_globals['appenlight_plugins'] = []
114 114
115 115 if 'jinja' in event['renderer_info'].type:
116 116 renderer_globals['url_list'] = gen_urls(request)
@@ -120,9 +120,12 def add_renderer_globals(event):
120 120 urls = config['url_gen'](request)
121 121 renderer_globals['url_list']['plugins'][module] = urls
122 122
123 if config['javascript']:
124 renderer_globals['js_plugins'].append(
125 ({'name': module, 'config': config['javascript']}))
123 renderer_globals['appenlight_plugins'].append(
124 {'name': module,
125 'config': {
126 'javascript':config['javascript'],
127 'header_html':config['header_html']
128 }})
126 129
127 130 footer_config = ConfigService.by_key_and_section(
128 131 'template_footer_html', 'global', default_value='')
@@ -26,7 +26,7
26 26 AE.ws_url = '{{ request.registry.settings['cometd.ws_url'] }}';
27 27 AE.flash_messages = {{ flash_msgs|toJSONUnsafe }};
28 28 AE.timeOptions = {{ h.time_options|toJSONUnsafe }};
29 AE.plugins = {{ js_plugins|toJSONUnsafe }};
29 AE.plugins = {{ appenlight_plugins|toJSONUnsafe }};
30 30 </script>
31 31 {% if request.registry.settings.get('appenlight.public_api_key') %}
32 32 <script type="application/javascript">
@@ -62,8 +62,11
62 62 </script>
63 63 {% endif %}
64 64 <script src="{{ request.static_url('appenlight:webassets/appenlight/js/appenlight.js', _query={'rev':js_hash}) }}"></script>
65 {% for plugin in js_plugins %}
66 <script src="{{ request.static_url('appenlight:webassets/{}/js/{}'.format(plugin['name'], plugin['config']['src']), _query={'rev':js_hash}) }}"></script>
65 {% for plugin in appenlight_plugins %}
66 <script src="{{ request.static_url('appenlight:webassets/{}/js/{}'.format(plugin['name'], plugin['config']['javascript']['src']), _query={'rev':js_hash}) }}"></script>
67 {% if plugin['config']['header_html'] %}
68 {{ plugin['config']['header_html']|safe }}
69 {% endif %}
67 70 {% endfor %}
68 71 <script>
69 72 var xhr = new XMLHttpRequest();
@@ -106,7 +106,7 angular.module('appenlight.services', [
106 106
107 107 var pluginsToLoad = _.map(decodeEncodedJSON(window.AE.plugins),
108 108 function(item){
109 return item.config.angular_module
109 return item.config.javascript.angular_module
110 110 });
111 111 console.info(pluginsToLoad);
112 112
General Comments 0
You need to be logged in to leave comments. Login now