diff --git a/CHANGELOG b/CHANGELOG index 118e79ecf..4ea03c3dd 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -30,6 +30,7 @@ Users: Other: - Removed config cache to support multiple threads or processes. - Fixed bug, that the last change of a config value was not send via autoupdate. +- Added template hooks for plugins (in item detail view and motion poll form). Version 2.0 (2016-04-18) diff --git a/openslides/agenda/static/templates/agenda/item-detail.html b/openslides/agenda/static/templates/agenda/item-detail.html index 8af8ce460..67169b2f8 100644 --- a/openslides/agenda/static/templates/agenda/item-detail.html +++ b/openslides/agenda/static/templates/agenda/item-detail.html @@ -70,6 +70,8 @@ + +

Last speakers

diff --git a/openslides/core/static/js/core/base.js b/openslides/core/static/js/core/base.js index 2dbe81201..ab51690bc 100644 --- a/openslides/core/static/js/core/base.js +++ b/openslides/core/static/js/core/base.js @@ -250,6 +250,43 @@ angular.module('OpenSlidesApp.core', [ } ]) + +// Template hooks + +.factory('templateHooks', [ + function () { + var hooks = {}; + return { + hooks: hooks, + registerHook: function (hook) { + if (hooks[hook.Id] === undefined) { + hooks[hook.Id] = []; + } + hooks[hook.Id].push(hook); + } + }; + } +]) + +.directive('templateHook', [ + '$compile', + 'templateHooks', + function ($compile, templateHooks) { + return { + restrict: 'E', + template: '', + link: function (scope, iElement, iAttr) { + var hooks = templateHooks.hooks[iAttr.hookName]; + var html = hooks.map(function (hook) { + return '
' + hook.template + '
'; + }).join(''); + iElement.append($compile(html)(scope)); + } + }; + } +]) + + .factory('jsDataModel', [ '$http', 'Projector', diff --git a/openslides/motions/static/templates/motions/motionpoll-form.html b/openslides/motions/static/templates/motions/motionpoll-form.html index 203c51671..aedd2fbc3 100644 --- a/openslides/motions/static/templates/motions/motionpoll-form.html +++ b/openslides/motions/static/templates/motions/motionpoll-form.html @@ -11,6 +11,7 @@
+