mirror of
https://framagit.org/framasoft/framadate/funky-framadate-front.git
synced 2023-08-25 13:53:14 +02:00
fix time slices creation, were all linked
This commit is contained in:
parent
0834ea3ffa
commit
4a7b989142
@ -52,6 +52,7 @@
|
||||
"chart.js": "^2.9.3",
|
||||
"crypto": "^1.0.1",
|
||||
"fork-awesome": "^1.1.7",
|
||||
"ng-keyboard-shortcuts": "^10.1.17",
|
||||
"ng2-charts": "^2.3.0",
|
||||
"ngx-clipboard": "^13.0.0",
|
||||
"ngx-markdown": "^9.0.0",
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Component, OnDestroy, OnInit } from '@angular/core';
|
||||
import { AfterViewInit, Component, OnDestroy, OnInit } from '@angular/core';
|
||||
import { Title } from '@angular/platform-browser';
|
||||
import { Subscription } from 'rxjs';
|
||||
|
||||
@ -8,6 +8,8 @@ import { LanguageService } from './core/services/language.service';
|
||||
import { ThemeService } from './core/services/theme.service';
|
||||
import { NavigationEnd, Router, RouterOutlet } from '@angular/router';
|
||||
import { slideInAnimation } from './shared/animations/main';
|
||||
import { FramaKeyboardShortcuts } from './shared/shortcuts/main';
|
||||
import { ShortcutInput } from 'ng-keyboard-shortcuts';
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
@ -15,7 +17,9 @@ import { slideInAnimation } from './shared/animations/main';
|
||||
styleUrls: ['./app.component.scss'],
|
||||
animations: [slideInAnimation],
|
||||
})
|
||||
export class AppComponent implements OnInit, OnDestroy {
|
||||
export class AppComponent implements OnInit, OnDestroy, AfterViewInit {
|
||||
shortcuts: ShortcutInput[] = FramaKeyboardShortcuts;
|
||||
|
||||
public appTitle: string = environment.appTitle;
|
||||
public appLogo: string = environment.appLogo;
|
||||
public themeClass: string;
|
||||
@ -61,6 +65,15 @@ export class AppComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
});
|
||||
}
|
||||
ngAfterViewInit() {
|
||||
this.shortcuts.push({
|
||||
key: ['cmd + g'],
|
||||
label: 'Help',
|
||||
description: 'Command + G',
|
||||
command: (e) => console.log(e),
|
||||
preventDefault: true,
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
if (this.themeSubscription) {
|
||||
|
@ -28,6 +28,8 @@ import { LegalComponent } from './features/shared/components/ui/static-pages/leg
|
||||
import { PrivacyComponent } from './features/shared/components/ui/static-pages/privacy/privacy.component';
|
||||
import { CipheringComponent } from './features/shared/components/ui/static-pages/ciphering/ciphering.component';
|
||||
import { ErrorsListComponent } from './features/shared/components/ui/form/errors-list/errors-list.component';
|
||||
import { KeyboardShortcutsModule } from 'ng-keyboard-shortcuts';
|
||||
import { AdministrationModule } from './features/administration/administration.module';
|
||||
registerLocaleData(localeEn, 'en-EN');
|
||||
registerLocaleData(localeFr, 'fr-FR');
|
||||
|
||||
@ -45,6 +47,7 @@ export function HttpLoaderFactory(http: HttpClient): TranslateHttpLoader {
|
||||
declarations: [AppComponent, CguComponent, LegalComponent, PrivacyComponent, CipheringComponent],
|
||||
imports: [
|
||||
AppRoutingModule,
|
||||
AdministrationModule,
|
||||
BrowserAnimationsModule,
|
||||
BrowserModule,
|
||||
ClipboardModule,
|
||||
@ -52,6 +55,7 @@ export function HttpLoaderFactory(http: HttpClient): TranslateHttpLoader {
|
||||
CoreModule,
|
||||
FormsModule,
|
||||
HttpClientModule,
|
||||
KeyboardShortcutsModule.forRoot(),
|
||||
MarkdownModule.forRoot(),
|
||||
NgxWebstorageModule.forRoot({ prefix: environment.localStorage.key }),
|
||||
SharedModule,
|
||||
|
@ -104,22 +104,22 @@ export class DateUtilitiesService {
|
||||
return [
|
||||
{
|
||||
literal: this.formateDateToInputStringNg(ladate),
|
||||
timeList: defaultTimeOfDay,
|
||||
timeList: Object.create(defaultTimeOfDay),
|
||||
date_object: ladate,
|
||||
},
|
||||
{
|
||||
literal: this.formateDateToInputStringNg(ladate2),
|
||||
timeList: defaultTimeOfDay,
|
||||
timeList: Object.create(defaultTimeOfDay),
|
||||
date_object: ladate2,
|
||||
},
|
||||
{
|
||||
literal: this.formateDateToInputStringNg(ladate3),
|
||||
timeList: defaultTimeOfDay,
|
||||
timeList: Object.create(defaultTimeOfDay),
|
||||
date_object: ladate3,
|
||||
},
|
||||
{
|
||||
literal: this.formateDateToInputStringNg(ladate4),
|
||||
timeList: defaultTimeOfDay,
|
||||
timeList: Object.create(defaultTimeOfDay),
|
||||
date_object: ladate4,
|
||||
},
|
||||
];
|
||||
|
@ -18,7 +18,6 @@ import { BaseConfigComponent } from './form/base-config/base-config.component';
|
||||
import { AdvancedConfigComponent } from './form/advanced-config/advanced-config.component';
|
||||
import { CalendarModule, DialogModule } from 'primeng';
|
||||
import { DragDropModule } from '@angular/cdk/drag-drop';
|
||||
import { AppModule } from '../../app.module';
|
||||
import { IntervalComponent } from './form/date/interval/interval.component';
|
||||
import { DayListComponent } from './form/date/list/day/day-list.component';
|
||||
import { PickerComponent } from './form/date/picker/picker.component';
|
||||
|
@ -7,13 +7,8 @@ import { DateUtilitiesService } from '../../../../core/services/date.utilities.s
|
||||
import { ApiService } from '../../../../core/services/api.service';
|
||||
import { Router } from '@angular/router';
|
||||
import { DOCUMENT } from '@angular/common';
|
||||
import {
|
||||
DateChoice,
|
||||
defaultTimeOfDay,
|
||||
otherDefaultDates,
|
||||
TimeSlices,
|
||||
} from '../../../../../../mocks/old-stuff/config/defaultConfigs';
|
||||
import { moveItemInArray, transferArrayItem } from '@angular/cdk/drag-drop';
|
||||
import { DateChoice, defaultTimeOfDay, TimeSlices } from '../../../../../../mocks/old-stuff/config/defaultConfigs';
|
||||
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { StorageService } from '../../../../core/services/storage.service';
|
||||
|
||||
@ -71,7 +66,7 @@ export class DateSelectComponent implements OnInit {
|
||||
this.toastService.display('périodes horaires vidées');
|
||||
}
|
||||
|
||||
resetTimes(slices = defaultTimeOfDay) {
|
||||
resetTimes(slices = Object.create(defaultTimeOfDay)) {
|
||||
this.timeSlices = slices;
|
||||
this.dateList.map((elem) => (elem.timeList = Object.create(slices)));
|
||||
this.toastService.display('périodes horaires réinitialisées');
|
||||
|
@ -30,7 +30,7 @@
|
||||
cdkDrag
|
||||
[ngClass]="{ 'day-weekend': isWeekendDay(choice.date_object) }"
|
||||
>
|
||||
<span class="button is-default" for="dateChoices_{{ id }}">
|
||||
<span class="button is-default">
|
||||
<i class="icon fa fa-arrows-v"></i>
|
||||
<span *ngIf="choice.date_object">
|
||||
{{ choice.date_object | date: 'E':'Europe/Paris':'fr_FR' }}
|
||||
|
@ -37,7 +37,7 @@
|
||||
<div class="ui-card-subtitle">
|
||||
Exporter/Imprimer
|
||||
</div>
|
||||
<button class="replicate export-csv btn" (click)="duplicate()">
|
||||
<button class="replicate duplicate btn" (click)="duplicate()">
|
||||
<i class="fa fa-copy" aria-hidden="true"></i>
|
||||
Dupliquer
|
||||
</button>
|
||||
|
18
src/app/shared/shortcuts/main.ts
Normal file
18
src/app/shared/shortcuts/main.ts
Normal file
@ -0,0 +1,18 @@
|
||||
import { ShortcutEventOutput } from 'ng-keyboard-shortcuts';
|
||||
|
||||
export const FramaKeyboardShortcuts = [
|
||||
{
|
||||
key: ['cmd + a'],
|
||||
command: (output: ShortcutEventOutput) => console.log('command + a', output),
|
||||
},
|
||||
{
|
||||
key: 'ctrl + a',
|
||||
preventDefault: true,
|
||||
command: (output: ShortcutEventOutput) => console.log('control + a', output),
|
||||
},
|
||||
{
|
||||
key: 'ctrl + plus',
|
||||
preventDefault: true,
|
||||
command: (output: ShortcutEventOutput) => console.log('control + plus key', output),
|
||||
},
|
||||
];
|
@ -17,6 +17,7 @@
|
||||
"angularCompilerOptions": {
|
||||
"fullTemplateTypeCheck": true,
|
||||
"strictInjectionParameters": true,
|
||||
"strictTemplates": true
|
||||
"strictTemplates": true,
|
||||
"enableIvy": false
|
||||
}
|
||||
}
|
||||
|
12
yarn.lock
12
yarn.lock
@ -8142,6 +8142,13 @@ next-tick@~1.0.0:
|
||||
resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.0.0.tgz#ca86d1fe8828169b0120208e3dc8424b9db8342c"
|
||||
integrity sha1-yobR/ogoFpsBICCOPchCS524NCw=
|
||||
|
||||
ng-keyboard-shortcuts@^10.1.17:
|
||||
version "10.1.17"
|
||||
resolved "https://registry.yarnpkg.com/ng-keyboard-shortcuts/-/ng-keyboard-shortcuts-10.1.17.tgz#e31b72632ccb75daca8aae0ddd8fbc63a51f6054"
|
||||
integrity sha512-uJ71+qMyt3kd6xsIv674uRgHPNcxkNxDMYhHLJor3eyi8kWJIRMok4UdIA4b7WtQ7+Pv3iWB6aO/HOzLRONZxw==
|
||||
dependencies:
|
||||
tslib "^2.0.0"
|
||||
|
||||
ng2-charts@^2.3.0:
|
||||
version "2.3.2"
|
||||
resolved "https://registry.yarnpkg.com/ng2-charts/-/ng2-charts-2.3.2.tgz#206de368e58f9655e167b6791c9d2a804191ef99"
|
||||
@ -11498,6 +11505,11 @@ tslib@<2.0.0, tslib@^1.10.0, tslib@^1.8.1, tslib@^1.9.0:
|
||||
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.13.0.tgz#c881e13cc7015894ed914862d276436fa9a47043"
|
||||
integrity sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q==
|
||||
|
||||
tslib@^2.0.0:
|
||||
version "2.2.0"
|
||||
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.2.0.tgz#fb2c475977e35e241311ede2693cee1ec6698f5c"
|
||||
integrity sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w==
|
||||
|
||||
tsutils@^3.17.1:
|
||||
version "3.17.1"
|
||||
resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.17.1.tgz#ed719917f11ca0dee586272b2ac49e015a2dd759"
|
||||
|
Loading…
Reference in New Issue
Block a user