Skip to content

Commit 2b80b71

Browse files
Merge pull request #605 from berta-cms/fix-ts-strict-templates
Code quality improvements
2 parents 412b2e4 + 63be394 commit 2b80b71

File tree

11 files changed

+21
-14
lines changed

11 files changed

+21
-14
lines changed

_api_app/app/Http/Middleware/SetupMiddleware.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ protected function parseEnvFile($file)
5858
}
5959

6060
$content = trim(file_get_contents(realpath($file)));
61+
62+
if (empty($content)) {
63+
return $res;
64+
}
65+
6166
$rows = preg_split('/\s+/', $content);
6267
// Loop through given data
6368
foreach ((array) $rows as $key => $value) {

editor/src/app/inputs/file-input.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ import { SettingModel } from '../shared/interfaces';
9090
})
9191
export class FileInputComponent implements OnInit {
9292
@Input() label: string;
93-
@Input() templateSlug: string;
9493
@Input() property: string;
9594
@Input() value: string | File;
9695
@Input() accept: string;

editor/src/app/sites/media/entry-gallery-editor.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ export class EntryGalleryEditorComponent implements OnInit {
603603
);
604604
}
605605

606-
openCropItemPage(event: PointerEvent, fileName: string) {
606+
openCropItemPage(event: MouseEvent, fileName: string) {
607607
event.stopPropagation();
608608
const image_order = this.currentEntry.mediaCacheData.file.findIndex(
609609
(file) => file['@attributes'].src === fileName,
@@ -612,7 +612,7 @@ export class EntryGalleryEditorComponent implements OnInit {
612612
this.router.navigate([url], { queryParamsHandling: 'preserve' });
613613
}
614614

615-
deleteItem(event: PointerEvent, file: string) {
615+
deleteItem(event: MouseEvent, file: string) {
616616
event.stopPropagation();
617617
this.popupService.showPopup({
618618
type: 'warn',

editor/src/app/sites/media/site-media.component.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { SectionEntriesState } from '../sections/entries/entries-state/section-e
1212
import { ActivatedRoute } from '@angular/router';
1313
import { SitesState } from '../sites-state/sites.state';
1414
import { SiteStateModel } from '../sites-state/site-state.model';
15+
import { SectionEntry } from '../sections/entries/entries-state/section-entries-state.model';
1516

1617
@Component({
1718
selector: 'berta-site-media',
@@ -108,6 +109,7 @@ export class SiteMediaComponent implements OnInit, OnDestroy {
108109
selectedSections: {
109110
section: SiteSectionStateModel;
110111
tags: any;
112+
entries: SectionEntry[];
111113
}[];
112114
selectedTag: string | null;
113115
showAllSections: boolean;

editor/src/app/sites/sections/background-gallery-editor.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ export class BackgroundGalleryEditorComponent implements OnInit {
454454
);
455455
}
456456

457-
deleteItem(event: PointerEvent, file: string) {
457+
deleteItem(event: MouseEvent, file: string) {
458458
event.stopPropagation();
459459
this.popupService.showPopup({
460460
type: 'warn',

editor/src/app/sites/sections/section.component.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,13 @@ import { take, filter, switchMap, map } from 'rxjs/operators';
55
import { Store } from '@ngxs/store';
66
import { PopupService } from '../../popup/popup.service';
77
import { SiteSectionStateModel } from './sections-state/site-sections-state.model';
8-
import {
9-
SiteTemplateSectionTypesModel,
10-
TemplateTranslationsModel,
11-
} from '../template-settings/site-templates.interface';
8+
import { TemplateTranslationsModel } from '../template-settings/site-templates.interface';
129
import {
1310
DeleteSiteSectionAction,
1411
CloneSectionAction,
1512
} from './sections-state/site-sections.actions';
1613
import { AppState } from '../../app-state/app.state';
14+
import { SettingConfigModel } from '../../shared/interfaces';
1715

1816
@Component({
1917
selector: 'berta-section',
@@ -152,7 +150,7 @@ export class SectionComponent implements OnInit {
152150
@Input('section') section: SiteSectionStateModel;
153151
@Input('isExpanded') isExpanded: boolean;
154152
@Input('templateSectionTypes')
155-
templateSectionTypes: SiteTemplateSectionTypesModel;
153+
templateSectionTypes: SettingConfigModel['values'];
156154
@Input('translations') translations: TemplateTranslationsModel;
157155
@Input('params') params: any[] = [];
158156

editor/src/app/sites/sections/sections-state/site-sections-state.model.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export interface SiteSectionStateModel {
2525
autoplay?: 0 | 1;
2626
image_size?: string;
2727
animation?: string;
28+
fade_content?: 'enabled' | 'disabled';
2829
};
2930
};
3031
'@attributes'?: {

editor/src/app/sites/shared/help-tooltip.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Component, Input } from '@angular/core';
55
template: `
66
<span
77
[tooltipStr]="content"
8-
showDelay="200"
8+
[showDelay]="200"
99
textColor="white"
1010
backgroundColor="black"
1111
borderColor="transparent"
@@ -39,7 +39,7 @@ import { Component, Input } from '@angular/core';
3939
export class HelpTooltipComponent {
4040
@Input() content: string;
4141

42-
onClick(e: PointerEvent) {
42+
onClick(e: MouseEvent): boolean {
4343
e.stopPropagation();
4444
return false;
4545
}

editor/src/app/sites/shared/setting.component.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ import { UpdateInputFocus } from '../../app-state/app.actions';
4949
@case ('icon') {
5050
<berta-file-input
5151
[label]="config.title"
52-
[templateSlug]="templateSlug"
5352
[property]="setting.slug"
5453
[accept]="'image/png'"
5554
[value]="setting.value"
@@ -166,7 +165,6 @@ import { UpdateInputFocus } from '../../app-state/app.actions';
166165
standalone: false,
167166
})
168167
export class SettingComponent implements OnInit {
169-
@Input('templateSlug') templateSlug: string;
170168
@Input('setting') setting: SettingModel;
171169
@Input('config') config: SettingConfigModel;
172170
@Input() disabled: boolean;

editor/src/app/sites/template-settings/site-template-settings.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ import { AppState } from '../../app-state/app.state';
5959
<div>
6060
@for (setting of settingGroup.settings; track setting) {
6161
<berta-setting
62-
[templateSlug]="settingGroup.templateSlug"
6362
[setting]="setting.setting"
6463
[config]="setting.config"
6564
[disabled]="

0 commit comments

Comments
 (0)