closes #6854
parent
7950b254a6
commit
ab7657d445
@ -0,0 +1,3 @@
|
|||||||
|
.admin .hooks-list .panel.panel-default .panel-heading {
|
||||||
|
text-transform: none;
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
var plugins = require('../../plugins');
|
||||||
|
|
||||||
|
var hooksController = module.exports;
|
||||||
|
|
||||||
|
hooksController.get = function (req, res) {
|
||||||
|
var hooks = [];
|
||||||
|
Object.keys(plugins.loadedHooks).forEach(function (key, hookIndex) {
|
||||||
|
var current = {
|
||||||
|
hookName: key,
|
||||||
|
methods: [],
|
||||||
|
index: 'hook-' + hookIndex,
|
||||||
|
count: plugins.loadedHooks[key].length,
|
||||||
|
};
|
||||||
|
|
||||||
|
plugins.loadedHooks[key].forEach(function (hookData, methodIndex) {
|
||||||
|
current.methods.push({
|
||||||
|
id: hookData.id,
|
||||||
|
priority: hookData.priority,
|
||||||
|
method: hookData.method ? hookData.method.toString() : 'No plugin function!',
|
||||||
|
index: hookIndex + '-code-' + methodIndex,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
hooks.push(current);
|
||||||
|
});
|
||||||
|
|
||||||
|
hooks.sort((a, b) => b.count - a.count);
|
||||||
|
|
||||||
|
res.render('admin/advanced/hooks', { hooks: hooks });
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,31 @@
|
|||||||
|
<div class="hooks-list panel-group" id="accordion" role="tablist" aria-multiselectable="true">
|
||||||
|
<!-- BEGIN hooks -->
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading" role="tab">
|
||||||
|
<div class="panel-title">
|
||||||
|
<a role="button" data-toggle="collapse" data-parent="#accordion" data-target="#{hooks.index}" aria-expanded="true" aria-controls="{hooks.index}">
|
||||||
|
{hooks.hookName}
|
||||||
|
</a>
|
||||||
|
<span class="pull-right">{hooks.count} hooks</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="{hooks.index}" class="panel-collapse collapse" role="tabpanel">
|
||||||
|
<div class="panel-body clearfix">
|
||||||
|
<!-- BEGIN hooks.methods -->
|
||||||
|
<div class="clearfix">
|
||||||
|
<strong>{hooks.methods.id}</strong>
|
||||||
|
Priority: {hooks.methods.priority}
|
||||||
|
|
||||||
|
<button class="btn btn-primary btn-sm pull-right" type="button" data-toggle="collapse" data-target="#{hooks.methods.index}" aria-expanded="false" aria-controls="{hooks.methods.index}">
|
||||||
|
Show Code <i class="fa fa-eye"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="collapse" id="{hooks.methods.index}">
|
||||||
|
<pre>{hooks.methods.method}</pre>
|
||||||
|
</div>
|
||||||
|
<!-- END hooks.methods -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- END hooks -->
|
||||||
|
</div>
|
Loading…
Reference in New Issue