(js,html) Allow the removable of attendees

pull/110/head
Francis Lachapelle 2015-10-02 11:21:43 -04:00
parent 42d306a24b
commit d27c792324
4 changed files with 31 additions and 1 deletions

View File

@ -232,8 +232,11 @@
<div class="md-contact-avatar">
<sg-avatar-image sg-email="$chip.email" size="32"><!-- avatar --></sg-avatar-image>
</div>
<div class="md-contact-name">{{$chip.name}}</div>
<div class="md-contact-name">{{$chip.name || $chip.email}}</div>
<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>
</md-chip-template>
</md-chips>
<div ng-show="editor.showAttendeesEditor" class="attendees">

View File

@ -24,6 +24,11 @@
<div class="sg-md-subhead"><div>{{currentAttendee.name}}</div></div>
<div class="sg-md-body"><div>{{currentAttendee.email}}</div></div>
</div>
<md-button class="md-icon-button"
label:aria-label="Delete"
ng-click="editor.component.deleteAttendee(currentAttendee)">
<md-icon>close</md-icon>
</md-button>
</md-list-item>
</md-list>
<!-- freebusy -->

View File

@ -739,6 +739,19 @@
return angular.isDefined(attendee);
};
/**
* @function deleteAttendee
* @memberof Component.prototype
* @desc Remove an attendee from the component
* @param {Object} attendee - an object literal defining an attendee
*/
Component.prototype.deleteAttendee = function(attendee) {
var index = _.findIndex(this.attendees, function(currentAttendee) {
return currentAttendee.email == attendee.email;
});
this.attendees.splice(index, 1);
};
/**
* @function canRemindAttendeesByEmail
* @memberof Component.prototype

View File

@ -12,6 +12,15 @@ md-chips {
.md-chip-content {
max-width: initial; // fix bug in ng-material
}
// Custom 'chip remove' button used with chips in readonly mode
.sg-chip-remove {
&:hover {
cursor: pointer;
}
height: $chip-delete-icon-size;
width: $chip-delete-icon-size;
line-height: $chip-delete-icon-size;
}
}
}
}