Autoupdate for delete views
Fixes: #1495 Also fixed the (example) assignment angular code
This commit is contained in:
parent
d0d01ed71c
commit
86c189c964
@ -41,7 +41,7 @@ angular.module('OpenSlidesApp.agenda', [])
|
||||
})
|
||||
|
||||
.controller('ItemListCtrl', function($scope, Agenda, i18n) {
|
||||
Agenda.bindAll($scope, 'items');
|
||||
Agenda.bindAll({}, $scope, 'items');
|
||||
$scope.test_plural = i18n.ngettext('test', 'tests', 2);
|
||||
$scope.test_singular = i18n.ngettext('test', 'tests', 1);
|
||||
})
|
||||
|
@ -109,10 +109,10 @@ class AssignmentFullSerializer(ModelSerializer):
|
||||
model = Assignment
|
||||
fields = (
|
||||
'id',
|
||||
'name',
|
||||
'title',
|
||||
'description',
|
||||
'posts',
|
||||
'status',
|
||||
'open_posts',
|
||||
'phase',
|
||||
'related_users',
|
||||
'poll_description_default',
|
||||
'polls',
|
||||
@ -130,10 +130,10 @@ class AssignmentShortSerializer(AssignmentFullSerializer):
|
||||
model = Assignment
|
||||
fields = (
|
||||
'id',
|
||||
'name',
|
||||
'title',
|
||||
'description',
|
||||
'posts',
|
||||
'status',
|
||||
'open_posts',
|
||||
'phase',
|
||||
'related_users',
|
||||
'poll_description_default',
|
||||
'polls',
|
||||
|
@ -42,17 +42,17 @@ angular.module('OpenSlidesApp.assignments', [])
|
||||
})
|
||||
|
||||
.controller('AssignmentListCtrl', function($scope, Assignment) {
|
||||
Assignment.bindAll($scope, 'assignments');
|
||||
Assignment.bindAll({}, $scope, 'assignments');
|
||||
})
|
||||
|
||||
.controller('AssignmentDetailCtrl', function($scope, Assignment, assignment) {
|
||||
Assignment.bindOne($scope, 'assignment', assignment.id)
|
||||
Assignment.bindOne(assignment.id, $scope, 'assignment')
|
||||
})
|
||||
|
||||
.controller('AssignmentCreateCtrl', function($scope, Assignment) {
|
||||
$scope.assignment = {};
|
||||
$scope.save = function(assignment) {
|
||||
assignment.posts = 1;
|
||||
assignment.open_posts = 1;
|
||||
assignment.tags = []; // TODO: the rest_api should do this
|
||||
Assignment.create(assignment);
|
||||
// TODO: redirect to list-view
|
||||
|
@ -1,2 +1,2 @@
|
||||
<h1>{{ assignment.name }}</h1>
|
||||
<h1>{{ assignment.title }}</h1>
|
||||
{{ assignment.description }}
|
||||
|
@ -1,8 +1,8 @@
|
||||
<h1 ng-if="assignment.id">{{ assignment.name }}</h1>
|
||||
<h1 ng-if="assignment.id">{{ assignment.title }}</h1>
|
||||
<h1 ng-if="!assignment.id">Neue Assignment</h1>
|
||||
|
||||
<form>
|
||||
Titel: <input type="text" ng-model="assignment.name"><br>
|
||||
Titel: <input type="text" ng-model="assignment.title"><br>
|
||||
Beschreibung:<br> <textarea ng-model="assignment.description"></textarea><br>
|
||||
<input type="submit" ng-click="save(assignment)" value="Save" />
|
||||
</form>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<ul>
|
||||
<li ng-repeat="assignment in assignments">
|
||||
<a ui-sref="assignments.assignment.detail({id: assignment.id })">{{ assignment.name }}</a>
|
||||
<a ui-sref="assignments.assignment.detail({id: assignment.id })">{{ assignment.title }}</a>
|
||||
<a ui-sref="assignments.assignment.detail.update({id: assignment.id })">Bearbeiten</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -97,8 +97,14 @@ angular.module('OpenSlidesApp.core', [])
|
||||
autoupdate.on_message(function(data) {
|
||||
// TODO: when MODEL.find() is called after this
|
||||
// a new request is fired. This could be a bug in DS
|
||||
|
||||
// TODO: Do not send the status code to the client, but make the decission
|
||||
// on the server side. It is an implementation detail, that tornado
|
||||
// sends request to wsgi, which should not concern the client.
|
||||
if (data.status_code == 200) {
|
||||
DS.inject(data.collection, data.data)
|
||||
DS.inject(data.collection, data.data);
|
||||
} else if (data.status_code == 404) {
|
||||
DS.eject(data.collection, data.id);
|
||||
}
|
||||
// TODO: handle other statuscodes
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user