Fix a myriad of problems with the ACP/Plugins page

- Fixed #3350
- Fixed issue where the normalised API return would have the wrong id for all plugins
- Fixed issue where uninstalling a locally installed plugin via ACP would cause NodeBB to crash
- Simplified ACP/Plugins client-side code to simply refresh the page after installing or uninstalling a plugin.
This commit is contained in:
Julian Lam
2015-08-06 12:41:16 -04:00
parent f53fb19468
commit e60194292f
2 changed files with 6 additions and 17 deletions

View File

@@ -186,22 +186,7 @@ define('admin/extend/plugins', function() {
return app.alertError(err.message);
}
var targetList = (pluginData.installed ? 'installed' : 'download'),
otherList = (pluginData.installed ? 'download' : 'installed'),
payload = {};
payload[targetList] = pluginData;
templates.parse('admin/partials/' + targetList + '_plugin_item', payload, function(html) {
var pluginList = $('ul.' + targetList);
pluginList.append(html);
$('ul.' + otherList).find('li[data-plugin-id="' + pluginID + '"]').slideUp('slow', function() {
$(this).remove();
$('html,body').animate({
scrollTop: pluginList.find('li').last().offset().top - 48
}, 1000);
});
});
ajaxify.refresh();
app.alert({
alert_id: 'plugin_toggled',