Skip to content

Commit

Permalink
feat: dedicated sorting buttons for plugin ordering in ACP
Browse files Browse the repository at this point in the history
  • Loading branch information
psychobunny committed Sep 30, 2020
1 parent c56236f commit 1761e13
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
17 changes: 17 additions & 0 deletions public/less/admin/extend/plugins.less
Expand Up @@ -22,6 +22,23 @@
.plugin-list.ui-sortable {
li {
.pointer;

.fa-chevron-up {
margin-right: 10px;
}

.fa-chevron-up, .fa-chevron-down {
border: 1px solid;
border-radius: 50%;
padding: 3px;
vertical-align: 1px;
background-color: white;
}

&:first-child .fa-chevron-up, &:last-child .fa-chevron-down {
pointer-events: none;
color: @gray-light;
}
}
}
.controls .btn {
Expand Down
15 changes: 13 additions & 2 deletions public/src/admin/extend/plugins.js
Expand Up @@ -168,15 +168,26 @@ define('admin/extend/plugins', ['jqueryui', 'translator', 'benchpress'], functio
}
var html = '';
activePlugins.forEach(function (plugin) {
html += '<li class="">' + plugin + '</li>';
html += '<li class="">' + plugin + '<span class="pull-right"><i class="fa fa-chevron-up"></i><i class="fa fa-chevron-down"></i></span></li>';
});
if (!activePlugins.length) {
translator.translate('[[admin/extend/plugins:none-active]]', function (text) {
$('#order-active-plugins-modal .plugin-list').html(text).sortable();
});
return;
}
$('#order-active-plugins-modal .plugin-list').html(html).sortable();
var list = $('#order-active-plugins-modal .plugin-list');
list.html(html).sortable();

list.find('.fa-chevron-up').on('click', function () {
var item = $(this).parents('li');
item.prev().before(item);
});

list.find('.fa-chevron-down').on('click', function () {
var item = $(this).parents('li');
item.next().after(item);
});
});
});

Expand Down

0 comments on commit 1761e13

Please sign in to comment.