This commit is contained in:
tykayn 2021-04-30 16:51:54 +02:00 committed by Baptiste Lemoine
commit bdfcef490c
176 changed files with 997 additions and 828 deletions

View File

@ -6,7 +6,7 @@
"polls": [ "polls": [
{ {
"id": 1, "id": 1,
"slug": "picnic", "custom_url": "picnic",
"configuration": { "configuration": {
"id": 1, "id": 1,
"isAboutDate": true, "isAboutDate": true,
@ -24,7 +24,7 @@
}, },
{ {
"id": 2, "id": 2,
"slug": "vacances", "custom_url": "vacances",
"configuration": { "configuration": {
"id": 2, "id": 2,
"isAboutDate": true, "isAboutDate": true,

View File

@ -1,7 +1,7 @@
/** /**
* une option de date dans les sondages spéciaux * une option de date dans les sondages spéciaux
*/ */
import { environment } from '../../../../environments/environment'; import { environment } from '../../../src/environments/environment';
import { DateChoice, defaultAnswers, otherDefaultDates, PollAnswer } from './defaultConfigs'; import { DateChoice, defaultAnswers, otherDefaultDates, PollAnswer } from './defaultConfigs';
export interface DateOption { export interface DateOption {
@ -40,7 +40,7 @@ export class PollConfig {
myEmail: string = environment.production ? '' : 'tktest@tktest.com'; myEmail: string = environment.production ? '' : 'tktest@tktest.com';
myPolls: any = []; // list of retrieved polls from the backend api myPolls: any = []; // list of retrieved polls from the backend api
/* /*
date specific poll, we have the choice to setup different hours (timeList) for all possible dates (dateList), or use the same hours for all dates date specific poll, we have the choice to setup different hours (timeSlices) for all possible dates (dateList), or use the same hours for all dates
*/ */
allowSeveralHours = 'true'; allowSeveralHours = 'true';
// access // access
@ -50,11 +50,11 @@ export class PollConfig {
expirationDate = ''; // expiracy date expirationDate = ''; // expiracy date
voteStackId = null; // id of the vote stack to update voteStackId = null; // id of the vote stack to update
pollId = null; // id of the current poll when created. data given by the backend api pollId = null; // id of the current poll when created. data given by the backend api
pollSlug = null; // id of the current poll when created. data given by the backend api custom_url = null; // id of the current poll when created. data given by the backend api
currentPoll; // current poll selected with createPoll or getPoll of ConfigService currentPoll; // current poll selected with createPoll or getPoll of ConfigService
passwordAccess = 0; passwordAccess = 0;
password = ''; password = '';
customUrl = ''; // custom slug in the url, must be unique customUrl = ''; // custom custom_url in the url, must be unique
customUrlIsUnique = null; // given by the backend customUrlIsUnique = null; // given by the backend
urlSlugPublic = null; urlSlugPublic = null;
urlPublic = environment.production ? '' : document.location.href + '/poll/id/4'; urlPublic = environment.production ? '' : document.location.href + '/poll/id/4';

View File

@ -33,7 +33,7 @@ const routes: Routes = [
{ path: 'step/end', component: EndConfirmationComponent }, { path: 'step/end', component: EndConfirmationComponent },
{ path: 'graphic/:poll', component: PollGraphicComponent }, { path: 'graphic/:poll', component: PollGraphicComponent },
{ path: 'vote/poll/id/:id', component: PollDisplayComponent }, { path: 'vote/poll/id/:id', component: PollDisplayComponent },
{ path: 'vote/poll/slug/:slug', component: PollDisplayComponent }, { path: 'vote/poll/custom_url/:custom_url', component: PollDisplayComponent },
{ path: 'votingchoice', component: VotingChoiceComponent }, { path: 'votingchoice', component: VotingChoiceComponent },
{ path: 'voting', component: VotingComponent }, { path: 'voting', component: VotingComponent },
]; ];

View File

@ -3,7 +3,7 @@ import { NgModule } from '@angular/core';
import { TranslateModule } from '@ngx-translate/core'; import { TranslateModule } from '@ngx-translate/core';
import { ConfirmationService, DialogModule, MessageService } from 'primeng'; import { ConfirmationService, DialogModule, MessageService } from 'primeng';
import { SharedModule } from '../../shared/shared.module'; import { SharedModule } from '../../src/app/shared/shared.module';
import { DateValueAccessorModule } from './custom-lib/date-value-accessor'; import { DateValueAccessorModule } from './custom-lib/date-value-accessor';
import { OldStuffRoutingModule } from './old-stuff-routing.module'; import { OldStuffRoutingModule } from './old-stuff-routing.module';
import { AdminComponent } from './pages/admin/admin.component'; import { AdminComponent } from './pages/admin/admin.component';

View File

@ -2,8 +2,8 @@ import { Component, OnInit } from '@angular/core';
import { ConfigService } from '../../services/config.service'; import { ConfigService } from '../../services/config.service';
import { ActivatedRoute, Router } from '@angular/router'; import { ActivatedRoute, Router } from '@angular/router';
import { HttpClient } from '@angular/common/http'; import { HttpClient } from '@angular/common/http';
import { PollUtilities } from '../../config/PollUtilities'; import { PollUtilitiesService } from '../../../../src/app/core/services/poll.utilities.service';
import { environment } from '../../../../../environments/environment'; import { environment } from '../../../../src/environments/environment';
@Component({ @Component({
selector: 'app-admin', selector: 'app-admin',
@ -16,7 +16,7 @@ export class AdminComponent implements OnInit {
constructor( constructor(
public config: ConfigService, public config: ConfigService,
public router: Router, public router: Router,
private utils: PollUtilities, private utils: PollUtilitiesService,
public http: HttpClient, public http: HttpClient,
public activeRoute: ActivatedRoute public activeRoute: ActivatedRoute
) {} ) {}
@ -39,7 +39,7 @@ export class AdminComponent implements OnInit {
}); });
} }
// fetch poll with its ID or slug. // fetch poll with its ID or custom_url.
fetchPoll() { fetchPoll() {
const token = this.tokenForAdministration; const token = this.tokenForAdministration;
const headers = this.utils.makeHeaders({ token: token }); const headers = this.utils.makeHeaders({ token: token });

View File

@ -1,8 +1,8 @@
import { DOCUMENT } from '@angular/common'; import { DOCUMENT } from '@angular/common';
import { ChangeDetectorRef, Component, Inject, OnInit } from '@angular/core'; import { ChangeDetectorRef, Component, Inject, OnInit } from '@angular/core';
import { ToastService } from '../../../../core/services/toast.service'; import { ToastService } from '../../../../src/app/core/services/toast.service';
import { DateUtilities } from '../../config/DateUtilities'; import { DateUtilitiesService } from '../../../../src/app/core/services/date.utilities.service';
import { otherDefaultDates } from '../../config/defaultConfigs'; import { otherDefaultDates } from '../../config/defaultConfigs';
import { ConfigService } from '../../services/config.service'; import { ConfigService } from '../../services/config.service';
import { BaseComponent } from '../example/base-page/base.component'; import { BaseComponent } from '../example/base-page/base.component';
@ -23,7 +23,7 @@ export class DatesComponent extends BaseComponent implements OnInit {
public config: ConfigService, public config: ConfigService,
private cd: ChangeDetectorRef, private cd: ChangeDetectorRef,
private toastService: ToastService, private toastService: ToastService,
private dateUtilities: DateUtilities, private dateUtilities: DateUtilitiesService,
@Inject(DOCUMENT) private document: any @Inject(DOCUMENT) private document: any
) { ) {
super(config); super(config);

View File

@ -1,7 +1,7 @@
import { HttpClient } from '@angular/common/http'; import { HttpClient } from '@angular/common/http';
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { ToastService } from '../../../../core/services/toast.service'; import { ToastService } from '../../../../src/app/core/services/toast.service';
import { ConfigService } from '../../services/config.service'; import { ConfigService } from '../../services/config.service';
import { BaseComponent } from '../example/base-page/base.component'; import { BaseComponent } from '../example/base-page/base.component';

View File

@ -47,7 +47,7 @@
<br /> <br />
<a href="/" class="btn btn--primary btn--outline"> <a href='/' class="btn btn--primary btn--outline">
primary - outline - default primary - outline - default
</a> </a>

View File

@ -0,0 +1 @@
@import '../../../../../src/styles/variables';

View File

@ -3,7 +3,7 @@ import { BaseComponent } from '../../example/base-page/base.component';
import { ConfigService } from '../../../services/config.service'; import { ConfigService } from '../../../services/config.service';
import { mockComments } from '../../../mocks/mock-comments'; import { mockComments } from '../../../mocks/mock-comments';
import { ActivatedRoute, Router } from '@angular/router'; import { ActivatedRoute, Router } from '@angular/router';
import { environment } from '../../../../../../environments/environment'; import { environment } from '../../../../../src/environments/environment';
import { mockPoll3 } from '../../../mocks/mock-poll3'; import { mockPoll3 } from '../../../mocks/mock-poll3';
@Component({ @Component({
@ -28,7 +28,7 @@ export class PollDisplayComponent extends BaseComponent implements OnInit {
ngOnInit(): void {} ngOnInit(): void {}
// fetch poll with its ID or slug. // fetch poll with its ID or custom_url.
fetchPoll() { fetchPoll() {
const id = this.activeRoute.snapshot.params.poll; const id = this.activeRoute.snapshot.params.poll;
const pollSlug = this.activeRoute.snapshot.params.pollSlug; const pollSlug = this.activeRoute.snapshot.params.pollSlug;

View File

@ -102,8 +102,8 @@
{{ 'visibility.access_instructions' | translate }} {{ 'visibility.access_instructions' | translate }}
</sub> </sub>
<div class="preview-url"> <div class="preview-url">
<a [href]="'/vote/poll/slug/' + config.customUrl"> <a [href]="'/vote/poll/custom_url/' + config.customUrl">
{{ '/vote/poll/slug/' + config.customUrl }} {{ '/vote/poll/custom_url/' + config.customUrl }}
</a> </a>
</div> </div>
<br /> <br />

View File

@ -1,8 +1,8 @@
import { Location } from '@angular/common'; import { Location } from '@angular/common';
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { environment } from '../../../../../environments/environment'; import { environment } from '../../../../src/environments/environment';
import { PollUtilities } from '../../config/PollUtilities'; import { PollUtilitiesService } from '../../../../src/app/core/services/poll.utilities.service';
import { ConfigService } from '../../services/config.service'; import { ConfigService } from '../../services/config.service';
import { BaseComponent } from '../example/base-page/base.component'; import { BaseComponent } from '../example/base-page/base.component';
@ -16,12 +16,12 @@ export class VisibilityComponent extends BaseComponent implements OnInit {
public showCustomPassword = false; public showCustomPassword = false;
public baseUrl = environment.api.baseHref; public baseUrl = environment.api.baseHref;
constructor(public config: ConfigService, public utils: PollUtilities) { constructor(public config: ConfigService, public utils: PollUtilitiesService) {
super(config); super(config);
} }
ngOnInit(): void { ngOnInit(): void {
this.config.customUrl = 'un slug'; this.config.customUrl = 'un custom_url';
this.config.expirationDate = this.config this.config.expirationDate = this.config
.addDaysToDate(this.config.expiracyDateDefaultInDays, new Date()) .addDaysToDate(this.config.expiracyDateDefaultInDays, new Date())
.toISOString() .toISOString()

View File

@ -5,7 +5,7 @@
// -- IMPORTS // -- IMPORTS
// ---------------------------- // ----------------------------
@import '../../../../../../styles/variables'; @import '../../../../../src/styles/variables';
// -- VARIABLES // -- VARIABLES
// ---------------------------- // ----------------------------

Some files were not shown because too many files have changed in this diff Show More