Skip to content
This repository was archived by the owner on Aug 5, 2021. It is now read-only.

Commit b4c97dd

Browse files
Merge pull request #598 from GSA/594
594
2 parents bf3741d + 71df62f commit b4c97dd

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

src/app/components/explore-code/repo/repo.component.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,10 @@ <h2>{{ repo.name }}</h2>
6767
<div *ngFor="let value of repo.additional_data[key]" [textContent]="value"></div>
6868
</div>
6969
<div class="metadata-value" *ngIf="!isArray(repo.additional_data[key])">
70-
<div [textContent]="repo.additional_data[key]"></div>
70+
<a *ngIf="isURL(repo.additional_data[key])" [href]="repo.additional_data[key]" target="_blank">
71+
<div [textContent]="repo.additional_data[key]"></div>
72+
</a>
73+
<div *ngIf="!isURL(repo.additional_data[key])" [textContent]="repo.additional_data[key]"></div>
7174
</div>
7275
</div>
7376
</div>

src/app/components/explore-code/repo/repo.component.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@
121121
}
122122

123123
.metadata-value {
124+
color: $color-gray;
124125
display: block;
125126

126127
@media screen and (min-width: $medium-screen) {

src/app/components/explore-code/repo/repo.component.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,17 @@ export class RepoComponent implements OnInit, OnDestroy {
6969
}
7070

7171
clean(input) {
72-
if (typeof input === "number") {
72+
if (typeof input === 'number') {
7373
return input.toString();
74-
} else if (typeof input === "string") {
75-
return input.replace(/[_-]/g, " ");
74+
} else if (typeof input === 'string') {
75+
return input.replace(/[_-]/g, ' ');
7676
} else {
7777
return JSON.stringify(input);
7878
}
7979
}
8080

81+
isURL(input) {
82+
return typeof input === 'string' && input.startsWith('http');
83+
}
84+
8185
}

0 commit comments

Comments
 (0)