mirror of
https://framagit.org/framasoft/framadate/funky-framadate-front.git
synced 2023-08-25 13:53:14 +02:00
hop
This commit is contained in:
parent
b4f496b08d
commit
6db96397ea
@ -1,12 +1,12 @@
|
||||
import {Component, OnDestroy, OnInit} from '@angular/core';
|
||||
import {Title} from '@angular/platform-browser';
|
||||
import {Subscription} from 'rxjs';
|
||||
import { Component, OnDestroy, OnInit } from '@angular/core';
|
||||
import { Title } from '@angular/platform-browser';
|
||||
import { Subscription } from 'rxjs';
|
||||
|
||||
import {environment} from '../environments/environment';
|
||||
import {Theme} from './core/enums/theme.enum';
|
||||
import {LanguageService} from './core/services/language.service';
|
||||
import {ThemeService} from './core/services/theme.service';
|
||||
import {MockingService} from './core/services/mocking.service';
|
||||
import { environment } from '../environments/environment';
|
||||
import { Theme } from './core/enums/theme.enum';
|
||||
import { LanguageService } from './core/services/language.service';
|
||||
import { ThemeService } from './core/services/theme.service';
|
||||
import { MockingService } from './core/services/mocking.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
@ -23,16 +23,15 @@ export class AppComponent implements OnInit, OnDestroy {
|
||||
constructor(
|
||||
private titleService: Title,
|
||||
private themeService: ThemeService,
|
||||
private languageService: LanguageService,
|
||||
private mockingService: MockingService
|
||||
) {
|
||||
}
|
||||
private languageService: LanguageService
|
||||
) // private mockingService: MockingService
|
||||
{}
|
||||
|
||||
ngOnInit(): void {
|
||||
if (!environment.production) {
|
||||
this.appTitle += ' [DEV]';
|
||||
// TODO: to be removed
|
||||
this.mockingService.init();
|
||||
// this.mockingService.init();
|
||||
}
|
||||
this.titleService.setTitle(this.appTitle);
|
||||
this.languageService.configureAndInitTranslations();
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
<div id="navbarBasicExample" class="navbar-menu">
|
||||
<div class="navbar-start">
|
||||
<a class="navbar-item" routerLink="/administration" routerLinkActive="is-active">
|
||||
<a class="navbar-item" routerLink="administration" routerLinkActive="is-active">
|
||||
{{ 'config.title' | translate }}
|
||||
</a>
|
||||
<a class="navbar-item" routerLink="user/polls" routerLinkActive="is-active">
|
||||
|
@ -47,10 +47,13 @@ export class PollService implements Resolve<Poll> {
|
||||
}
|
||||
|
||||
public async loadPollBySlug(slug: string): Promise<void> {
|
||||
console.log('slug', slug);
|
||||
if (slug) {
|
||||
const poll: Poll | undefined = await this.apiService.getPollBySlug(slug);
|
||||
console.log({ loadPollBySlugResponse: poll });
|
||||
this.updateCurrentPoll(poll);
|
||||
}
|
||||
}
|
||||
|
||||
public updateCurrentPoll(poll: Poll): void {
|
||||
this._poll.next(poll);
|
||||
|
@ -2,8 +2,12 @@ import { NgModule } from '@angular/core';
|
||||
import { RouterModule, Routes } from '@angular/router';
|
||||
|
||||
import { AdministrationComponent } from './administration.component';
|
||||
import { NamingComponent } from './naming/naming.component';
|
||||
|
||||
const routes: Routes = [{ path: '', component: AdministrationComponent }];
|
||||
const routes: Routes = [
|
||||
{ path: '', component: AdministrationComponent },
|
||||
{ path: 'naming', component: NamingComponent },
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forChild(routes)],
|
||||
|
@ -6,6 +6,8 @@
|
||||
|
||||
<div class="columns">
|
||||
<div class="column">
|
||||
<!-- <app-stepper [poll]="poll"></app-stepper>-->
|
||||
<app-stepper [poll]="poll"></app-stepper>
|
||||
<h1>Administration de sondage</h1>
|
||||
<h1 class="title is-1"><i class="fa fa-calendar" aria-hidden="true"></i> {{ 'dates.title' | translate }}</h1>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -14,6 +14,7 @@ import { SettingsComponent } from '../../shared/components/settings/settings.com
|
||||
})
|
||||
export class AdministrationComponent implements OnInit, OnDestroy {
|
||||
public poll: Poll;
|
||||
public form: Object;
|
||||
private routeSubscription: Subscription;
|
||||
|
||||
constructor(private route: ActivatedRoute, private userService: UserService, private modalService: ModalService) {}
|
||||
@ -23,6 +24,7 @@ export class AdministrationComponent implements OnInit, OnDestroy {
|
||||
this.modalService.openModal(SettingsComponent);
|
||||
}
|
||||
this.routeSubscription = this.route.data.subscribe((data: { poll: Poll }) => {
|
||||
console.log('data', data);
|
||||
if (data.poll) {
|
||||
this.poll = data.poll;
|
||||
}
|
||||
|
@ -7,9 +7,10 @@ import { SharedModule } from '../../shared/shared.module';
|
||||
import { AdministrationRoutingModule } from './administration-routing.module';
|
||||
import { AdministrationComponent } from './administration.component';
|
||||
import { StepperComponent } from './stepper/stepper.component';
|
||||
import { NamingComponent } from './naming/naming.component';
|
||||
|
||||
@NgModule({
|
||||
declarations: [AdministrationComponent, StepperComponent],
|
||||
declarations: [AdministrationComponent, StepperComponent, NamingComponent],
|
||||
imports: [
|
||||
AdministrationRoutingModule,
|
||||
CommonModule,
|
||||
|
@ -0,0 +1 @@
|
||||
<p>naming works!</p>
|
@ -0,0 +1,24 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { NamingComponent } from './naming.component';
|
||||
|
||||
describe('NamingComponent', () => {
|
||||
let component: NamingComponent;
|
||||
let fixture: ComponentFixture<NamingComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [NamingComponent],
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(NamingComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
12
src/app/features/administration/naming/naming.component.ts
Normal file
12
src/app/features/administration/naming/naming.component.ts
Normal file
@ -0,0 +1,12 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-naming',
|
||||
templateUrl: './naming.component.html',
|
||||
styleUrls: ['./naming.component.scss'],
|
||||
})
|
||||
export class NamingComponent implements OnInit {
|
||||
constructor() {}
|
||||
|
||||
ngOnInit(): void {}
|
||||
}
|
@ -3,7 +3,7 @@
|
||||
<form [formGroup]="pollFormGroup">
|
||||
<ng-template matStepLabel>Informations du sondage</ng-template>
|
||||
<mat-form-field appearance="outline">
|
||||
<mat-label>Question posée, sujet, etc.</mat-label>
|
||||
<mat-label>Titre</mat-label>
|
||||
<input #question matInput placeholder="Question posée, sujet" formControlName="question" required />
|
||||
<button
|
||||
mat-button
|
||||
@ -16,21 +16,7 @@
|
||||
<i class="fa fa-close"></i>
|
||||
</button>
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="outline" class="is-flex">
|
||||
<mat-label>Url pour les participants</mat-label>
|
||||
<span matPrefix>{{ urlPrefix }}</span>
|
||||
<input #slug matInput placeholder="Url" formControlName="slug" required />
|
||||
<button
|
||||
mat-button
|
||||
*ngIf="slug.value"
|
||||
matSuffix
|
||||
mat-icon-button
|
||||
aria-label="Clear"
|
||||
(click)="slug.value = ''"
|
||||
>
|
||||
<i class="fa fa-close"></i>
|
||||
</button>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="is-flex">
|
||||
<mat-label>Description</mat-label>
|
||||
<textarea
|
||||
@ -51,7 +37,21 @@
|
||||
<i class="fa fa-close"></i>
|
||||
</button>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="outline" class="is-flex">
|
||||
<mat-label>Url pour les participants</mat-label>
|
||||
<span matPrefix>{{ urlPrefix }}</span>
|
||||
<input #slug matInput placeholder="Url" formControlName="slug" required />
|
||||
<button
|
||||
mat-button
|
||||
*ngIf="slug.value"
|
||||
matSuffix
|
||||
mat-icon-button
|
||||
aria-label="Clear"
|
||||
(click)="slug.value = ''"
|
||||
>
|
||||
<i class="fa fa-close"></i>
|
||||
</button>
|
||||
</mat-form-field>
|
||||
<div>
|
||||
<button mat-button matStepperNext>Next</button>
|
||||
</div>
|
||||
|
@ -10,7 +10,7 @@ const backendApiUrlsInDev = {
|
||||
export const environment = {
|
||||
production: false,
|
||||
appTitle: 'FramaDate',
|
||||
appLogo: '/assets/img/icon_voter_yes.png',
|
||||
appLogo: 'assets/img/logo.png',
|
||||
api: {
|
||||
baseHref: backendApiUrlsInDev.local,
|
||||
endpoints: {
|
||||
|
Loading…
Reference in New Issue
Block a user