step to date form

This commit is contained in:
Baptiste Lemoine 2020-01-23 16:47:53 +01:00
parent 22bd836a16
commit 2e6723a1f1
8 changed files with 36 additions and 9 deletions

View File

@ -48,6 +48,7 @@ export class PollConfig {
password = ''; password = '';
customUrl = ''; // custom slug in the url, must be unique customUrl = ''; // custom slug in the url, must be unique
customUrlIsUnique = null; // given by the backend customUrlIsUnique = null; // given by the backend
urlSlugPublic = null;
urlPublic = environment.baseHref + '/#/poll/id/3'; urlPublic = environment.baseHref + '/#/poll/id/3';
urlAdmin = environment.baseHref + '/#/admin/d65es45fd45sdf45sd345f312sdf31sgfd345'; urlAdmin = environment.baseHref + '/#/admin/d65es45fd45sdf45sd345f312sdf31sgfd345';
canModifyAnswers = 1;// everybody, self, nobody (= just admin) canModifyAnswers = 1;// everybody, self, nobody (= just admin)

View File

@ -94,6 +94,7 @@
</button > </button >
<br > <br >
<a <a
[routerLink]="'/home'"
class="prev" class="prev"
i18n > i18n >
Retour Retour

View File

@ -22,7 +22,7 @@
</a > </a >
</p > </p >
<button <button
class="btn" class="btn btn--primary"
(click)="copyLink(config.urlAdmin)" (click)="copyLink(config.urlAdmin)"
[ngxClipboard] [ngxClipboard]
cbContent="{{config.urlAdmin}}" cbContent="{{config.urlAdmin}}"
@ -49,7 +49,7 @@
</p > </p >
<button <button
class="btn" class="btn btn--primary"
(click)="copyLink(config.urlPublic)" (click)="copyLink(config.urlPublic)"
[ngxClipboard] [ngxClipboard]
cbContent="{{config.urlPublic}}" cbContent="{{config.urlPublic}}"
@ -77,7 +77,7 @@
</p > </p >
<button <button
class="btn" class="btn btn--primary"
(click)="sendToEmail()" (click)="sendToEmail()"
><i class="fa fa-paper-plane" ></i > ><i class="fa fa-paper-plane" ></i >
Envoyer les liens du sondage Envoyer les liens du sondage

View File

@ -18,12 +18,16 @@
[(ngModel)]="config.pollType" [(ngModel)]="config.pollType"
autofocus="autofocus" autofocus="autofocus"
id="selector" id="selector"
name="selector" name='polltype'
> >
<option value="dates" > <option
value="dates"
name='polltype_date' >
{{"creation.kind.date"|translate}} {{"creation.kind.date"|translate}}
</option > </option >
<option value="classic" > <option
value="classic"
name='polltype_classic' >
{{"creation.kind.classic"|translate}} {{"creation.kind.classic"|translate}}
</option > </option >
</select > </select >
@ -101,12 +105,23 @@
<button <button
[routerLink]="'/step/answers'" [routerLink]="'/step/answers'"
class="btn btn--primary btn--full" class="btn btn--primary btn--full"
*ngIf="config.pollType == 'classic'"
i18n i18n
> >
Continuer Continuer
<i class='fa fa-file-text' ></i >
</button >
<button
[routerLink]="'/step/date'"
class="btn btn--primary btn--full"
*ngIf="config.pollType == 'dates'"
i18n
>
Continuer
<i class='fa fa-calendar-check-o' ></i >
</button > </button >
<a <a
[routerLink]="'/step/answers'" [routerLink]="'/step/creation'"
class="prev" class="prev"
i18n i18n
> >

View File

@ -9,6 +9,7 @@ import {BaseComponent} from "../base-page/base.component";
}) })
export class HomeComponent extends BaseComponent implements OnInit { export class HomeComponent extends BaseComponent implements OnInit {
nextStep = '/step/answers';
constructor(public config: ConfigService) { constructor(public config: ConfigService) {
super(config); super(config);
} }

View File

@ -74,7 +74,7 @@
<framadate-vote-choice <framadate-vote-choice
[choice]="choice" [choice]="choice"
[pollIsSpecialDate]="config.currentPoll.data.kind == 'date'" [pollIsSpecialDate]="config.currentPoll.data.kind == 'date'"
[simpleAnswer]="config.currentPoll.data.allowedAnswers.length == 1 " ></framadate-vote-choice > [poll]='config.currentPoll' ></framadate-vote-choice >
</div > </div >
</div > </div >
<button <button

View File

@ -295,6 +295,12 @@ export class ConfigService extends PollConfig {
this.currentPoll = res.data; this.currentPoll = res.data;
this.currentPoll.admin_key = res.admin_key; this.currentPoll.admin_key = res.admin_key;
this.pollId = res.data.id; this.pollId = res.data.id;
this.urlPublic = this.baseHref + '#/vote/poll/id/' + res.data.id;
this.urlSlugPublic = this.baseHref + '#/vote/poll/slug/' + res.data.id;
if (res.data.customUrl) {
this.urlSlugPublic = this.baseHref + '#/vote/poll/id/' + res.data.customUrl;
}
this.urlAdmin = this.baseHref + '#/admin/' + res.admin_key;
this.loading = false; this.loading = false;
if (!this.myPolls) { if (!this.myPolls) {
this.myPolls = []; this.myPolls = [];

View File

@ -27,12 +27,15 @@ export class VoteChoiceComponent {
public showChangeChoicebutton = false; public showChangeChoicebutton = false;
@Input() public choice: any; @Input() public choice: any;
@Input() public poll: any;
@Input() public simpleAnswer: boolean = true; @Input() public simpleAnswer: boolean = true;
@Input() public pollIsSpecialDate: boolean = false; @Input() public pollIsSpecialDate: boolean = false;
constructor(private el: ElementRef) { constructor(private el: ElementRef) {
console.log('choice', this.choice) if (this.poll && this.poll.data && this.poll.data.allowedAnswers) {
this.simpleAnswer = this.poll.data.allowedAnswers.length == 1
}
} }
setAnswserTo(newAnswer: 'yes' | 'no' | 'maybe' | null) { setAnswserTo(newAnswer: 'yes' | 'no' | 'maybe' | null) {