diff --git a/src/app/core/models/poll.model.ts b/src/app/core/models/poll.model.ts index 2883d1fe..dbd9bbbc 100644 --- a/src/app/core/models/poll.model.ts +++ b/src/app/core/models/poll.model.ts @@ -24,7 +24,7 @@ export class Poll { public expiracy_date?: string; - public creation_date?: string; + public creation_date?: string = new Date().toISOString(); public creatorPseudo?: string; diff --git a/src/app/core/services/poll.service.ts b/src/app/core/services/poll.service.ts index 644bdeb5..24bf1817 100644 --- a/src/app/core/services/poll.service.ts +++ b/src/app/core/services/poll.service.ts @@ -137,6 +137,11 @@ export class PollService implements Resolve { poll.owner.pseudo + '_' + poll.title; + + return this.convertTextToSlug(str) + '-' + this.uuidService.getUUID(); + } + + public convertTextToSlug(str: string) { str = str.replace(/^\s+|\s+$/g, ''); // trim str = str.toLowerCase(); @@ -151,25 +156,7 @@ export class PollService implements Resolve { .replace(/[^a-z0-9 -]/g, '') // remove invalid chars .replace(/\s+/g, '-') // collapse whitespace and replace by - .replace(/-+/g, '-'); // collapse dashes - - return str + '-' + this.uuidService.getUUID(); - } - - public async saveCurrentPoll(): Promise { - // .then((resp) => { - // console.log('resp', resp); - // if (pollUrl) { - // console.log('pollUrl', pollUrl); - // this.toastService.display('Le sondage a été enregistré.'); - // // TODO: redirect to view - // } else { - // this.toastService.display('Le sondage n’a été correctement enregistré, veuillez ré-essayer.'); - // } - // }) - // .catch((err) => { - // console.error('err', err); - // }); - return await this.apiService.createPoll(this._poll.getValue()); + return str; } public saveParticipation(choice: Choice, user: Owner, response: Answer): void { diff --git a/src/app/features/administration/form/base-config/base-config.component.html b/src/app/features/administration/form/base-config/base-config.component.html index 2adc91b0..b61aed25 100644 --- a/src/app/features/administration/form/base-config/base-config.component.html +++ b/src/app/features/administration/form/base-config/base-config.component.html @@ -14,20 +14,18 @@ - - - +
Ce champ est requis - +