Added assignment poll and assignment related user to js
This commit is contained in:
parent
ec600c98f8
commit
e67897941e
@ -29,7 +29,8 @@ class AssignmentRelatedUserSerializer(ModelSerializer):
|
|||||||
fields = (
|
fields = (
|
||||||
'id',
|
'id',
|
||||||
'user',
|
'user',
|
||||||
'status')
|
'status',
|
||||||
|
'assignment') # js-data needs the assignment-id in the nested object to define relations.
|
||||||
|
|
||||||
|
|
||||||
class AssignmentVoteSerializer(ModelSerializer):
|
class AssignmentVoteSerializer(ModelSerializer):
|
||||||
@ -91,7 +92,8 @@ class AssignmentAllPollSerializer(ModelSerializer):
|
|||||||
'votesvalid',
|
'votesvalid',
|
||||||
'votesinvalid',
|
'votesinvalid',
|
||||||
'votescast',
|
'votescast',
|
||||||
'votes',)
|
'votes',
|
||||||
|
'assignment') # js-data needs the assignment-id in the nested object to define relations.
|
||||||
read_only_fields = ('yesnoabstain',)
|
read_only_fields = ('yesnoabstain',)
|
||||||
|
|
||||||
@transaction.atomic
|
@transaction.atomic
|
||||||
|
@ -4,10 +4,47 @@
|
|||||||
|
|
||||||
angular.module('OpenSlidesApp.assignments', [])
|
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', [
|
.factory('Assignment', [
|
||||||
'DS',
|
'DS',
|
||||||
|
'AssignmentRelatedUser',
|
||||||
|
'AssignmentPoll',
|
||||||
'jsDataModel',
|
'jsDataModel',
|
||||||
function(DS, jsDataModel) {
|
function (DS, AssignmentRelatedUser, AssignmentPoll, jsDataModel) {
|
||||||
var name = 'assignments/assignment';
|
var name = 'assignments/assignment';
|
||||||
return DS.defineResource({
|
return DS.defineResource({
|
||||||
name: name,
|
name: name,
|
||||||
@ -27,6 +64,16 @@ angular.module('OpenSlidesApp.assignments', [])
|
|||||||
localKey: 'agenda_item_id',
|
localKey: 'agenda_item_id',
|
||||||
localField: 'agenda_item',
|
localField: 'agenda_item',
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
hasMany: {
|
||||||
|
'core/tag': {
|
||||||
|
localField: 'tags',
|
||||||
|
localKeys: 'tags_id',
|
||||||
|
},
|
||||||
|
'assignments/relateduser': {
|
||||||
|
localField: 'assignment_related_users',
|
||||||
|
foreignKey: 'assignment_id',
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -24,13 +24,18 @@
|
|||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{ assignment.agenda_item }}
|
Agenda Item: {{ assignment.agenda_item }}
|
||||||
|
|
||||||
|
|
||||||
<h3 translate>Description</h3>
|
<h3 translate>Description</h3>
|
||||||
<div class="white-space-pre-line">{{ assignment.description }}</div>
|
<div class="white-space-pre-line">{{ assignment.description }}</div>
|
||||||
|
|
||||||
<h3 translate>Candidates</h3>
|
<h3 translate>Candidates</h3>
|
||||||
<!-- TODO -->
|
<ul>
|
||||||
|
<li ng-repeat="related_user in assignment.assignment_related_users" ng-if="related_user.status == 1">
|
||||||
|
User: {{ related_user.user.get_full_name() }}
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
<h3 translate>Election result</h3>
|
<h3 translate>Election result</h3>
|
||||||
<!-- TODO -->
|
<!-- TODO -->
|
||||||
|
Loading…
Reference in New Issue
Block a user