custom fields in person edit form

This commit is contained in:
Davide Alberani 2015-04-18 17:52:36 +02:00
parent e7da9e557d
commit 70f35f4139
2 changed files with 9 additions and 3 deletions

View file

@ -156,7 +156,6 @@ eventManControllers.controller('PersonsListCtrl', ['$scope', 'Person', 'Setting'
$scope.persons = Person.all();
$scope.personsOrderProp = 'name';
$scope.eventsOrderProp = '-begin-date';
$scope.customFields = Setting.query({setting: 'person_custom_field',
in_persons_list: true});
@ -177,11 +176,12 @@ eventManControllers.controller('PersonsListCtrl', ['$scope', 'Person', 'Setting'
);
eventManControllers.controller('PersonDetailsCtrl', ['$scope', '$stateParams', 'Person', 'Event', '$log',
function ($scope, $stateParams, Person, Event, $log) {
eventManControllers.controller('PersonDetailsCtrl', ['$scope', '$stateParams', 'Person', 'Event', 'Setting', '$log',
function ($scope, $stateParams, Person, Event, Setting, $log) {
$scope.personsOrderProp = 'name';
$scope.eventsOrderProp = '-begin-date';
$scope.addToEvent = '';
$scope.customFields = Setting.query({setting: 'person_custom_field'});
if ($stateParams.id) {
$scope.person = Person.get($stateParams);

View file

@ -42,6 +42,12 @@
<tr ng-repeat="event in events | splittedFilter:query | orderBy:eventsOrderProp">
</div>
<div ng-repeat="custom in customFields" class="form-group top5">
<label for="custom_{{custom['key']}}">{{custom.label | translate}}</span>
<input ng-if="custom.type == 'boolean'" id="custom_{{custm['key']}}" type="checkbox" class="form-control" placeholder="{{custom.label | translate}}" ng-model="person[custom.key]">
<input ng-if="custom.type != 'boolean'" id="custom_{{custm['key']}}" type="text" class="form-control" placeholder="{{custom.label | translate}}" ng-model="person[custom.key]">
</div>
<input type="submit" style="position: absolute; left: -9999px; width: 1px; height: 1px;"/>
</form>
</div>