(js) Display the attendees editor automatically

This commit is contained in:
Francis Lachapelle 2017-03-10 14:48:53 -05:00
parent 19512a85d2
commit f60ffa923e

View file

@ -218,7 +218,7 @@
vm.showRecurrenceEditor = vm.component.$hasCustomRepeat; vm.showRecurrenceEditor = vm.component.$hasCustomRepeat;
vm.toggleRecurrenceEditor = toggleRecurrenceEditor; vm.toggleRecurrenceEditor = toggleRecurrenceEditor;
vm.recurrenceMonthDaysAreRequired = recurrenceMonthDaysAreRequired; vm.recurrenceMonthDaysAreRequired = recurrenceMonthDaysAreRequired;
vm.showAttendeesEditor = false; vm.showAttendeesEditor = vm.component.attendees && vm.component.attendees.length;
vm.toggleAttendeesEditor = toggleAttendeesEditor; vm.toggleAttendeesEditor = toggleAttendeesEditor;
//vm.searchText = null; //vm.searchText = null;
vm.cardFilter = cardFilter; vm.cardFilter = cardFilter;
@ -276,15 +276,18 @@
} }
function addAttendee(card) { function addAttendee(card) {
var automaticallyExapand = (!vm.component.attendees || vm.component.attendees.length === 0);
if (angular.isString(card)) { if (angular.isString(card)) {
// User pressed "Enter" in search field, adding a non-matching card // User pressed "Enter" in search field, adding a non-matching card
if (card.isValidEmail()) { if (card.isValidEmail()) {
vm.component.addAttendee(new Card({ emails: [{ value: card }] })); vm.component.addAttendee(new Card({ emails: [{ value: card }] }));
vm.showAttendeesEditor |= automaticallyExapand;
vm.searchText = ''; vm.searchText = '';
} }
} }
else { else {
vm.component.addAttendee(card); vm.component.addAttendee(card);
vm.showAttendeesEditor |= automaticallyExapand;
} }
} }