Skip to content

Commit 1348c1d

Browse files
pcg-kkqubiack
authored andcommitted
fix: changes after code review
1 parent 88345f5 commit 1348c1d

File tree

5 files changed

+26
-10
lines changed

5 files changed

+26
-10
lines changed

src/app/collection-page/collection-page.component.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@
2323
</ds-comcol-page-handle>
2424
<!-- Introductory text -->
2525
<ds-comcol-page-content
26-
[content]="collection.introductoryText(translateService.currentLang)"
26+
[content]="collection.introductoryText(currentLanguage)"
2727
[hasInnerHtml]="true">
2828
</ds-comcol-page-content>
2929
<!-- News -->
3030
<ds-comcol-page-content
31-
[content]="collection.sidebarText(translateService.currentLang)"
31+
[content]="collection.sidebarText(currentLanguage)"
3232
[hasInnerHtml]="true"
3333
[title]="'collection.page.news'">
3434
</ds-comcol-page-content>
@@ -44,10 +44,10 @@
4444

4545
<router-outlet></router-outlet>
4646
</section>
47-
<footer *ngIf="collection.copyrightText" class="border-top my-5 pt-4">
47+
<footer *ngIf="collection.copyrightText(currentLanguage) as copyrightText" class="border-top my-5 pt-4">
4848
<!-- Copyright -->
4949
<ds-comcol-page-content
50-
[content]="collection.copyrightText"
50+
[content]="copyrightText"
5151
[hasInnerHtml]="true">
5252
</ds-comcol-page-content>
5353
</footer>

src/app/collection-page/collection-page.component.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ import { PaginationComponentOptions } from '../shared/pagination/pagination-comp
5555
import { VarDirective } from '../shared/utils/var.directive';
5656
import { ViewTrackerComponent } from '../statistics/angulartics/dspace/view-tracker.component';
5757
import { getCollectionPageRoute } from './collection-page-routing-paths';
58+
import { environment } from '../../environments/environment';
5859

5960
@Component({
6061
selector: 'ds-base-collection-page',
@@ -100,6 +101,11 @@ export class CollectionPageComponent implements OnInit {
100101
*/
101102
collectionPageRoute$: Observable<string>;
102103

104+
/**
105+
* The current language of the page
106+
*/
107+
currentLanguage: string = environment.defaultLanguage;
108+
103109
constructor(
104110
protected route: ActivatedRoute,
105111
protected router: Router,
@@ -111,6 +117,8 @@ export class CollectionPageComponent implements OnInit {
111117
}
112118

113119
ngOnInit(): void {
120+
this.currentLanguage = this.translateService.currentLang;
121+
114122
this.collectionRD$ = this.route.data.pipe(
115123
map((data) => data.dso as RemoteData<Collection>),
116124
redirectOn4xx(this.router, this.authService),

src/app/community-page/community-page.component.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
<ds-comcol-page-handle [content]="communityPayload.handle" [title]="'community.page.handle'">
1414
</ds-comcol-page-handle>
1515
<!-- Introductory text -->
16-
<ds-comcol-page-content [content]="communityPayload.introductoryText(translateService.currentLang)" [hasInnerHtml]="true">
16+
<ds-comcol-page-content [content]="communityPayload.introductoryText(currentLanguage)" [hasInnerHtml]="true">
1717
</ds-comcol-page-content>
1818
<!-- News -->
19-
<ds-comcol-page-content [content]="communityPayload.sidebarText(translateService.currentLang)" [hasInnerHtml]="true"
19+
<ds-comcol-page-content [content]="communityPayload.sidebarText(currentLanguage)" [hasInnerHtml]="true"
2020
[title]="'community.page.news'">
2121
</ds-comcol-page-content>
2222
</header>
@@ -30,9 +30,9 @@
3030

3131
<router-outlet></router-outlet>
3232
</section>
33-
<footer *ngIf="communityPayload.copyrightText" class="border-top my-5 pt-4">
33+
<footer *ngIf="communityPayload.copyrightText(currentLanguage) as copyrightText" class="border-top my-5 pt-4">
3434
<!-- Copyright -->
35-
<ds-comcol-page-content [content]="communityPayload.copyrightText(translateService.currentLang)" [hasInnerHtml]="true">
35+
<ds-comcol-page-content [content]="copyrightText" [hasInnerHtml]="true">
3636
</ds-comcol-page-content>
3737
</footer>
3838
</div>

src/app/community-page/community-page.component.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ import { ViewTrackerComponent } from '../statistics/angulartics/dspace/view-trac
4848
import { getCommunityPageRoute } from './community-page-routing-paths';
4949
import { ThemedCollectionPageSubCollectionListComponent } from './sections/sub-com-col-section/sub-collection-list/themed-community-page-sub-collection-list.component';
5050
import { ThemedCommunityPageSubCommunityListComponent } from './sections/sub-com-col-section/sub-community-list/themed-community-page-sub-community-list.component';
51+
import { environment } from '../../environments/environment';
5152

5253
@Component({
5354
selector: 'ds-base-community-page',
@@ -95,6 +96,11 @@ export class CommunityPageComponent implements OnInit {
9596
*/
9697
logoRD$: Observable<RemoteData<Bitstream>>;
9798

99+
/**
100+
* The current language of the page
101+
*/
102+
currentLanguage: string = environment.defaultLanguage;
103+
98104
/**
99105
* Route to the community page
100106
*/
@@ -112,6 +118,8 @@ export class CommunityPageComponent implements OnInit {
112118
}
113119

114120
ngOnInit(): void {
121+
this.currentLanguage = this.translateService.currentLang;
122+
115123
this.communityRD$ = this.route.data.pipe(
116124
map((data) => data.dso as RemoteData<Community>),
117125
redirectOn4xx(this.router, this.authService),

src/app/shared/comcol/comcol-forms/comcol-form/comcol-form.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ export class ComColFormComponent<T extends Collection | Community> implements On
292292

293293
const key = `/metadata/${fieldModel.name}`;
294294

295-
const keyExistAndAtLeastOneValueIsNotNull: boolean = (fieldModel.value !== null || this.dso.firstMetadataValue(fieldModel.name, { language }) !== null);
295+
const keyExistAndAtLeastOneValueIsNotNull: boolean = (hasValue(fieldModel.value) || hasValue(this.dso.firstMetadataValue(fieldModel.name, { language })));
296296

297297
if ( keyExistAndAtLeastOneValueIsNotNull) {
298298
if (operations.has(key)) {
@@ -354,7 +354,7 @@ export class ComColFormComponent<T extends Collection | Community> implements On
354354
this.defaultLanguageCode = environment.defaultLanguage;
355355
this.defaultLanguage = environment.languages.find(lang => lang.code === this.defaultLanguageCode).label;
356356

357-
this.languages = environment.languages.filter(lang => lang.code !== this.defaultLanguageCode);
357+
this.languages = environment.languages.filter(lang => lang.code !== this.defaultLanguageCode && (lang.active === true));
358358
this.currentLanguageCode = this.languages.length > 0 ? this.languages[0].code : null;
359359
}
360360

0 commit comments

Comments
 (0)