(js) Improve event editor (attendees list)

Respect SOGoSearchMinimumWordLength and hide detailed view after
deleting the last attendee.
This commit is contained in:
Francis Lachapelle
2016-02-29 13:59:31 -05:00
parent da2067dd86
commit 1d25944c43
2 changed files with 11 additions and 3 deletions
@@ -211,7 +211,7 @@
</div>
<!-- attendees -->
<div class="sg-form-section">
<div layout="row" layout-align="start start">
<div layout="row" layout-align="start center">
<md-icon>search</md-icon>
<md-autocomplete class="md-flex"
label:md-floating-label="Invite Attendees"
@@ -220,7 +220,7 @@
md-selected-item-change="editor.addAttendee(card)"
md-items="card in editor.cardFilter(editor.searchText)"
md-item-text="card.empty"
md-min-length="3"
var:md-min-length="minimumSearchLength"
md-delay="300"
md-no-cache="true"
sg-enter="editor.addAttendee(editor.searchText)">
@@ -237,6 +237,7 @@
</md-autocomplete>
<md-button type="button" class="sg-icon-button"
label:aria-label="repeat_CUSTOM"
ng-show="editor.component.attendees.length"
ng-click="editor.toggleAttendeesEditor()">
<md-icon ng-class="{'md-rotate-180': editor.showAttendeesEditor}">expand_more</md-icon>
</md-button>
@@ -255,7 +256,7 @@
<md-icon ng-class="'icon-' + $chip.status"><!-- partstat --></md-icon>
<md-icon class="sg-chip-remove"
label:aria-label="Delete"
ng-click="editor.component.deleteAttendee($chip)">close</md-icon>
ng-click="editor.removeAttendee($chip)">close</md-icon>
</md-chip-template>
</md-chips>
<div ng-show="editor.showAttendeesEditor" class="attendees">
@@ -159,6 +159,7 @@
//vm.searchText = null;
vm.cardFilter = cardFilter;
vm.addAttendee = addAttendee;
vm.removeAttendee = removeAttendee;
vm.addAttachUrl = addAttachUrl;
vm.cancel = cancel;
vm.save = save;
@@ -218,6 +219,12 @@
}
}
function removeAttendee(attendee) {
vm.component.deleteAttendee(attendee);
if (vm.component.attendees.length === 0)
vm.showAttendeesEditor = false;
}
function save(form, options) {
if (form.$valid) {
vm.component.$save(options)