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) {
|
.controller('ItemListCtrl', function($scope, Agenda, i18n) {
|
||||||
Agenda.bindAll($scope, 'items');
|
Agenda.bindAll({}, $scope, 'items');
|
||||||
$scope.test_plural = i18n.ngettext('test', 'tests', 2);
|
$scope.test_plural = i18n.ngettext('test', 'tests', 2);
|
||||||
$scope.test_singular = i18n.ngettext('test', 'tests', 1);
|
$scope.test_singular = i18n.ngettext('test', 'tests', 1);
|
||||||
})
|
})
|
||||||
|
@ -109,10 +109,10 @@ class AssignmentFullSerializer(ModelSerializer):
|
|||||||
model = Assignment
|
model = Assignment
|
||||||
fields = (
|
fields = (
|
||||||
'id',
|
'id',
|
||||||
'name',
|
'title',
|
||||||
'description',
|
'description',
|
||||||
'posts',
|
'open_posts',
|
||||||
'status',
|
'phase',
|
||||||
'related_users',
|
'related_users',
|
||||||
'poll_description_default',
|
'poll_description_default',
|
||||||
'polls',
|
'polls',
|
||||||
@ -130,10 +130,10 @@ class AssignmentShortSerializer(AssignmentFullSerializer):
|
|||||||
model = Assignment
|
model = Assignment
|
||||||
fields = (
|
fields = (
|
||||||
'id',
|
'id',
|
||||||
'name',
|
'title',
|
||||||
'description',
|
'description',
|
||||||
'posts',
|
'open_posts',
|
||||||
'status',
|
'phase',
|
||||||
'related_users',
|
'related_users',
|
||||||
'poll_description_default',
|
'poll_description_default',
|
||||||
'polls',
|
'polls',
|
||||||
|
@ -42,17 +42,17 @@ angular.module('OpenSlidesApp.assignments', [])
|
|||||||
})
|
})
|
||||||
|
|
||||||
.controller('AssignmentListCtrl', function($scope, Assignment) {
|
.controller('AssignmentListCtrl', function($scope, Assignment) {
|
||||||
Assignment.bindAll($scope, 'assignments');
|
Assignment.bindAll({}, $scope, 'assignments');
|
||||||
})
|
})
|
||||||
|
|
||||||
.controller('AssignmentDetailCtrl', function($scope, Assignment, assignment) {
|
.controller('AssignmentDetailCtrl', function($scope, Assignment, assignment) {
|
||||||
Assignment.bindOne($scope, 'assignment', assignment.id)
|
Assignment.bindOne(assignment.id, $scope, 'assignment')
|
||||||
})
|
})
|
||||||
|
|
||||||
.controller('AssignmentCreateCtrl', function($scope, Assignment) {
|
.controller('AssignmentCreateCtrl', function($scope, Assignment) {
|
||||||
$scope.assignment = {};
|
$scope.assignment = {};
|
||||||
$scope.save = function(assignment) {
|
$scope.save = function(assignment) {
|
||||||
assignment.posts = 1;
|
assignment.open_posts = 1;
|
||||||
assignment.tags = []; // TODO: the rest_api should do this
|
assignment.tags = []; // TODO: the rest_api should do this
|
||||||
Assignment.create(assignment);
|
Assignment.create(assignment);
|
||||||
// TODO: redirect to list-view
|
// TODO: redirect to list-view
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
<h1>{{ assignment.name }}</h1>
|
<h1>{{ assignment.title }}</h1>
|
||||||
{{ assignment.description }}
|
{{ 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>
|
<h1 ng-if="!assignment.id">Neue Assignment</h1>
|
||||||
|
|
||||||
<form>
|
<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>
|
Beschreibung:<br> <textarea ng-model="assignment.description"></textarea><br>
|
||||||
<input type="submit" ng-click="save(assignment)" value="Save" />
|
<input type="submit" ng-click="save(assignment)" value="Save" />
|
||||||
</form>
|
</form>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<ul>
|
<ul>
|
||||||
<li ng-repeat="assignment in assignments">
|
<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>
|
<a ui-sref="assignments.assignment.detail.update({id: assignment.id })">Bearbeiten</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -97,8 +97,14 @@ angular.module('OpenSlidesApp.core', [])
|
|||||||
autoupdate.on_message(function(data) {
|
autoupdate.on_message(function(data) {
|
||||||
// TODO: when MODEL.find() is called after this
|
// TODO: when MODEL.find() is called after this
|
||||||
// a new request is fired. This could be a bug in DS
|
// 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) {
|
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
|
// TODO: handle other statuscodes
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user