diff --git a/src/app/core/services/poll.service.ts b/src/app/core/services/poll.service.ts index 24bf1817..a3a9b9b5 100644 --- a/src/app/core/services/poll.service.ts +++ b/src/app/core/services/poll.service.ts @@ -142,6 +142,7 @@ export class PollService implements Resolve { } public convertTextToSlug(str: string) { + str = str.trim(); str = str.replace(/^\s+|\s+$/g, ''); // trim str = str.toLowerCase(); diff --git a/src/app/features/administration/form/base-config/base-config.component.ts b/src/app/features/administration/form/base-config/base-config.component.ts index 904ce3e3..24a4063f 100644 --- a/src/app/features/administration/form/base-config/base-config.component.ts +++ b/src/app/features/administration/form/base-config/base-config.component.ts @@ -46,6 +46,11 @@ export class BaseConfigComponent { * set the poll custom_url from other data of the poll */ automaticSlug(): void { - this.form.patchValue({ custom_url: this.utilitiesService.makeUuid() }); + this.form.patchValue({ + custom_url: + this.pollService.convertTextToSlug(this.form.value.title) + + '_' + + this.utilitiesService.makeUuid().substr(0, 12), + }); } }