reordering creation form
This commit is contained in:
parent
386bbf742a
commit
6c30872c0e
File diff suppressed because it is too large
Load Diff
|
@ -15,7 +15,7 @@ import { environment } from '../../../../environments/environment';
|
||||||
export class HeaderComponent implements OnInit {
|
export class HeaderComponent implements OnInit {
|
||||||
public _user: Observable<User> = this.userService.user;
|
public _user: Observable<User> = this.userService.user;
|
||||||
public env = environment;
|
public env = environment;
|
||||||
@Input() public appTitle: string = 'FramaDate Funky';
|
@Input() public appTitle: string = environment.appTitle ? environment.appTitle : 'FramaDate';
|
||||||
@Input() public appLogo: string;
|
@Input() public appLogo: string;
|
||||||
mobileMenuVisible = false;
|
mobileMenuVisible = false;
|
||||||
|
|
||||||
|
|
|
@ -10,9 +10,20 @@ import { StepperComponent } from './stepper/stepper.component';
|
||||||
import { NamingComponent } from './naming/naming.component';
|
import { NamingComponent } from './naming/naming.component';
|
||||||
import { FormComponent } from './form/form.component';
|
import { FormComponent } from './form/form.component';
|
||||||
import { DateValueAccessorModule } from 'angular-date-value-accessor';
|
import { DateValueAccessorModule } from 'angular-date-value-accessor';
|
||||||
|
import { ClassicChoicesComponent } from './form/classic-choices/classic-choices.component';
|
||||||
|
import { StepOneComponent } from './form/step-one/step-one.component';
|
||||||
|
import { StepTwoComponent } from './form/step-two/step-two.component';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [AdministrationComponent, StepperComponent, NamingComponent, FormComponent],
|
declarations: [
|
||||||
|
AdministrationComponent,
|
||||||
|
StepperComponent,
|
||||||
|
NamingComponent,
|
||||||
|
FormComponent,
|
||||||
|
ClassicChoicesComponent,
|
||||||
|
StepOneComponent,
|
||||||
|
StepTwoComponent,
|
||||||
|
],
|
||||||
imports: [
|
imports: [
|
||||||
AdministrationRoutingModule,
|
AdministrationRoutingModule,
|
||||||
CommonModule,
|
CommonModule,
|
||||||
|
|
|
@ -0,0 +1,67 @@
|
||||||
|
<div class="form-field">
|
||||||
|
<!-- Choisir les propositions -->
|
||||||
|
<!-- sondage classique texte -->
|
||||||
|
<h2>
|
||||||
|
{{ 'choices.title' | translate }}
|
||||||
|
</h2>
|
||||||
|
{{ 'dates.add' | translate }}
|
||||||
|
<p>
|
||||||
|
<i>
|
||||||
|
{{ 'choices.helper' | translate }}
|
||||||
|
</i>
|
||||||
|
</p>
|
||||||
|
{{ 'choices.answer_preset_1' | translate }}
|
||||||
|
{{ 'choices.add' | translate }}
|
||||||
|
{{ 'choices.continue' | translate }}
|
||||||
|
<span>
|
||||||
|
<span class="columns">
|
||||||
|
<span class="column">
|
||||||
|
<button class="btn is-primary" (click)="addChoice()">
|
||||||
|
<i class="fa fa-plus"></i>
|
||||||
|
Ajouter un choix
|
||||||
|
</button>
|
||||||
|
</span>
|
||||||
|
<span class="column pull-right">
|
||||||
|
<button class="btn is-warning" (click)="reinitChoices()">
|
||||||
|
<i class="fa fa-recycle"></i>
|
||||||
|
Réinitialiser
|
||||||
|
</button>
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<p class="hint">
|
||||||
|
{{ 'creation.choices_hint' | translate }}
|
||||||
|
</p>
|
||||||
|
<span *ngFor="let choice of choices.controls; let i = index">
|
||||||
|
<div class="form-row" [formGroup]="choice">
|
||||||
|
<div class="columns">
|
||||||
|
<div class="column">
|
||||||
|
<button class="btn btn-warning" (click)="deleteChoiceField(i)">
|
||||||
|
<i class="fa fa-times"></i>
|
||||||
|
</button>
|
||||||
|
{{ i * 1 + 1 }})
|
||||||
|
</div>
|
||||||
|
<div class="column">
|
||||||
|
<label [for]="'choice_label_' + i" class="hidden">label</label>
|
||||||
|
<input
|
||||||
|
formControlName="label"
|
||||||
|
[id]="'choice_label_' + i"
|
||||||
|
placeholder="Enter a choice description"
|
||||||
|
(keyup)="keyOnChoice($event, i)"
|
||||||
|
(keyup.backspace)="deleteChoiceField(i)"
|
||||||
|
/>
|
||||||
|
<br />
|
||||||
|
<label [for]="'image_url_' + i" class="hidden">image Url</label>
|
||||||
|
<input
|
||||||
|
formControlName="imageUrl"
|
||||||
|
[id]="'image_url_' + i"
|
||||||
|
placeholder="URL de l' image"
|
||||||
|
(keyup)="keyOnChoice($event, i)"
|
||||||
|
(keyup.backspace)="deleteChoiceField(i)"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
</div>
|
|
@ -0,0 +1,24 @@
|
||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { ClassicChoicesComponent } from './classic-choices.component';
|
||||||
|
|
||||||
|
describe('ClassicChoicesComponent', () => {
|
||||||
|
let component: ClassicChoicesComponent;
|
||||||
|
let fixture: ComponentFixture<ClassicChoicesComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ClassicChoicesComponent],
|
||||||
|
}).compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(ClassicChoicesComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,12 @@
|
||||||
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-classic-choices',
|
||||||
|
templateUrl: './classic-choices.component.html',
|
||||||
|
styleUrls: ['./classic-choices.component.scss'],
|
||||||
|
})
|
||||||
|
export class ClassicChoicesComponent implements OnInit {
|
||||||
|
constructor() {}
|
||||||
|
|
||||||
|
ngOnInit(): void {}
|
||||||
|
}
|
|
@ -3,159 +3,20 @@
|
||||||
{{ 'creation.title' | translate }}
|
{{ 'creation.title' | translate }}
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
<img src="assets/img/undraw_Moving_twwf.svg" alt="image WIP" />
|
|
||||||
<button class="btn btn--warning" (click)="askInitFormDefault()">
|
|
||||||
<i class="fa fa-refresh"></i>
|
|
||||||
Tout réinitialiser
|
|
||||||
</button>
|
|
||||||
<button class="btn is-success" (click)="createPoll()">
|
|
||||||
<i class="fa fa-save"></i>
|
|
||||||
Enregistrer le sondage
|
|
||||||
</button>
|
|
||||||
<button class="btn is-default" (click)="automaticSlug()">
|
|
||||||
<i class="fa fa-save"></i>
|
|
||||||
Slug automatique
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<div class="well">
|
|
||||||
{{ poll.slug }}
|
|
||||||
</div>
|
|
||||||
<div class="has-background-danger" *ngIf="!form.valid">
|
|
||||||
le formulaire est invalide
|
|
||||||
<pre>
|
|
||||||
|
|
||||||
{{ form.errors | json }}
|
|
||||||
</pre
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
<div class="dates-list">
|
|
||||||
<div class="title">
|
|
||||||
<span class="count-dates">
|
|
||||||
{{ timeList.length }}
|
|
||||||
</span>
|
|
||||||
<span class="count-dates-txt">
|
|
||||||
{{ 'dates.count_time' | translate }}
|
|
||||||
(pour chaque jour)
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div class="actions">
|
|
||||||
<button
|
|
||||||
(click)="addTime()"
|
|
||||||
*ngIf="'false' === allowSeveralHours"
|
|
||||||
class="btn btn--primary"
|
|
||||||
id="add_time_button"
|
|
||||||
>
|
|
||||||
<i class="fa fa-plus" aria-hidden="true"></i>
|
|
||||||
{{ 'dates.add_time' | translate }}
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
(click)="removeAllTimes()"
|
|
||||||
*ngIf="'false' === allowSeveralHours"
|
|
||||||
class="btn btn--warning"
|
|
||||||
id="remove_time_button"
|
|
||||||
>
|
|
||||||
<i class="fa fa-trash" aria-hidden="true"></i>
|
|
||||||
Aucune plage horaire
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
(click)="resetTimes()"
|
|
||||||
*ngIf="'false' === allowSeveralHours"
|
|
||||||
class="btn btn--warning"
|
|
||||||
id="reset_time_button"
|
|
||||||
>
|
|
||||||
<i class="fa fa-refresh" aria-hidden="true"></i>
|
|
||||||
réinitialiser
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div *ngIf="'false' === allowSeveralHours" class="identical-dates">
|
|
||||||
<div cdkDropList class="example-list" (cdkDropListDropped)="drop($event)">
|
|
||||||
<div *ngFor="let time of timeList; index as id" class="time-choice" cdkDrag>
|
|
||||||
<label for="timeChoices_{{ id }}">
|
|
||||||
<i class="fa fa-clock-o" aria-hidden="true"></i>
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
[(ngModel)]="time.literal"
|
|
||||||
name="timeChoices_{{ id }}"
|
|
||||||
type="text"
|
|
||||||
id="timeChoices_{{ id }}"
|
|
||||||
/>
|
|
||||||
<button (click)="time.timeList.splice(id, 1)" class="btn btn-warning">
|
|
||||||
<i class="fa fa-times" aria-hidden="true"></i>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<hr />
|
|
||||||
<span class="count-dates title">
|
|
||||||
{{ dateList.length }}
|
|
||||||
</span>
|
|
||||||
<span>
|
|
||||||
{{ 'dates.count_dates' | translate }}
|
|
||||||
</span>
|
|
||||||
<button class="btn btn--primary" (click)="addChoice()">
|
|
||||||
{{ 'dates.add' | translate }}
|
|
||||||
</button>
|
|
||||||
<div *ngFor="let choice of dateList; index as id" class="date-choice">
|
|
||||||
{{ id }})
|
|
||||||
<input
|
|
||||||
[(ngModel)]="choice.date_object"
|
|
||||||
name="dateChoices_{{ id }}"
|
|
||||||
id="dateChoices_{{ id }}"
|
|
||||||
useValueAsDate
|
|
||||||
type="date"
|
|
||||||
/>
|
|
||||||
<button (click)="dateList.splice(id, 1)" class="btn btn-warning">
|
|
||||||
<i class="fa fa-times" aria-hidden="true"></i>
|
|
||||||
</button>
|
|
||||||
<button (click)="addTimeToDate(choice, id)" *ngIf="'true' === allowSeveralHours" class="btn btn--primary">
|
|
||||||
{{ 'dates.add_time' | translate }}
|
|
||||||
</button>
|
|
||||||
<div *ngIf="'true' === allowSeveralHours" class="several-times">
|
|
||||||
<div *ngFor="let timeItem of choice.timeList; index as idTime" class="time-choice">
|
|
||||||
<input
|
|
||||||
[(ngModel)]="timeItem.literal"
|
|
||||||
name="dateTime_{{ id }}_Choices_{{ idTime }}"
|
|
||||||
id="dateTime_{{ id }}_Choices_{{ idTime }}"
|
|
||||||
type="text"
|
|
||||||
/>
|
|
||||||
<button (click)="choice.timeList.splice(idTime, 1)" class="btn btn-warning">
|
|
||||||
<i class="fa fa-times" aria-hidden="true"></i>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<hr />
|
|
||||||
|
|
||||||
<form [formGroup]="form">
|
<form [formGroup]="form">
|
||||||
<div class="form-field">
|
<section class="creation-stepper">
|
||||||
<span class="pre-selector">
|
<div class="step-info">
|
||||||
{{ 'creation.want' | translate }}
|
<h2 class="title is-2">
|
||||||
</span>
|
Étape {{ step_current }} /
|
||||||
<div class="kind-of-poll columns">
|
{{ step_max }}
|
||||||
<div class="column">
|
</h2>
|
||||||
<button
|
|
||||||
class="btn-block btn"
|
|
||||||
[ngClass]="{ 'is-primary': form.controls.isAboutDate.value }"
|
|
||||||
(click)="form.controls.isAboutDate.setValue(true)"
|
|
||||||
>
|
|
||||||
<i class="fa fa-calendar"></i>
|
|
||||||
{{ 'creation.kind.date' | translate }}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div class="column">
|
|
||||||
<button
|
|
||||||
class="btn-block btn btn-default"
|
|
||||||
[ngClass]="{ 'is-primary': !form.controls.isAboutDate.value }"
|
|
||||||
(click)="form.controls.isAboutDate.setValue(false)"
|
|
||||||
>
|
|
||||||
<i class="fa fa-stats"></i>
|
|
||||||
{{ 'creation.kind.classic' | translate }}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="step-bar-container" style="width: 100%;">
|
||||||
|
<div class="step-bar-progress" [ngStyle]="{ width: (step_current / step_max) * 100 + '%' }"></div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="poll-title">
|
||||||
<span>
|
<span>
|
||||||
{{ 'creation.choose_title' | translate }}
|
{{ 'creation.choose_title' | translate }}
|
||||||
</span>
|
</span>
|
||||||
|
@ -180,11 +41,173 @@
|
||||||
>
|
>
|
||||||
<i class="fa fa-close"></i>
|
<i class="fa fa-close"></i>
|
||||||
</button>
|
</button>
|
||||||
|
</section>
|
||||||
|
<div class="poll-description">
|
||||||
|
<label for="descr">Description (optionnel)</label>
|
||||||
|
<span class="rich-text-toggle">
|
||||||
|
mode de saisie avancée
|
||||||
|
<button [(ngModel)]="richTextMode">
|
||||||
|
<i class="fa fa-text"></i>
|
||||||
|
</button>
|
||||||
|
</span>
|
||||||
|
<textarea
|
||||||
|
#description
|
||||||
|
matInput
|
||||||
|
id="descr"
|
||||||
|
placeholder="Description"
|
||||||
|
formControlName="description"
|
||||||
|
required
|
||||||
|
></textarea>
|
||||||
|
<div class="text-info">
|
||||||
|
300 caractères maximum
|
||||||
|
</div>
|
||||||
|
<button
|
||||||
|
mat-button
|
||||||
|
*ngIf="description.value"
|
||||||
|
matSuffix
|
||||||
|
mat-icon-button
|
||||||
|
aria-label="Clear"
|
||||||
|
(click)="description.value = ''"
|
||||||
|
>
|
||||||
|
<i class="fa fa-close"></i>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<fieldset class="date-kind">
|
<hr />
|
||||||
<!-- choix spécialement pour les dates-->
|
|
||||||
</fieldset>
|
<div class="form-field poll-kind">
|
||||||
|
<h2 class="title is-2">
|
||||||
|
{{ 'creation.want' | translate }}
|
||||||
|
</h2>
|
||||||
|
<div class="kind-of-poll columns">
|
||||||
|
<div class="column">
|
||||||
|
<button
|
||||||
|
class="btn-block btn"
|
||||||
|
[ngClass]="{ 'is-primary': form.controls.isAboutDate.value }"
|
||||||
|
(click)="form.controls.isAboutDate.setValue(true)"
|
||||||
|
>
|
||||||
|
<i class="fa fa-calendar"></i>
|
||||||
|
{{ 'creation.kind.date' | translate }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="column">
|
||||||
|
<button
|
||||||
|
class="btn-block btn btn-default"
|
||||||
|
[ngClass]="{ 'is-primary': !form.controls.isAboutDate.value }"
|
||||||
|
(click)="form.controls.isAboutDate.setValue(false)"
|
||||||
|
>
|
||||||
|
<i class="fa fa-list-ul"></i>
|
||||||
|
{{ 'creation.kind.classic' | translate }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<!-- choix spécialement pour les dates-->
|
||||||
|
<div class="dates-list">
|
||||||
|
<div class="title">
|
||||||
|
<span class="count-dates">
|
||||||
|
{{ timeList.length }}
|
||||||
|
</span>
|
||||||
|
<span class="count-dates-txt">
|
||||||
|
{{ 'dates.count_time' | translate }}
|
||||||
|
(pour chaque jour)
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="actions">
|
||||||
|
<button
|
||||||
|
(click)="addTime()"
|
||||||
|
*ngIf="'false' === allowSeveralHours"
|
||||||
|
class="btn btn--primary"
|
||||||
|
id="add_time_button"
|
||||||
|
>
|
||||||
|
<i class="fa fa-plus" aria-hidden="true"></i>
|
||||||
|
{{ 'dates.add_time' | translate }}
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
(click)="removeAllTimes()"
|
||||||
|
*ngIf="'false' === allowSeveralHours"
|
||||||
|
class="btn btn--warning"
|
||||||
|
id="remove_time_button"
|
||||||
|
>
|
||||||
|
<i class="fa fa-trash" aria-hidden="true"></i>
|
||||||
|
Aucune plage horaire
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
(click)="resetTimes()"
|
||||||
|
*ngIf="'false' === allowSeveralHours"
|
||||||
|
class="btn btn--warning"
|
||||||
|
id="reset_time_button"
|
||||||
|
>
|
||||||
|
<i class="fa fa-refresh" aria-hidden="true"></i>
|
||||||
|
réinitialiser
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div *ngIf="'false' === allowSeveralHours" class="identical-dates">
|
||||||
|
<div cdkDropList class="example-list" (cdkDropListDropped)="drop($event)">
|
||||||
|
<div *ngFor="let time of timeList; index as id" class="time-choice" cdkDrag>
|
||||||
|
<label for="timeChoices_{{ id }}">
|
||||||
|
<i class="fa fa-clock-o" aria-hidden="true"></i>
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
[(ngModel)]="time.literal"
|
||||||
|
name="timeChoices_{{ id }}"
|
||||||
|
type="text"
|
||||||
|
id="timeChoices_{{ id }}"
|
||||||
|
/>
|
||||||
|
<button (click)="time.timeList.splice(id, 1)" class="btn btn-warning">
|
||||||
|
<i class="fa fa-times" aria-hidden="true"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<hr />
|
||||||
|
<span class="count-dates title">
|
||||||
|
{{ dateList.length }}
|
||||||
|
</span>
|
||||||
|
<span>
|
||||||
|
{{ 'dates.count_dates' | translate }}
|
||||||
|
</span>
|
||||||
|
<button class="btn btn--primary" (click)="addChoice()">
|
||||||
|
{{ 'dates.add' | translate }}
|
||||||
|
</button>
|
||||||
|
<div *ngFor="let choice of dateList; index as id" class="date-choice">
|
||||||
|
{{ id }})
|
||||||
|
<input
|
||||||
|
[(ngModel)]="choice.date_object"
|
||||||
|
name="dateChoices_{{ id }}"
|
||||||
|
id="dateChoices_{{ id }}"
|
||||||
|
useValueAsDate
|
||||||
|
type="date"
|
||||||
|
/>
|
||||||
|
<button (click)="dateList.splice(id, 1)" class="btn btn-warning">
|
||||||
|
<i class="fa fa-times" aria-hidden="true"></i>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
(click)="addTimeToDate(choice, id)"
|
||||||
|
*ngIf="'true' === allowSeveralHours"
|
||||||
|
class="btn btn--primary"
|
||||||
|
>
|
||||||
|
{{ 'dates.add_time' | translate }}
|
||||||
|
</button>
|
||||||
|
<div *ngIf="'true' === allowSeveralHours" class="several-times">
|
||||||
|
<div *ngFor="let timeItem of choice.timeList; index as idTime" class="time-choice">
|
||||||
|
<input
|
||||||
|
[(ngModel)]="timeItem.literal"
|
||||||
|
name="dateTime_{{ id }}_Choices_{{ idTime }}"
|
||||||
|
id="dateTime_{{ id }}_Choices_{{ idTime }}"
|
||||||
|
type="text"
|
||||||
|
/>
|
||||||
|
<button (click)="choice.timeList.splice(idTime, 1)" class="btn btn-warning">
|
||||||
|
<i class="fa fa-times" aria-hidden="true"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
(click)="showDateInterval = !showDateInterval"
|
(click)="showDateInterval = !showDateInterval"
|
||||||
|
@ -224,72 +247,6 @@
|
||||||
<hr />
|
<hr />
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<div class="form-field">
|
|
||||||
<h2>
|
|
||||||
{{ 'choices.title' | translate }}
|
|
||||||
</h2>
|
|
||||||
{{ 'dates.add' | translate }}
|
|
||||||
<p>
|
|
||||||
<i>
|
|
||||||
{{ 'choices.helper' | translate }}
|
|
||||||
</i>
|
|
||||||
</p>
|
|
||||||
{{ 'choices.answer_preset_1' | translate }}
|
|
||||||
{{ 'choices.add' | translate }}
|
|
||||||
{{ 'choices.continue' | translate }}
|
|
||||||
<span>
|
|
||||||
<span class="columns">
|
|
||||||
<span class="column">
|
|
||||||
<button class="btn is-primary" (click)="addChoice()">
|
|
||||||
<i class="fa fa-plus"></i>
|
|
||||||
Ajouter un choix
|
|
||||||
</button>
|
|
||||||
</span>
|
|
||||||
<span class="column pull-right">
|
|
||||||
<button class="btn is-warning" (click)="reinitChoices()">
|
|
||||||
<i class="fa fa-recycle"></i>
|
|
||||||
Réinitialiser
|
|
||||||
</button>
|
|
||||||
</span>
|
|
||||||
</span>
|
|
||||||
|
|
||||||
<p class="hint">
|
|
||||||
{{ 'creation.choices_hint' | translate }}
|
|
||||||
</p>
|
|
||||||
<span *ngFor="let choice of choices.controls; let i = index">
|
|
||||||
<div class="form-row" [formGroup]="choice">
|
|
||||||
<div class="columns">
|
|
||||||
<div class="column">
|
|
||||||
<button class="btn btn-warning" (click)="deleteChoiceField(i)">
|
|
||||||
<i class="fa fa-times"></i>
|
|
||||||
</button>
|
|
||||||
{{ i * 1 + 1 }})
|
|
||||||
</div>
|
|
||||||
<div class="column">
|
|
||||||
<label [for]="'choice_label_' + i" class="hidden">label</label>
|
|
||||||
<input
|
|
||||||
formControlName="label"
|
|
||||||
[id]="'choice_label_' + i"
|
|
||||||
placeholder="Enter a choice description"
|
|
||||||
(keyup)="keyOnChoice($event, i)"
|
|
||||||
(keyup.backspace)="deleteChoiceField(i)"
|
|
||||||
/>
|
|
||||||
<br />
|
|
||||||
<label [for]="'image_url_' + i" class="hidden">image Url</label>
|
|
||||||
<input
|
|
||||||
formControlName="imageUrl"
|
|
||||||
[id]="'image_url_' + i"
|
|
||||||
placeholder="URL de l' image"
|
|
||||||
(keyup)="keyOnChoice($event, i)"
|
|
||||||
(keyup.backspace)="deleteChoiceField(i)"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</span>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label class="" for="creatorEmail">
|
<label class="" for="creatorEmail">
|
||||||
<span>
|
<span>
|
||||||
|
@ -313,109 +270,122 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
<button class="btn is-info" (click)="advancedDisplayEnabled = !advancedDisplayEnabled">
|
<section class="advanced-config">
|
||||||
<i class="fa fa-save"></i>
|
<button class="btn is-info" (click)="advancedDisplayEnabled = !advancedDisplayEnabled">
|
||||||
{{ 'creation.advanced' | translate }}
|
<i class="fa fa-save"></i>
|
||||||
</button>
|
{{ 'creation.advanced' | translate }}
|
||||||
<hr />
|
|
||||||
|
|
||||||
<fieldset class="complete well" *ngIf="advancedDisplayEnabled">
|
|
||||||
<h2>{{ 'creation.advanced' | translate }}</h2>
|
|
||||||
<label for="descr">Description (optionnel)</label>
|
|
||||||
<textarea
|
|
||||||
#description
|
|
||||||
matInput
|
|
||||||
id="descr"
|
|
||||||
placeholder="Description"
|
|
||||||
formControlName="description"
|
|
||||||
required
|
|
||||||
></textarea>
|
|
||||||
<button
|
|
||||||
mat-button
|
|
||||||
*ngIf="description.value"
|
|
||||||
matSuffix
|
|
||||||
mat-icon-button
|
|
||||||
aria-label="Clear"
|
|
||||||
(click)="description.value = ''"
|
|
||||||
>
|
|
||||||
<i class="fa fa-close"></i>
|
|
||||||
</button>
|
</button>
|
||||||
|
<hr />
|
||||||
|
<fieldset class="complete well" *ngIf="advancedDisplayEnabled">
|
||||||
|
<h2>{{ 'creation.advanced' | translate }}</h2>
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
<label for="slug"
|
<label for="slug"
|
||||||
>Url pour les participants
|
>Url pour les participants
|
||||||
|
|
||||||
<i class="fa fa-close"></i>
|
<i class="fa fa-close"></i>
|
||||||
</label>
|
</label>
|
||||||
<br />
|
<br />
|
||||||
<span
|
<span
|
||||||
>{{ urlPrefix }}
|
>{{ urlPrefix }}
|
||||||
<strong>
|
<strong>
|
||||||
{{ form.controls.slug.value }}
|
{{ form.controls.slug.value }}
|
||||||
</strong>
|
</strong>
|
||||||
</span>
|
</span>
|
||||||
<app-copy-text [textToCopy]="form.controls.slug.value"></app-copy-text>
|
<app-copy-text [textToCopy]="form.controls.slug.value"></app-copy-text>
|
||||||
|
|
||||||
<button
|
|
||||||
mat-button
|
|
||||||
*ngIf="form.controls.slug.value"
|
|
||||||
matSuffix
|
|
||||||
mat-icon-button
|
|
||||||
aria-label="Clear"
|
|
||||||
(click)="slug.value = ''"
|
|
||||||
></button>
|
|
||||||
<input #slug matInput id="slug" placeholder="Url" formControlName="slug" required />
|
|
||||||
<br />
|
|
||||||
<div appearance="outline" class="is-not-flex">
|
|
||||||
<mat-label>Nombre de jours avant expiration</mat-label>
|
|
||||||
<input
|
|
||||||
#expiracy
|
|
||||||
id="expiracy"
|
|
||||||
matInput
|
|
||||||
type="number"
|
|
||||||
placeholder="Nombre de jours avant expiration"
|
|
||||||
formControlName="expiracyNumberOfDays"
|
|
||||||
required
|
|
||||||
/>
|
|
||||||
<button
|
<button
|
||||||
mat-button
|
mat-button
|
||||||
*ngIf="expiracy.value"
|
*ngIf="form.controls.slug.value"
|
||||||
matSuffix
|
matSuffix
|
||||||
mat-icon-button
|
mat-icon-button
|
||||||
aria-label="Clear"
|
aria-label="Clear"
|
||||||
(click)="expiracy.value = ''"
|
(click)="slug.value = ''"
|
||||||
>
|
></button>
|
||||||
<i class="fa fa-close"></i>
|
<input #slug matInput id="slug" placeholder="Url" formControlName="slug" required />
|
||||||
</button>
|
<br />
|
||||||
</div>
|
<div appearance="outline" class="is-not-flex">
|
||||||
<mat-checkbox class="is-not-flex" formControlName="areResultsPublic">
|
<mat-label>Nombre de jours avant expiration</mat-label>
|
||||||
Les participants pourront consulter les résultats
|
<input
|
||||||
</mat-checkbox>
|
#expiracy
|
||||||
<mat-checkbox class="is-not-flex" formControlName="isAboutDate">
|
id="expiracy"
|
||||||
Les choix possibles concerneront des dates
|
matInput
|
||||||
</mat-checkbox>
|
type="number"
|
||||||
<mat-checkbox class="is-not-flex" formControlName="isProtectedByPassword">
|
placeholder="Nombre de jours avant expiration"
|
||||||
Le sondage sera protégé par un mot de passe
|
formControlName="expiracyNumberOfDays"
|
||||||
</mat-checkbox>
|
required
|
||||||
<mat-checkbox class="is-not-flex" formControlName="isOwnerNotifiedByEmailOnNewVote">
|
/>
|
||||||
Vous recevrez un mail à chaque nouvelle participation
|
<button
|
||||||
</mat-checkbox>
|
mat-button
|
||||||
<mat-checkbox class="is-not-flex" formControlName="isOwnerNotifiedByEmailOnNewComment">
|
*ngIf="expiracy.value"
|
||||||
Vous recevrez un mail à chaque nouveau commentaire
|
matSuffix
|
||||||
</mat-checkbox>
|
mat-icon-button
|
||||||
<mat-checkbox class="is-not-flex" formControlName="isMaybeAnswerAvailable">
|
aria-label="Clear"
|
||||||
La réponse « peut-être » sera disponible
|
(click)="expiracy.value = ''"
|
||||||
</mat-checkbox>
|
>
|
||||||
</fieldset>
|
<i class="fa fa-close"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
|
<mat-checkbox class="is-not-flex" formControlName="areResultsPublic">
|
||||||
|
Les participants pourront consulter les résultats
|
||||||
|
</mat-checkbox>
|
||||||
|
<br />
|
||||||
|
<mat-checkbox class="is-not-flex" formControlName="isAboutDate">
|
||||||
|
Les choix possibles concerneront des dates
|
||||||
|
</mat-checkbox>
|
||||||
|
<br />
|
||||||
|
<mat-checkbox class="is-not-flex" formControlName="isProtectedByPassword">
|
||||||
|
Le sondage sera protégé par un mot de passe
|
||||||
|
</mat-checkbox>
|
||||||
|
<br />
|
||||||
|
<mat-checkbox class="is-not-flex" formControlName="isOwnerNotifiedByEmailOnNewVote">
|
||||||
|
Vous recevrez un mail à chaque nouvelle participation
|
||||||
|
</mat-checkbox>
|
||||||
|
<br />
|
||||||
|
<mat-checkbox class="is-not-flex" formControlName="isOwnerNotifiedByEmailOnNewComment">
|
||||||
|
Vous recevrez un mail à chaque nouveau commentaire
|
||||||
|
</mat-checkbox>
|
||||||
|
<br />
|
||||||
|
<mat-checkbox class="is-not-flex" formControlName="isMaybeAnswerAvailable">
|
||||||
|
La réponse « peut-être » sera disponible
|
||||||
|
</mat-checkbox>
|
||||||
|
</fieldset>
|
||||||
|
</section>
|
||||||
<div class="columns">
|
<div class="columns">
|
||||||
<div class="column"></div>
|
<div class="column"></div>
|
||||||
<div class="column">
|
<div class="column">
|
||||||
<button class="btn is-success" (click)="createPoll()" [disabled]="!form.valid || !form.valid">
|
<button class="btn is-primary" (click)="createPoll()" [disabled]="!form.valid || !form.valid">
|
||||||
<i class="fa fa-save"></i>
|
<i class="fa fa-save"></i>
|
||||||
Enregistrer le sondage
|
Enregistrer le sondage
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
<section class="supplement">
|
||||||
|
<img src="assets/img/undraw_Moving_twwf.svg" alt="image WIP" />
|
||||||
|
<button class="btn btn--warning" (click)="askInitFormDefault()">
|
||||||
|
<i class="fa fa-refresh"></i>
|
||||||
|
Tout réinitialiser
|
||||||
|
</button>
|
||||||
|
<button class="btn is-success" (click)="createPoll()">
|
||||||
|
<i class="fa fa-save"></i>
|
||||||
|
Enregistrer le sondage
|
||||||
|
</button>
|
||||||
|
<button class="btn is-default" (click)="automaticSlug()">
|
||||||
|
<i class="fa fa-save"></i>
|
||||||
|
Slug automatique
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<div class="well">
|
||||||
|
{{ poll.slug }}
|
||||||
|
</div>
|
||||||
|
<div class="has-background-danger" *ngIf="!form.valid">
|
||||||
|
le formulaire est invalide
|
||||||
|
<pre> {{ form.errors | json }}</pre>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -83,4 +83,21 @@
|
||||||
border-left: $success 3px solid;
|
border-left: $success 3px solid;
|
||||||
padding-left: 1em;
|
padding-left: 1em;
|
||||||
}
|
}
|
||||||
|
.step-bar-container {
|
||||||
|
margin: 1em 0;
|
||||||
|
height: 0.5em;
|
||||||
|
display: inline-block;
|
||||||
|
min-width: 1px;
|
||||||
|
background: $grey-light;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.step-bar-progress {
|
||||||
|
position: relative;
|
||||||
|
top: -0.6em;
|
||||||
|
left: 0;
|
||||||
|
height: 0.5em;
|
||||||
|
display: inline-block;
|
||||||
|
min-width: 1px;
|
||||||
|
background: $primary;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,14 +22,18 @@ export class FormComponent implements OnInit {
|
||||||
|
|
||||||
public urlPrefix: string = window.location.origin + '/participation/';
|
public urlPrefix: string = window.location.origin + '/participation/';
|
||||||
public advancedDisplayEnabled = false;
|
public advancedDisplayEnabled = false;
|
||||||
public showDateInterval = true;
|
public showDateInterval = false;
|
||||||
public allowSeveralHours = true;
|
public allowSeveralHours = false;
|
||||||
|
public richTextMode = false;
|
||||||
startDateInterval: string;
|
startDateInterval: string;
|
||||||
endDateInterval: string;
|
endDateInterval: string;
|
||||||
intervalDays: any;
|
intervalDays: any;
|
||||||
intervalDaysDefault = 7;
|
intervalDaysDefault = 7;
|
||||||
dateList: any = otherDefaultDates; // sets of days as strings, config to set identical time for days in a special days poll
|
dateList: any = otherDefaultDates; // sets of days as strings, config to set identical time for days in a special days poll
|
||||||
timeList: DateChoice[] = otherDefaultDates; // ranges of time expressed as strings
|
timeList: DateChoice[] = otherDefaultDates; // ranges of time expressed as strings
|
||||||
|
step_current: number = 1;
|
||||||
|
step_max: number = 5;
|
||||||
|
public round: Function;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private fb: FormBuilder,
|
private fb: FormBuilder,
|
||||||
|
@ -50,8 +54,6 @@ export class FormComponent implements OnInit {
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.initFormDefault();
|
this.initFormDefault();
|
||||||
// TO remove after
|
|
||||||
// this.createPoll();
|
|
||||||
const pollsAvailable = this.pollService.getAllAvailablePolls();
|
const pollsAvailable = this.pollService.getAllAvailablePolls();
|
||||||
console.log('pollsAvailable', pollsAvailable);
|
console.log('pollsAvailable', pollsAvailable);
|
||||||
}
|
}
|
||||||
|
@ -61,14 +63,6 @@ export class FormComponent implements OnInit {
|
||||||
const newpoll = this.pollService.newPollFromForm(this.form);
|
const newpoll = this.pollService.newPollFromForm(this.form);
|
||||||
console.log('newpoll', newpoll);
|
console.log('newpoll', newpoll);
|
||||||
this.apiService.createPoll(newpoll);
|
this.apiService.createPoll(newpoll);
|
||||||
// if (this.form.valid) {
|
|
||||||
// console.log('Le sondage est correctement rempli, prêt à enregistrer.');
|
|
||||||
// const newpoll = this.pollService.newPollFromForm(this.form);
|
|
||||||
// // TODO : save the poll
|
|
||||||
// this.apiService.createPoll(newpoll);
|
|
||||||
// } else {
|
|
||||||
// this.toastService.display('invalid form');
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public updateSlug(): void {
|
public updateSlug(): void {
|
||||||
|
@ -223,14 +217,6 @@ export class FormComponent implements OnInit {
|
||||||
this.showDateInterval = false;
|
this.showDateInterval = false;
|
||||||
|
|
||||||
this.form.patchValue({ choices: this.dateList });
|
this.form.patchValue({ choices: this.dateList });
|
||||||
// this.dateList.forEach(elem=>{
|
|
||||||
// const newControlGroup = this.fb.group({
|
|
||||||
// label: this.fb.control('', [Validators.required]),
|
|
||||||
// imageUrl: ['', [Validators.required]],
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// this.choices.push(newControlGroup);
|
|
||||||
// })
|
|
||||||
|
|
||||||
this.toastService.display(`les dates ont été ajoutées aux réponses possibles.`);
|
this.toastService.display(`les dates ont été ajoutées aux réponses possibles.`);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
<div class="step">
|
||||||
|
Nom de sondage
|
||||||
|
</div>
|
|
@ -0,0 +1,24 @@
|
||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { StepOneComponent } from './step-one.component';
|
||||||
|
|
||||||
|
describe('StepOneComponent', () => {
|
||||||
|
let component: StepOneComponent;
|
||||||
|
let fixture: ComponentFixture<StepOneComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [StepOneComponent],
|
||||||
|
}).compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(StepOneComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,12 @@
|
||||||
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-step-one',
|
||||||
|
templateUrl: './step-one.component.html',
|
||||||
|
styleUrls: ['./step-one.component.scss'],
|
||||||
|
})
|
||||||
|
export class StepOneComponent implements OnInit {
|
||||||
|
constructor() {}
|
||||||
|
|
||||||
|
ngOnInit(): void {}
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
<p>step-two works!</p>
|
|
@ -0,0 +1,24 @@
|
||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { StepTwoComponent } from './step-two.component';
|
||||||
|
|
||||||
|
describe('StepTwoComponent', () => {
|
||||||
|
let component: StepTwoComponent;
|
||||||
|
let fixture: ComponentFixture<StepTwoComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [StepTwoComponent],
|
||||||
|
}).compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(StepTwoComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,12 @@
|
||||||
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-step-two',
|
||||||
|
templateUrl: './step-two.component.html',
|
||||||
|
styleUrls: ['./step-two.component.scss'],
|
||||||
|
})
|
||||||
|
export class StepTwoComponent implements OnInit {
|
||||||
|
constructor() {}
|
||||||
|
|
||||||
|
ngOnInit(): void {}
|
||||||
|
}
|
|
@ -16,7 +16,7 @@ const apiV1 = {
|
||||||
|
|
||||||
export const environment = {
|
export const environment = {
|
||||||
production: false,
|
production: false,
|
||||||
appTitle: 'FramaDate Funky',
|
appTitle: 'FramaDate',
|
||||||
appVersion: '2.0.0',
|
appVersion: '2.0.0',
|
||||||
appLogo: 'assets/img/logo.png',
|
appLogo: 'assets/img/logo.png',
|
||||||
api: {
|
api: {
|
||||||
|
|
|
@ -11,3 +11,62 @@ $body-background-color: $black;
|
||||||
$control-border-width: 2px;
|
$control-border-width: 2px;
|
||||||
$input-border-color: transparent;
|
$input-border-color: transparent;
|
||||||
$input-shadow: none;
|
$input-shadow: none;
|
||||||
|
|
||||||
|
// bulma css override
|
||||||
|
$colors: mergeColorMaps(
|
||||||
|
(
|
||||||
|
'white': (
|
||||||
|
$white,
|
||||||
|
$black,
|
||||||
|
),
|
||||||
|
'black': (
|
||||||
|
$black,
|
||||||
|
$white,
|
||||||
|
),
|
||||||
|
'light': (
|
||||||
|
$light,
|
||||||
|
$light-invert,
|
||||||
|
),
|
||||||
|
'dark': (
|
||||||
|
$dark,
|
||||||
|
$dark-invert,
|
||||||
|
),
|
||||||
|
'primary': (
|
||||||
|
$primary,
|
||||||
|
$primary-invert,
|
||||||
|
$primary-light,
|
||||||
|
$primary-dark,
|
||||||
|
),
|
||||||
|
'link': (
|
||||||
|
$link,
|
||||||
|
$link-invert,
|
||||||
|
$link-light,
|
||||||
|
$link-dark,
|
||||||
|
),
|
||||||
|
'info': (
|
||||||
|
$info,
|
||||||
|
$info-invert,
|
||||||
|
$info-light,
|
||||||
|
$info-dark,
|
||||||
|
),
|
||||||
|
'success': (
|
||||||
|
$success,
|
||||||
|
$success-invert,
|
||||||
|
$success-light,
|
||||||
|
$success-dark,
|
||||||
|
),
|
||||||
|
'warning': (
|
||||||
|
$warning,
|
||||||
|
$warning-invert,
|
||||||
|
$warning-light,
|
||||||
|
$warning-dark,
|
||||||
|
),
|
||||||
|
'danger': (
|
||||||
|
$danger,
|
||||||
|
$danger-invert,
|
||||||
|
$danger-light,
|
||||||
|
$danger-dark,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
$custom-colors
|
||||||
|
);
|
||||||
|
|
|
@ -57,6 +57,5 @@ $warning: $d-warning;
|
||||||
$danger: $d-error;
|
$danger: $d-error;
|
||||||
$success: $d-success;
|
$success: $d-success;
|
||||||
|
|
||||||
// FONT
|
|
||||||
$default_font: 'pt_sans';
|
$default_font: 'pt_sans';
|
||||||
$title_font: 'proza_libre', 'Brie Light', 'Arial', 'DejaVu Sans Mono';
|
$title_font: 'proza_libre', 'Brie Light', 'Arial', 'DejaVu Sans Mono';
|
||||||
|
|
Loading…
Reference in New Issue