v1.18.x
barisusakli 10 years ago
parent 26cfe4a3c3
commit ad4fff649c

@ -34,19 +34,23 @@ define('forum/admin/extend/plugins', function() {
pluginID = $(this).parents('li').attr('data-plugin-id'); pluginID = $(this).parents('li').attr('data-plugin-id');
var btn = $(this); var btn = $(this);
var activateBtn = btn.siblings('[data-action="toggleActive"]');
btn.html(btn.html() + 'ing') btn.html(btn.html() + 'ing')
.attr('disabled', true) .attr('disabled', true)
.find('i').attr('class', 'fa fa-refresh fa-spin'); .find('i').attr('class', 'fa fa-refresh fa-spin');
socket.emit('admin.plugins.toggleInstall', pluginID, function(err, status) { socket.emit('admin.plugins.toggleInstall', pluginID, function(err, status) {
var activateBtn = $('<button data-action="toggleActive" class="btn btn-success"><i class="fa fa-power-off"></i> Activate</button>'); if (err) {
return app.alertError(err.message);
}
if (status.installed) { if (status.installed) {
btn.html('<i class="fa fa-trash-o"></i> Uninstall'); btn.html('<i class="fa fa-trash-o"></i> Uninstall');
activateBtn.insertBefore(btn);
} else { } else {
btn.html('<i class="fa fa-download"></i> Install'); btn.html('<i class="fa fa-download"></i> Install');
} }
activateBtn.toggleClass('hidden', !status.installed);
btn.toggleClass('btn-danger', status.installed).toggleClass('btn-success', !status.installed) btn.toggleClass('btn-danger', status.installed).toggleClass('btn-success', !status.installed)
.attr('disabled', false); .attr('disabled', false);

@ -36,6 +36,7 @@
<!-- IF !plugins.installed --> <!-- IF !plugins.installed -->
<li data-plugin-id="{plugins.id}" class="clearfix"> <li data-plugin-id="{plugins.id}" class="clearfix">
<div class="pull-right"> <div class="pull-right">
<button data-action="toggleActive" class="btn btn-success hidden"><i class="fa fa-power-off"></i> Activate</button>
<button data-action="toggleInstall" class="btn btn-success"><i class="fa fa-download"></i> Install</button> <button data-action="toggleInstall" class="btn btn-success"><i class="fa fa-download"></i> Install</button>
</div> </div>

Loading…
Cancel
Save