Handle attach URLs in appointment editor

This commit is contained in:
Francis Lachapelle
2015-07-01 14:34:35 -04:00
parent ba5f6410ed
commit 35ff82710a
10 changed files with 156 additions and 19 deletions

View File

@@ -514,6 +514,41 @@
this.attendees && this.attendees.length > 0;
};
/**
* @function addAttachUrl
* @memberof Component.prototype
* @desc Add a new attach URL if not already defined
* @param {string} attachUrl - the URL
* @returns the number of values in the list of attach URLs
*/
Component.prototype.addAttachUrl = function(attachUrl) {
if (angular.isUndefined(this.attachUrls)) {
this.attachUrls = [{value: attachUrl}];
}
else {
for (var i = 0; i < this.attachUrls.length; i++) {
if (this.attachUrls[i].value == attachUrl) {
break;
}
}
if (i == this.attachUrls.length)
this.attachUrls.push({value: attachUrl});
}
return this.attachUrls.length - 1;
};
/**
* @function deleteAttachUrl
* @memberof Component.prototype
* @desc Remove an attach URL
* @param {number} index - the URL index in the list of attach URLs
*/
Component.prototype.deleteAttachUrl = function(index) {
if (index > -1 && this.attachUrls.length > index) {
this.attachUrls.splice(index, 1);
}
};
/**
* @function $reset
* @memberof Component.prototype

View File

@@ -20,6 +20,7 @@
vm.cardFilter = cardFilter;
vm.cardResults = [];
vm.addAttendee = addAttendee;
vm.addAttachUrl = addAttachUrl;
vm.cancel = cancel;
vm.save = save;
vm.attendeesEditor = {
@@ -67,6 +68,11 @@
}
});
function addAttachUrl() {
var i = vm.component.addAttachUrl('');
focus('attachUrl_' + i);
};
function toggleRecurrenceEditor() {
vm.showRecurrenceEditor = !vm.showRecurrenceEditor;
vm.component.$hasCustomRepeat = vm.showRecurrenceEditor;