added note linking to wiki page for authoring plugins... also showing something if no plugins are installed

v1.18.x
Julian Lam 12 years ago
parent 3578ce1925
commit 1bee527f41

@ -4,25 +4,30 @@ var nodebb_admin = nodebb_admin || {};
var plugins = { var plugins = {
init: function() { init: function() {
var pluginsList = $('.plugins'), var pluginsList = $('.plugins'),
numPlugins = pluginsList[0].querySelectorAll('li').length,
pluginID, pluginTgl; pluginID, pluginTgl;
pluginsList.on('click', 'button[data-action="toggleActive"]', function() { if (numPlugins > 0) {
pluginID = $(this).parents('li').attr('data-plugin-id'); pluginsList.on('click', 'button[data-action="toggleActive"]', function() {
socket.emit('api:admin.plugins.toggle', pluginID); pluginID = $(this).parents('li').attr('data-plugin-id');
}); socket.emit('api:admin.plugins.toggle', pluginID);
});
socket.on('api:admin.plugins.toggle', function(status) { socket.on('api:admin.plugins.toggle', function(status) {
pluginTgl = document.querySelector('.plugins li[data-plugin-id="' + status.id + '"] button'); pluginTgl = document.querySelector('.plugins li[data-plugin-id="' + status.id + '"] button');
pluginTgl.innerHTML = '<i class="icon-off"></i> ' + (status.active ? 'Dea' : 'A') + 'ctivate'; pluginTgl.innerHTML = '<i class="icon-off"></i> ' + (status.active ? 'Dea' : 'A') + 'ctivate';
app.alert({ app.alert({
alert_id: 'plugin_toggled_' + status.id, alert_id: 'plugin_toggled_' + status.id,
title: 'Plugin Enabled', title: 'Plugin Enabled',
message: 'You may need to restart NodeBB in order for these changes to be reflected.', message: 'You may need to restart NodeBB in order for these changes to be reflected.',
type: 'notify', type: 'notify',
timeout: 5000 timeout: 5000
}) })
}); });
} else {
pluginsList.append('<li><p><i>No plugins found.</i></p></li>');
}
} }
}; };

@ -13,4 +13,13 @@
<!-- END plugins --> <!-- END plugins -->
</ul> </ul>
<div class="alert">
<p>
<strong>Interesed in writing plugins for NodeBB?</strong>
</p>
<p>
Full documentation regarding plugin authoring can be found in the <a target="_blank" href="https://github.com/designcreateplay/NodeBB/wiki/Writing-Plugins-for-NodeBB">NodeBB Wiki</a>.
</p>
</div>
<script type="text/javascript" src="{relative_path}/src/forum/admin/plugins.js"></script> <script type="text/javascript" src="{relative_path}/src/forum/admin/plugins.js"></script>

@ -189,7 +189,6 @@ var fs = require('fs'),
next(); next();
}); });
}, function(err) { }, function(err) {
console.log(plugins);
next(null, plugins); next(null, plugins);
}); });
} }

Loading…
Cancel
Save