Merge pull request #2280 from normanjaeckel/TemplateHook
Added template hooks for plugins.
This commit is contained in:
commit
70a732bce8
@ -31,6 +31,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)
|
||||
|
@ -70,6 +70,8 @@
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<template-hook hook-name="itemDetailListOfSpeakersButtons"></template-hook>
|
||||
|
||||
<!-- Last speakers -->
|
||||
<div class="spacer">
|
||||
<h3 translate>Last speakers</h3>
|
||||
|
@ -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', [
|
||||
'$http',
|
||||
'Projector',
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
<form name="motionPollForm" ng-submit="save(model)">
|
||||
<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>
|
||||
Save
|
||||
</button>
|
||||
|
Loading…
Reference in New Issue
Block a user