Adds in Sort Angular dialog from Mads & removes some of the old sort dialog parts

This commit is contained in:
Warren
2018-08-02 13:52:13 +01:00
parent 08991dc98c
commit 6967ed1846
6 changed files with 137 additions and 11 deletions

View File

@@ -0,0 +1,78 @@
(function () {
"use strict";
function ContentSortController($scope, $timeout) {
var vm = this;
vm.loading = false;
vm.nodes = [];
vm.saveButtonState = "init";
vm.sortableOptions = {
distance: 10,
tolerance: "pointer",
opacity: 0.7,
scroll: true,
cursor: "move",
helper: fixSortableHelper
};
vm.save = save;
function activate() {
vm.loading = true;
// fake loading
$timeout(function () {
vm.loading = false;
vm.nodes = [
{
"name": "Node 1",
"creationDate": "date",
"sortOrder": 0
},
{
"name": "Node 2",
"creationDate": "date",
"sortOrder": 1
},
{
"name": "Node 3",
"creationDate": "date",
"sortOrder": 2
}
];
}, 1000);
}
function save() {
console.log(vm.nodes);
vm.saveButtonState = "busy";
// fake loading
$timeout(function () {
vm.saveButtonState = "success";
}, 1000);
}
function fixSortableHelper(e, ui) {
// keep the correct width of each table cell when sorting
ui.children().each(function () {
$(this).width($(this).width());
});
return ui;
}
activate();
}
angular.module("umbraco").controller("Umbraco.Editors.Content.SortController", ContentSortController);
})();

View File

@@ -0,0 +1,54 @@
<div ng-controller="Umbraco.Editors.Content.SortController as vm" ng-cloak>
<div class="umb-dialog-body with-footer">
<div class="umb-pane">
<umb-load-indicator
ng-show="vm.loading">
</umb-load-indicator>
<div ng-if="!vm.loading">
<p class="abstract"><localize key="sort_sortHelp"></localize></p>
<table class="table">
<thead>
<tr>
<th class="w-100"><localize key="general_name"></localize></th>
<th class="nowrap"><localize key="sort_sortCreationDate"></localize></th>
<th class="nowrap"><localize key="sort_sortOrder"></localize></th>
</tr>
</thead>
<tbody ui-sortable="vm.sortableOptions" ng-model="vm.nodes">
<tr ng-repeat="node in vm.nodes" class="cursor-move">
<td>{{ node.name }}</td>
<td>{{ node.creationDate }}</td>
<td>{{ node.sortOrder }}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="umb-dialog-footer btn-toolbar umb-btn-toolbar">
<a class="btn btn-link" ng-click="nav.hideDialog()">
<localize key="general_cancel">Cancel</localize>
</a>
<umb-button
type="button"
action="vm.save()"
state="vm.saveButtonState"
button-style="success"
label-key="buttons_save">
</umb-button>
</div>
</div>