Added template hooks for plugins.

This commit is contained in:
Norman Jäckel 2016-08-18 16:49:50 +02:00
parent 08c734f1a3
commit c38cf562d5
4 changed files with 41 additions and 0 deletions

View File

@ -30,6 +30,7 @@ Users:
Other: Other:
- Removed config cache to support multiple threads or processes. - Removed config cache to support multiple threads or processes.
- Fixed bug, that the last change of a config value was not send via autoupdate. - 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) Version 2.0 (2016-04-18)

View File

@ -70,6 +70,8 @@
</button> </button>
</div> </div>
<template-hook hook-name="itemDetailListOfSpeakersButtons"></template-hook>
<!-- Last speakers --> <!-- Last speakers -->
<div class="spacer"> <div class="spacer">
<h3 translate>Last speakers</h3> <h3 translate>Last speakers</h3>

View File

@ -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 '<div>' + hook.template + '</div>';
}).join('');
iElement.append($compile(html)(scope));
}
};
}
])
.factory('jsDataModel', [ .factory('jsDataModel', [
'$http', '$http',
'Projector', 'Projector',

View File

@ -11,6 +11,7 @@
<form name="motionPollForm" ng-submit="save(model)"> <form name="motionPollForm" ng-submit="save(model)">
<formly-form model="model" fields="formFields"> <formly-form model="model" fields="formFields">
<template-hook hook-name="motionPollFormButtons"></template-hook>
<button type="submit" ng-disabled="motionPollForm.$invalid" class="btn btn-primary" translate> <button type="submit" ng-disabled="motionPollForm.$invalid" class="btn btn-primary" translate>
Save Save
</button> </button>