move buttons

This commit is contained in:
Tykayn 2021-05-20 11:12:22 +02:00 committed by tykayn
parent 1d9e6066e0
commit 6e61e49235
6 changed files with 34 additions and 43 deletions

View File

@ -90,20 +90,4 @@
<hr />
</div>
Url personnalisée:
{{ form.value.custom_url }}
<hr />
<div class="column">
<button class="btn btn--warning" (click)="askInitFormDefault()">
<i class="fa fa-refresh"></i>
Tout réinitialiser
</button>
<br />
<br />
<button class="btn is-default" (click)="automaticSlug()">
<i class="fa fa-refresh"></i>
Slug automatique
</button>
</div>
</form>

View File

@ -33,28 +33,12 @@ export class BaseConfigComponent {
@Inject(DOCUMENT) private document: Document
) {}
askInitFormDefault(): void {
this.toastService.display('formulaire réinitialisé', 'info');
}
public updateSlug(): void {
const newValueFormatted = this.pollService.convertTextToSlug(this.form.value.title);
console.log('newValueFormatted', newValueFormatted);
this.form.patchValue({ custom_url: newValueFormatted });
}
/**
* set the poll custom_url from other data of the poll
*/
automaticSlug(): void {
this.form.patchValue({
custom_url:
this.pollService.convertTextToSlug(this.form.value.title) +
'_' +
this.utilitiesService.makeUuid().substr(0, 12),
});
}
getErrorMessage(fieldControl) {
return fieldControl.hasError('required')
? 'You must enter a value'

View File

@ -91,7 +91,13 @@
<hr />
<div class="main-box is-boxed">
liste de jours :
<h2>Dates</h2>
<button class="btn button-help" mat-raised-button (click)="openSimple()">
💁 Raccourcis
</button>
<app-shortcuts-help *ngIf="display"></app-shortcuts-help>
<br />
<br />
<app-day-list
[form]="form"
[dateChoices]="dateChoices"

View File

@ -23,13 +23,6 @@
(cdkDropListDropped)="dropDayItem($event)"
>
<div class="column">
<h2>Dates</h2>
<button class="btn button-help" mat-raised-button (click)="openSimple()">
💁 Raccourcis
</button>
<app-shortcuts-help *ngIf="display"></app-shortcuts-help>
<br />
<br />
<div
*ngFor="let choice of dateChoices; index as id"
class="date-choice padded"

View File

@ -12,6 +12,14 @@
<i class="fa fa-save"></i>
Enregistrer le sondage (sans vérifier)
</button>
<button class="btn btn--warning" (click)="askInitFormDefault()">
<i class="fa fa-refresh"></i>
Tout réinitialiser
</button>
<button class="btn is-default" (click)="automaticSlug()">
<i class="fa fa-refresh"></i>
Slug automatique
</button>
<main class="columns">
<div class="column">
<label class="label is-medium" for="kind">

View File

@ -39,6 +39,7 @@ export class FormComponent implements OnInit, AfterViewInit {
public apiService: ApiService,
public dateUtils: DateUtilitiesService,
private router: Router,
private utilitiesService: PollUtilitiesService,
@Inject(DOCUMENT) private document: any
) {}
@ -141,10 +142,9 @@ export class FormComponent implements OnInit, AfterViewInit {
* add example values to the form, overrides defaults of PollConfiguration
*/
setDemoValues(): void {
const title = 'le titre de démo oh oh ' + new Date().getTime();
const title = 'le titre de démo __ ' + new Date().getTime();
// this.form.patchValue(this.pollService.poll);
// this.form.patchValue({ creatorPseudo: 'Chuck Norris', creatorEmail: 'chucknorris@example.com' });
this.form.patchValue({ creatorPseudo: 'Chuck Norris', creatorEmail: 'chucknorris@example.com' });
const dateStart = this.dateUtils.formateDateToInputStringNg(new Date());
const dateEnd = this.dateUtils.formateDateToInputStringNg(this.dateUtils.addDaysToDate(5, new Date()));
@ -158,6 +158,22 @@ export class FormComponent implements OnInit, AfterViewInit {
});
}
askInitFormDefault(): void {
this.toastService.display('formulaire réinitialisé', 'info');
}
/**
* set the poll custom_url from other data of the poll
*/
automaticSlug(): void {
this.form.patchValue({
custom_url:
this.pollService.convertTextToSlug(this.form.value.title) +
'_' +
this.utilitiesService.makeUuid().substr(0, 12),
});
}
goPreviousStep() {
alert('todo');
}