Show allert in sort template if agenda sort request failed.

This commit is contained in:
Emanuel Schütze 2017-02-17 21:59:13 +01:00
parent aa14ac99b3
commit 9ae1d7e59a
2 changed files with 14 additions and 1 deletions

View File

@ -585,6 +585,7 @@ angular.module('OpenSlidesApp.agenda.site', [
$scope.items = AgendaTree.getTree(Agenda.getAll());
});
$scope.showInternalItems = true;
$scope.alert = {};
// save parent and weight of moved agenda item (and all items on same level)
$scope.treeOptions = {
@ -594,7 +595,15 @@ angular.module('OpenSlidesApp.agenda.site', [
if (event.dest.nodesScope.item) {
parentID = event.dest.nodesScope.item.id;
}
$http.post('/rest/agenda/item/sort/', {nodes: event.dest.nodesScope.$modelValue, parent_id: parentID});
$http.post('/rest/agenda/item/sort/', {
nodes: event.dest.nodesScope.$modelValue,
parent_id: parentID}
).then(
function(success) {},
function(error){
$scope.alert = {type: 'danger', msg: error.data.detail, show: true};
}
);
}
};
}

View File

@ -19,6 +19,10 @@
<translate ng-if="!showInternalItems">Show internal items</translate>
</button>
<div uib-alert ng-show="alert.show" ng-class="'alert-' + (alert.type || 'warning')" ng-click="alert={}" close="alert={}">
{{ alert.msg }}
</div>
<div ui-tree="treeOptions" id="tree-root">
<ol ui-tree-nodes ng-model="items">
<li ng-repeat="item in items" ui-tree-node ng-include="'nodes_renderer.html'">