#328665 Remove validation of LocationURL field for events and assume http:// when no protocol is given.

This commit is contained in:
Georgi Prodanov 2017-02-09 16:59:46 +02:00
Родитель 0b46634275
Коммит 92d5da1b7f
2 изменённых файлов: 12 добавлений и 4 удалений

Просмотреть файл

@ -168,7 +168,12 @@ export class EventDetailsComponent implements OnInit {
}
showLocation() {
nsUtils.openUrl(this.event.LocationURL);
let url = this.event.LocationURL;
if (!utilities.urlHasProtocol(url)) {
url = 'http://' + url;
}
console.log('opening url: ' + url);
nsUtils.openUrl(url);
}
toggleExpandedUsers() {
@ -184,7 +189,12 @@ export class EventDetailsComponent implements OnInit {
}
getVoteText(date: string) {
return ` - ${this._countByDate[date] || 0} votes`
let voteCount = this._countByDate[date] || 0;
let text = ` - ${voteCount} vote`;
if (voteCount !== 1) {
text += 's';
}
return text;
}
userVotedForDate(date: Date) {

Просмотреть файл

@ -172,8 +172,6 @@ export class EventsService {
if (!event.EventDate && (!event.EventDateChoices || event.EventDateChoices.length === 0)) {
errorMsg = 'Must specify at least one event date option.';
} else if (utilities.isNonemptyString(event.LocationURL) && !utilities.urlHasProtocol(event.LocationURL)) {
errorMsg = 'The Location URL requires a protocol.';
}
return errorMsg;