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

@ -13,4 +13,13 @@
<!-- END plugins -->
</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>

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

Loading…
Cancel
Save