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 = '';
customUrl = ''; // custom slug in the url, must be unique
customUrlIsUnique = null; // given by the backend
urlSlugPublic = null;
urlPublic = environment.baseHref + '/#/poll/id/3';
urlAdmin = environment.baseHref + '/#/admin/d65es45fd45sdf45sd345f312sdf31sgfd345';
canModifyAnswers = 1;// everybody, self, nobody (= just admin)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -295,6 +295,12 @@ export class ConfigService extends PollConfig {
this.currentPoll = res.data;
this.currentPoll.admin_key = res.admin_key;
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;
if (!this.myPolls) {
this.myPolls = [];

View File

@ -27,12 +27,15 @@ export class VoteChoiceComponent {
public showChangeChoicebutton = false;
@Input() public choice: any;
@Input() public poll: any;
@Input() public simpleAnswer: boolean = true;
@Input() public pollIsSpecialDate: boolean = false;
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) {