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[] = [];
// 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
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);
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'],
})
export class AdvancedConfigComponent implements OnInit {
public urlPrefix: string = window.location.origin + '/participation/';
public urlPrefix = '/participation/';
@Input()
public poll?: Poll;
@Input()

View File

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

View File

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

View File

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

View File

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