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 /> <hr />
</div> </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> </form>

View File

@ -33,28 +33,12 @@ export class BaseConfigComponent {
@Inject(DOCUMENT) private document: Document @Inject(DOCUMENT) private document: Document
) {} ) {}
askInitFormDefault(): void {
this.toastService.display('formulaire réinitialisé', 'info');
}
public updateSlug(): void { public updateSlug(): void {
const newValueFormatted = this.pollService.convertTextToSlug(this.form.value.title); const newValueFormatted = this.pollService.convertTextToSlug(this.form.value.title);
console.log('newValueFormatted', newValueFormatted); console.log('newValueFormatted', newValueFormatted);
this.form.patchValue({ custom_url: 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) { getErrorMessage(fieldControl) {
return fieldControl.hasError('required') return fieldControl.hasError('required')
? 'You must enter a value' ? 'You must enter a value'

View File

@ -91,7 +91,13 @@
<hr /> <hr />
<div class="main-box is-boxed"> <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 <app-day-list
[form]="form" [form]="form"
[dateChoices]="dateChoices" [dateChoices]="dateChoices"

View File

@ -23,13 +23,6 @@
(cdkDropListDropped)="dropDayItem($event)" (cdkDropListDropped)="dropDayItem($event)"
> >
<div class="column"> <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 <div
*ngFor="let choice of dateChoices; index as id" *ngFor="let choice of dateChoices; index as id"
class="date-choice padded" class="date-choice padded"

View File

@ -12,6 +12,14 @@
<i class="fa fa-save"></i> <i class="fa fa-save"></i>
Enregistrer le sondage (sans vérifier) Enregistrer le sondage (sans vérifier)
</button> </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"> <main class="columns">
<div class="column"> <div class="column">
<label class="label is-medium" for="kind"> <label class="label is-medium" for="kind">

View File

@ -39,6 +39,7 @@ export class FormComponent implements OnInit, AfterViewInit {
public apiService: ApiService, public apiService: ApiService,
public dateUtils: DateUtilitiesService, public dateUtils: DateUtilitiesService,
private router: Router, private router: Router,
private utilitiesService: PollUtilitiesService,
@Inject(DOCUMENT) private document: any @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 * add example values to the form, overrides defaults of PollConfiguration
*/ */
setDemoValues(): void { 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 dateStart = this.dateUtils.formateDateToInputStringNg(new Date());
const dateEnd = this.dateUtils.formateDateToInputStringNg(this.dateUtils.addDaysToDate(5, 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() { goPreviousStep() {
alert('todo'); alert('todo');
} }