fix get participation url

This commit is contained in:
Tykayn 2021-04-30 22:49:55 +02:00 committed by tykayn
parent d7a35e91ed
commit 9a013f6d2c
7 changed files with 26 additions and 26 deletions

View File

@ -61,14 +61,6 @@ export class Poll {
public dateChoices: DateChoice[] = []; public dateChoices: DateChoice[] = [];
// sets of days as strings, config to set identical time for days in a special days poll // sets of days as strings, config to set identical time for days in a special days poll
public timeSlices: TimeSlices[] = []; // ranges of time expressed as strings public timeSlices: TimeSlices[] = []; // ranges of time expressed as strings
constructor(public owner: Owner = new Owner(), public title = 'mon titre', public custom_url: string = '') {} constructor(public owner: Owner = new Owner(), public title = 'mon titre', public custom_url: string = '') {}
public getAdministrationUrl(): string {
return `${environment.frontDomain}/poll/admin/${this.admin_key}`;
}
public getParticipationUrl(): string {
// TODO handle pass access
return `${environment.frontDomain}/poll/${this.custom_url}/consultation`;
}
} }

View File

@ -225,4 +225,12 @@ export class PollService implements Resolve<Poll> {
console.log('choices before', choices); console.log('choices before', choices);
return choices; return choices;
} }
public getAdministrationUrl(): string {
return `${environment.frontDomain}#/poll/admin/${this._poll.getValue().admin_key}`;
}
public getParticipationUrl(): string {
// TODO handle pass access
return `${environment.frontDomain}#/poll/${this._poll.getValue().custom_url}/consultation`;
}
} }

View File

@ -8,7 +8,7 @@ import { FormGroup } from '@angular/forms';
styleUrls: ['./advanced-config.component.scss'], styleUrls: ['./advanced-config.component.scss'],
}) })
export class AdvancedConfigComponent implements OnInit { export class AdvancedConfigComponent implements OnInit {
public urlPrefix: string = window.location.origin + '/participation/'; public urlPrefix = '/participation/';
@Input() @Input()
public poll?: Poll; public poll?: Poll;
@Input() @Input()

View File

@ -18,7 +18,7 @@ export class StepperComponent implements OnInit {
public configurationFormGroup: FormGroup; public configurationFormGroup: FormGroup;
public choicesFormGroup: FormGroup; public choicesFormGroup: FormGroup;
public urlPrefix: string = window.location.origin + '/participation/'; public urlPrefix = '/participation/';
constructor(private fb: FormBuilder, private uuidService: UuidService) {} constructor(private fb: FormBuilder, private uuidService: UuidService) {}

View File

@ -28,10 +28,10 @@
<p> <p>
Pour accéder au sondage et à tous ses paramètres : Pour accéder au sondage et à tous ses paramètres :
<a href="{{ poll.getAdministrationUrl() }}">{{ poll.getAdministrationUrl() }} </a> <a href="{{ pollService.getAdministrationUrl() }}">{{ pollService.getAdministrationUrl() }} </a>
</p> </p>
<app-copy-text [textToCopy]="poll.getAdministrationUrl()"></app-copy-text> <app-copy-text [textToCopy]="pollService.getAdministrationUrl()"></app-copy-text>
<a [href]="poll.getAdministrationUrl()"> <a [href]="pollService.getAdministrationUrl()">
Voir le sondage coté administrateur·ice Voir le sondage coté administrateur·ice
</a> </a>
<p class="note"> <p class="note">
@ -43,10 +43,10 @@
<h2 i18n>{{ 'resume.users' | translate }}</h2> <h2 i18n>{{ 'resume.users' | translate }}</h2>
<p> <p>
Pour modifier le sondage : Pour modifier le sondage :
<a href="{{ poll.getAdministrationUrl() }}">{{ poll.getAdministrationUrl() }} </a> <a href="{{ pollService.getAdministrationUrl() }}">{{ pollService.getAdministrationUrl() }} </a>
</p> </p>
<app-copy-text [textToCopy]="poll.getAdministrationUrl()"></app-copy-text> <app-copy-text [textToCopy]="pollService.getAdministrationUrl()"></app-copy-text>
<a href="{{ poll.getAdministrationUrl() }}"> <i class="fa fa-pencil"></i> Modifier le sondage </a> <a href="{{ pollService.getAdministrationUrl() }}"> <i class="fa fa-pencil"></i> Modifier le sondage </a>
</section> </section>
<section class="mail"> <section class="mail">
<h2 i18n>{{ 'resume.links_mail' | translate }}</h2> <h2 i18n>{{ 'resume.links_mail' | translate }}</h2>

View File

@ -33,15 +33,15 @@
</h3> </h3>
<p class="nobold text-14" for="copyLink"> <p class="nobold text-14" for="copyLink">
Pour partager le sondage, vous pouvez diffuser ce lien : Pour partager le sondage, vous pouvez diffuser ce lien :
<a href="{{ window.location.href }}"> <a href="{{ pollService.getParticipationUrl() }}">
{{ window.location.href }} {{ pollService.getParticipationUrl() }}
</a> </a>
</p> </p>
<app-copy-text [textToCopy]="poll.getParticipationUrl()"></app-copy-text> <app-copy-text [textToCopy]="pollService.getParticipationUrl()"></app-copy-text>
<h3 class="margin-top-x6 margin-btm-x3"> <div class="ui-card-subtitle">
Exporter/Imprimer Exporter/Imprimer
</h3> </div>
<button class="replicate export-csv btn" (click)="duplicate()"> <button class="replicate export-csv btn" (click)="duplicate()">
<i class="fa fa-copy" aria-hidden="true"></i> <i class="fa fa-copy" aria-hidden="true"></i>
Dupliquer Dupliquer

View File

@ -3,12 +3,12 @@
// The list of file replacements can be found in `angular.json`. // The list of file replacements can be found in `angular.json`.
const backendApiUrlsInDev = { const backendApiUrlsInDev = {
local: 'http://localhost:8000/api/v1', local: 'http://tktest.lan/api/v1',
remote: 'http://localhost:8000/api/v1', remote: 'http://tktest.lan/api/v1',
// remote: 'https://framadate-api.cipherbliss.com/api/v1', // remote: 'https://framadate-api.cipherbliss.com/api/v1',
}; };
const apiV1 = { const apiV1 = {
baseHref: 'http://localhost:8000/api/v1', baseHref: 'http://tktest.lan/api/v1',
// baseHref: 'https://framadate-api.cipherbliss.com/api/v1', // baseHref: 'https://framadate-api.cipherbliss.com/api/v1',
api_new_poll: '/poll/', api_new_poll: '/poll/',
api_get_poll: '/poll/{id}', api_get_poll: '/poll/{id}',
@ -18,7 +18,7 @@ const apiV1 = {
}; };
export const environment = { export const environment = {
frontDomain: 'https://framadate-api.cipherbliss.com', frontDomain: 'http://tktest.lan',
production: false, production: false,
display_routes: true, display_routes: true,
autofill: true, autofill: true,