From aba9627661141f73fd9683a38e5e76979c54345d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jovan=20Kruni=C4=87?= Date: Wed, 26 Oct 2022 18:05:54 +0200 Subject: [PATCH] refactor: adjust HeBIS templates in list Closes #318 --- src/app/modules/data/data.module.ts | 20 +++++++++--- src/app/modules/data/list/data-list-item.html | 12 +++++++ .../article/article-content.component.ts} | 6 ++-- .../types/article/article-content.html} | 0 .../article-detail-content.component.ts | 30 ------------------ .../types/article/article-detail-content.html | 16 ---------- ...component.ts => article-item.component.ts} | 2 +- .../data/types/article/article-list-item.html | 26 +++++++++++----- .../book/book-detail-content.component.ts | 0 .../types/book/book-detail-content.html | 0 .../types/book/book-list-item.component.ts | 2 +- .../data/types/book/book-list-item.html | 28 +++++++++++++++++ .../periodical-detail-content.component.ts | 0 .../periodical/periodical-detail-content.html | 0 .../periodical-list-item.component.ts | 2 +- .../periodical/periodical-list-item.html | 28 +++++++++++++++++ .../hebis-detail/hebis-detail-content.html | 4 +-- src/app/modules/hebis/hebis.module.ts | 24 -------------- .../hebis/types/book/book-list-item.html | 16 ---------- .../hebis-article-item.component.ts | 31 ------------------- .../hebis-article/hebis-article-item.html | 16 ---------- .../periodical/periodical-list-item.html | 16 ---------- 22 files changed, 110 insertions(+), 169 deletions(-) rename src/app/modules/{hebis/types/hebis-article/hebis-article-content.component.ts => data/types/article/article-content.component.ts} (85%) rename src/app/modules/{hebis/types/hebis-article/hebis-article-content.html => data/types/article/article-content.html} (100%) delete mode 100644 src/app/modules/data/types/article/article-detail-content.component.ts delete mode 100644 src/app/modules/data/types/article/article-detail-content.html rename src/app/modules/data/types/article/{article-list-item.component.ts => article-item.component.ts} (96%) rename src/app/modules/{hebis => data}/types/book/book-detail-content.component.ts (100%) rename src/app/modules/{hebis => data}/types/book/book-detail-content.html (100%) rename src/app/modules/{hebis => data}/types/book/book-list-item.component.ts (91%) create mode 100644 src/app/modules/data/types/book/book-list-item.html rename src/app/modules/{hebis => data}/types/periodical/periodical-detail-content.component.ts (100%) rename src/app/modules/{hebis => data}/types/periodical/periodical-detail-content.html (100%) rename src/app/modules/{hebis => data}/types/periodical/periodical-list-item.component.ts (92%) create mode 100644 src/app/modules/data/types/periodical/periodical-list-item.html delete mode 100644 src/app/modules/hebis/types/book/book-list-item.html delete mode 100644 src/app/modules/hebis/types/hebis-article/hebis-article-item.component.ts delete mode 100644 src/app/modules/hebis/types/hebis-article/hebis-article-item.html delete mode 100644 src/app/modules/hebis/types/periodical/periodical-list-item.html diff --git a/src/app/modules/data/data.module.ts b/src/app/modules/data/data.module.ts index 0784c78a..388e2e06 100644 --- a/src/app/modules/data/data.module.ts +++ b/src/app/modules/data/data.module.ts @@ -44,7 +44,6 @@ import {DataListComponent} from './list/data-list.component'; import {FoodDataListComponent} from './list/food-data-list.component'; import {SearchPageComponent} from './list/search-page.component'; import {StAppsWebHttpClient} from './stapps-web-http-client.provider'; -import {ArticleDetailContentComponent} from './types/article/article-detail-content.component'; import {CatalogDetailContentComponent} from './types/catalog/catalog-detail-content.component'; import {DateSeriesDetailContentComponent} from './types/date-series/date-series-detail-content.component'; import {DishDetailContentComponent} from './types/dish/dish-detail-content.component'; @@ -60,7 +59,6 @@ import {PlaceMensaDetailComponent} from './types/place/special/mensa/place-mensa import {SemesterDetailContentComponent} from './types/semester/semester-detail-content.component'; import {MapWidgetComponent} from '../map/widget/map-widget.component'; import {LeafletModule} from '@asymmetrik/ngx-leaflet'; -import {ArticleListItemComponent} from './types/article/article-list-item.component'; import {SkeletonSimpleCardComponent} from './elements/skeleton-simple-card.component'; import {CatalogListItemComponent} from './types/catalog/catalog-list-item.component'; import {DataListItemComponent} from './list/data-list-item.component'; @@ -91,6 +89,12 @@ import {TreeListFragmentComponent} from './list/tree-list-fragment.component'; import {SettingsProvider} from '../settings/settings.provider'; import {IonIconModule} from '../../util/ion-icon/ion-icon.module'; import {ExternalLinkComponent} from './elements/external-link.component'; +import {ArticleListItemComponent} from './types/article/article-item.component'; +import {ArticleContentComponent} from './types/article/article-content.component'; +import {BookDetailContentComponent} from './types/book/book-detail-content.component'; +import {BookListItemComponent} from './types/book/book-list-item.component'; +import {PeriodicalListItemComponent} from './types/periodical/periodical-list-item.component'; +import {PeriodicalDetailContentComponent} from './types/periodical/periodical-detail-content.component'; /** * Module for handling data @@ -101,8 +105,6 @@ import {ExternalLinkComponent} from './elements/external-link.component'; AddEventActionChipComponent, EditEventSelectionComponent, AddressDetailComponent, - ArticleDetailContentComponent, - ArticleListItemComponent, CatalogDetailContentComponent, CatalogListItemComponent, DataDetailComponent, @@ -152,6 +154,12 @@ import {ExternalLinkComponent} from './elements/external-link.component'; SimpleDataListComponent, TitleCardComponent, ExternalLinkComponent, + ArticleListItemComponent, + ArticleContentComponent, + BookListItemComponent, + BookDetailContentComponent, + PeriodicalListItemComponent, + PeriodicalDetailContentComponent, ], entryComponents: [DataListComponent, SimpleDataListComponent], imports: [ @@ -199,11 +207,13 @@ import {ExternalLinkComponent} from './elements/external-link.component'; SkeletonSimpleCardComponent, SearchPageComponent, SimpleDataListComponent, - ArticleDetailContentComponent, OriginDetailComponent, FavoriteButtonComponent, TreeListComponent, ExternalLinkComponent, + ArticleContentComponent, + BookDetailContentComponent, + PeriodicalDetailContentComponent, ], }) export class DataModule {} diff --git a/src/app/modules/data/list/data-list-item.html b/src/app/modules/data/list/data-list-item.html index 1845d8a5..e9cbfc23 100644 --- a/src/app/modules/data/list/data-list-item.html +++ b/src/app/modules/data/list/data-list-item.html @@ -103,6 +103,18 @@ [item]="$any(item)" *ngSwitchCase="item.type === 'video'" > + + +

{{ 'name' | thingTranslate: item }} diff --git a/src/app/modules/hebis/types/hebis-article/hebis-article-content.component.ts b/src/app/modules/data/types/article/article-content.component.ts similarity index 85% rename from src/app/modules/hebis/types/hebis-article/hebis-article-content.component.ts rename to src/app/modules/data/types/article/article-content.component.ts index 485594ae..569fc73f 100644 --- a/src/app/modules/hebis/types/hebis-article/hebis-article-content.component.ts +++ b/src/app/modules/data/types/article/article-content.component.ts @@ -19,10 +19,10 @@ import {SCArticle} from '@openstapps/core'; * TODO */ @Component({ - selector: 'stapps-hebis-article-content', - templateUrl: 'hebis-article-content.html', + selector: 'stapps-article-content', + templateUrl: 'article-content.html', }) -export class HebisArticleContentComponent { +export class ArticleContentComponent { /** * TODO */ diff --git a/src/app/modules/hebis/types/hebis-article/hebis-article-content.html b/src/app/modules/data/types/article/article-content.html similarity index 100% rename from src/app/modules/hebis/types/hebis-article/hebis-article-content.html rename to src/app/modules/data/types/article/article-content.html diff --git a/src/app/modules/data/types/article/article-detail-content.component.ts b/src/app/modules/data/types/article/article-detail-content.component.ts deleted file mode 100644 index 6de71a84..00000000 --- a/src/app/modules/data/types/article/article-detail-content.component.ts +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2019 StApps - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation, version 3. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - */ -import {Component, Input} from '@angular/core'; -import {SCArticle} from '@openstapps/core'; - -/** - * TODO - */ -@Component({ - selector: 'stapps-article-detail-content', - templateUrl: 'article-detail-content.html', -}) -export class ArticleDetailContentComponent { - /** - * TODO - */ - @Input() item: SCArticle; -} diff --git a/src/app/modules/data/types/article/article-detail-content.html b/src/app/modules/data/types/article/article-detail-content.html deleted file mode 100644 index a8284829..00000000 --- a/src/app/modules/data/types/article/article-detail-content.html +++ /dev/null @@ -1,16 +0,0 @@ - - - - - diff --git a/src/app/modules/data/types/article/article-list-item.component.ts b/src/app/modules/data/types/article/article-item.component.ts similarity index 96% rename from src/app/modules/data/types/article/article-list-item.component.ts rename to src/app/modules/data/types/article/article-item.component.ts index 96474731..66aea6bd 100644 --- a/src/app/modules/data/types/article/article-list-item.component.ts +++ b/src/app/modules/data/types/article/article-item.component.ts @@ -20,7 +20,7 @@ import {DataListItemComponent} from '../../list/data-list-item.component'; * TODO */ @Component({ - selector: 'stapps-article-list-item', + selector: 'stapps-article-item', templateUrl: 'article-list-item.html', }) export class ArticleListItemComponent extends DataListItemComponent { diff --git a/src/app/modules/data/types/article/article-list-item.html b/src/app/modules/data/types/article/article-list-item.html index fbe5b64a..e869a742 100644 --- a/src/app/modules/data/types/article/article-list-item.html +++ b/src/app/modules/data/types/article/article-list-item.html @@ -1,15 +1,27 @@ - {{ 'name' | thingTranslate: item }} -

- +

+ {{ 'name' | thingTranslate: item }} +

+

+ + {{ 'name' | thingTranslate: author }} + {{ item.firstPublished }}{{ + [item.firstPublished, item.lastPublished] | join: ' - ' + }}

- {{ 'type' | thingTranslate: item }} + {{ 'categories' | thingTranslate: item }}
diff --git a/src/app/modules/hebis/types/book/book-detail-content.component.ts b/src/app/modules/data/types/book/book-detail-content.component.ts similarity index 100% rename from src/app/modules/hebis/types/book/book-detail-content.component.ts rename to src/app/modules/data/types/book/book-detail-content.component.ts diff --git a/src/app/modules/hebis/types/book/book-detail-content.html b/src/app/modules/data/types/book/book-detail-content.html similarity index 100% rename from src/app/modules/hebis/types/book/book-detail-content.html rename to src/app/modules/data/types/book/book-detail-content.html diff --git a/src/app/modules/hebis/types/book/book-list-item.component.ts b/src/app/modules/data/types/book/book-list-item.component.ts similarity index 91% rename from src/app/modules/hebis/types/book/book-list-item.component.ts rename to src/app/modules/data/types/book/book-list-item.component.ts index 35abb0bb..e6b3bc23 100644 --- a/src/app/modules/hebis/types/book/book-list-item.component.ts +++ b/src/app/modules/data/types/book/book-list-item.component.ts @@ -14,7 +14,7 @@ */ import {Component, Input} from '@angular/core'; import {SCBook} from '@openstapps/core'; -import {DataListItemComponent} from '../../../data/list/data-list-item.component'; +import {DataListItemComponent} from '../../list/data-list-item.component'; /** * TODO diff --git a/src/app/modules/data/types/book/book-list-item.html b/src/app/modules/data/types/book/book-list-item.html new file mode 100644 index 00000000..e869a742 --- /dev/null +++ b/src/app/modules/data/types/book/book-list-item.html @@ -0,0 +1,28 @@ + + + +

+ {{ 'name' | thingTranslate: item }} +

+

+ + {{ 'name' | thingTranslate: author }} + {{ item.firstPublished }}{{ + [item.firstPublished, item.lastPublished] | join: ' - ' + }} +

+ + {{ 'categories' | thingTranslate: item }} + +
+
+
diff --git a/src/app/modules/hebis/types/periodical/periodical-detail-content.component.ts b/src/app/modules/data/types/periodical/periodical-detail-content.component.ts similarity index 100% rename from src/app/modules/hebis/types/periodical/periodical-detail-content.component.ts rename to src/app/modules/data/types/periodical/periodical-detail-content.component.ts diff --git a/src/app/modules/hebis/types/periodical/periodical-detail-content.html b/src/app/modules/data/types/periodical/periodical-detail-content.html similarity index 100% rename from src/app/modules/hebis/types/periodical/periodical-detail-content.html rename to src/app/modules/data/types/periodical/periodical-detail-content.html diff --git a/src/app/modules/hebis/types/periodical/periodical-list-item.component.ts b/src/app/modules/data/types/periodical/periodical-list-item.component.ts similarity index 92% rename from src/app/modules/hebis/types/periodical/periodical-list-item.component.ts rename to src/app/modules/data/types/periodical/periodical-list-item.component.ts index f727c009..1dc81d6b 100644 --- a/src/app/modules/hebis/types/periodical/periodical-list-item.component.ts +++ b/src/app/modules/data/types/periodical/periodical-list-item.component.ts @@ -14,7 +14,7 @@ */ import {Component, Input} from '@angular/core'; import {SCPeriodical} from '@openstapps/core'; -import {DataListItemComponent} from '../../../data/list/data-list-item.component'; +import {DataListItemComponent} from '../../list/data-list-item.component'; /** * TODO diff --git a/src/app/modules/data/types/periodical/periodical-list-item.html b/src/app/modules/data/types/periodical/periodical-list-item.html new file mode 100644 index 00000000..e869a742 --- /dev/null +++ b/src/app/modules/data/types/periodical/periodical-list-item.html @@ -0,0 +1,28 @@ + + + +

+ {{ 'name' | thingTranslate: item }} +

+

+ + {{ 'name' | thingTranslate: author }} + {{ item.firstPublished }}{{ + [item.firstPublished, item.lastPublished] | join: ' - ' + }} +

+ + {{ 'categories' | thingTranslate: item }} + +
+
+
diff --git a/src/app/modules/hebis/hebis-detail/hebis-detail-content.html b/src/app/modules/hebis/hebis-detail/hebis-detail-content.html index 12c8e727..1287d459 100644 --- a/src/app/modules/hebis/hebis-detail/hebis-detail-content.html +++ b/src/app/modules/hebis/hebis-detail/hebis-detail-content.html @@ -22,10 +22,10 @@ [item]="item" *ngSwitchCase="'periodical'" > - + > diff --git a/src/app/modules/hebis/hebis.module.ts b/src/app/modules/hebis/hebis.module.ts index 7004ee57..26cca1ce 100644 --- a/src/app/modules/hebis/hebis.module.ts +++ b/src/app/modules/hebis/hebis.module.ts @@ -32,14 +32,6 @@ import {DaiaDataProvider} from './daia-data.provider'; import {StAppsWebHttpClient} from '../data/stapps-web-http-client.provider'; import {HebisRoutingModule} from './hebis-routing.module'; import {DataModule} from '../data/data.module'; - -import {BookDetailContentComponent} from './types/book/book-detail-content.component'; -import {BookListItemComponent} from './types/book/book-list-item.component'; - -import {PeriodicalListItemComponent} from './types/periodical/periodical-list-item.component'; -import {PeriodicalDetailContentComponent} from './types/periodical/periodical-detail-content.component'; -import {HebisArticleListItemComponent} from './types/hebis-article/hebis-article-item.component'; -import {HebisArticleContentComponent} from './types/hebis-article/hebis-article-content.component'; import {DataListComponent} from '../data/list/data-list.component'; import {DaiaAvailabilityComponent} from './daia-availability/daia-availability.component'; import {UtilModule} from '../../util/util.module'; @@ -55,12 +47,6 @@ import {DaiaHoldingComponent} from './daia-availability/daia-holding.component'; HebisDetailComponent, HebisDetailContentComponent, DaiaAvailabilityComponent, - BookDetailContentComponent, - BookListItemComponent, - PeriodicalDetailContentComponent, - PeriodicalListItemComponent, - HebisArticleListItemComponent, - HebisArticleContentComponent, DaiaHoldingComponent, ], entryComponents: [DataListComponent], @@ -86,15 +72,5 @@ import {DaiaHoldingComponent} from './daia-availability/daia-holding.component'; UtilModule, ], providers: [HebisDataProvider, DaiaDataProvider, StAppsWebHttpClient], - exports: [ - HebisSearchPageComponent, - HebisDetailComponent, - HebisDetailContentComponent, - DaiaAvailabilityComponent, - PeriodicalDetailContentComponent, - BookDetailContentComponent, - HebisArticleListItemComponent, - HebisArticleContentComponent, - ], }) export class HebisModule {} diff --git a/src/app/modules/hebis/types/book/book-list-item.html b/src/app/modules/hebis/types/book/book-list-item.html deleted file mode 100644 index 180d8694..00000000 --- a/src/app/modules/hebis/types/book/book-list-item.html +++ /dev/null @@ -1,16 +0,0 @@ - - - -

{{ 'name' | thingTranslate: item }}

-

- -

- - {{ 'type' | thingTranslate: item }} - -
-
-
diff --git a/src/app/modules/hebis/types/hebis-article/hebis-article-item.component.ts b/src/app/modules/hebis/types/hebis-article/hebis-article-item.component.ts deleted file mode 100644 index 1f86495b..00000000 --- a/src/app/modules/hebis/types/hebis-article/hebis-article-item.component.ts +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (C) 2019 StApps - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation, version 3. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - */ -import {Component, Input} from '@angular/core'; -import {SCArticle} from '@openstapps/core'; -import {DataListItemComponent} from '../../../data/list/data-list-item.component'; - -/** - * TODO - */ -@Component({ - selector: 'stapps-hebis-article-item', - templateUrl: 'hebis-article-item.html', -}) -export class HebisArticleListItemComponent extends DataListItemComponent { - /** - * TODO - */ - @Input() item: SCArticle; -} diff --git a/src/app/modules/hebis/types/hebis-article/hebis-article-item.html b/src/app/modules/hebis/types/hebis-article/hebis-article-item.html deleted file mode 100644 index 180d8694..00000000 --- a/src/app/modules/hebis/types/hebis-article/hebis-article-item.html +++ /dev/null @@ -1,16 +0,0 @@ - - - -

{{ 'name' | thingTranslate: item }}

-

- -

- - {{ 'type' | thingTranslate: item }} - -
-
-
diff --git a/src/app/modules/hebis/types/periodical/periodical-list-item.html b/src/app/modules/hebis/types/periodical/periodical-list-item.html deleted file mode 100644 index 180d8694..00000000 --- a/src/app/modules/hebis/types/periodical/periodical-list-item.html +++ /dev/null @@ -1,16 +0,0 @@ - - - -

{{ 'name' | thingTranslate: item }}

-

- -

- - {{ 'type' | thingTranslate: item }} - -
-
-