diff --git a/public/src/forum/admin/plugins.js b/public/src/forum/admin/plugins.js index b5e17df7f7..07907b14e0 100644 --- a/public/src/forum/admin/plugins.js +++ b/public/src/forum/admin/plugins.js @@ -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 = ' ' + (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 = ' ' + (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('
  • No plugins found.

  • '); + } } }; diff --git a/public/templates/admin/plugins.tpl b/public/templates/admin/plugins.tpl index 213c3150b1..7510f6f691 100644 --- a/public/templates/admin/plugins.tpl +++ b/public/templates/admin/plugins.tpl @@ -13,4 +13,13 @@ +
    +

    + Interesed in writing plugins for NodeBB? +

    +

    + Full documentation regarding plugin authoring can be found in the NodeBB Wiki. +

    +
    + \ No newline at end of file diff --git a/src/plugins.js b/src/plugins.js index a1685ec1b9..f842b2fe12 100644 --- a/src/plugins.js +++ b/src/plugins.js @@ -189,7 +189,6 @@ var fs = require('fs'), next(); }); }, function(err) { - console.log(plugins); next(null, plugins); }); }