diff --git a/openslides/assignments/serializers.py b/openslides/assignments/serializers.py index 1ba376353..e46bf2efd 100644 --- a/openslides/assignments/serializers.py +++ b/openslides/assignments/serializers.py @@ -29,7 +29,8 @@ class AssignmentRelatedUserSerializer(ModelSerializer): fields = ( 'id', 'user', - 'status') + 'status', + 'assignment') # js-data needs the assignment-id in the nested object to define relations. class AssignmentVoteSerializer(ModelSerializer): @@ -91,7 +92,8 @@ class AssignmentAllPollSerializer(ModelSerializer): 'votesvalid', 'votesinvalid', 'votescast', - 'votes',) + 'votes', + 'assignment') # js-data needs the assignment-id in the nested object to define relations. read_only_fields = ('yesnoabstain',) @transaction.atomic diff --git a/openslides/assignments/static/js/assignments/base.js b/openslides/assignments/static/js/assignments/base.js index e66d21320..734177ab2 100644 --- a/openslides/assignments/static/js/assignments/base.js +++ b/openslides/assignments/static/js/assignments/base.js @@ -4,10 +4,47 @@ angular.module('OpenSlidesApp.assignments', []) +.factory('AssignmentPoll', [ + 'DS', + 'Config', + function (DS, Config) { + return DS.defineResource({ + name: 'assignments/poll', + relations: { + belongsTo: { + 'assignments/assignment': { + localField: 'assignment', + localKey: 'assignment_id', + } + } + }, + }) + } +]) + +.factory('AssignmentRelatedUser', [ + 'DS', + function (DS) { + return DS.defineResource({ + name: 'assignments/relateduser', + relations: { + belongsTo: { + 'users/user': { + localField: 'user', + localKey: 'user_id', + } + } + } + }) + } +]) + .factory('Assignment', [ 'DS', + 'AssignmentRelatedUser', + 'AssignmentPoll', 'jsDataModel', - function(DS, jsDataModel) { + function (DS, AssignmentRelatedUser, AssignmentPoll, jsDataModel) { var name = 'assignments/assignment'; return DS.defineResource({ name: name, @@ -27,6 +64,16 @@ angular.module('OpenSlidesApp.assignments', []) localKey: 'agenda_item_id', localField: 'agenda_item', } + }, + hasMany: { + 'core/tag': { + localField: 'tags', + localKeys: 'tags_id', + }, + 'assignments/relateduser': { + localField: 'assignment_related_users', + foreignKey: 'assignment_id', + } } } }); diff --git a/openslides/assignments/static/templates/assignments/assignment-detail.html b/openslides/assignments/static/templates/assignments/assignment-detail.html index 35224dbe2..ce4d168f2 100644 --- a/openslides/assignments/static/templates/assignments/assignment-detail.html +++ b/openslides/assignments/static/templates/assignments/assignment-detail.html @@ -24,13 +24,18 @@ -{{ assignment.agenda_item }} +Agenda Item: {{ assignment.agenda_item }} +

Description

{{ assignment.description }}

Candidates

- +

Election result