Skip to content

Commit a0c3c8b

Browse files
authored
Feature/add paper ref (#115)
1 parent 404e0af commit a0c3c8b

File tree

5 files changed

+26
-2
lines changed

5 files changed

+26
-2
lines changed

src/app/core/component/edit-url-dialog/edit-url-dialog.component.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ <h1 mat-dialog-title>Edit Title or Icon for {{data.pattern.name}}</h1>
88
<mat-label>Adjust Icon URL</mat-label>
99
<input matInput placeholder={{data.pattern.iconUrl}} [(ngModel)]="data.icon">
1010
</mat-form-field>
11+
<mat-form-field>
12+
<mat-label>Adjust Paper Reference</mat-label>
13+
<input matInput placeholder={{data.pattern.patternRef}} [(ngModel)]="data.paperRef">
14+
</mat-form-field>
15+
1116
</div>
1217
<mat-dialog-actions align="end">
1318
<button mat-button (click)="onNoClick()">Cancel</button>

src/app/core/default-pattern-renderer/default-pattern-renderer.component.html

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
11
<mat-progress-spinner *ngIf="isLoading" mode="indeterminate"></mat-progress-spinner>
22
<mat-card class="pattern-card mat-elevation-z5">
33
<mat-card-header (mouseenter)="showActionButtons = true" (mouseleave)="showActionButtons = false">
4-
<pp-action-button-bar [displayText]="pattern?.name" [firstAddButton]="false" [iconEdit]="true"
4+
<pp-action-button-bar [displayText]="pattern?.name" [firstAddButton]="false"
5+
[iconEdit]="true"
56
[iconUrl]="pattern?.iconUrl" (iconEditClicked)="editIcon()">
67
</pp-action-button-bar>
78
<span> <button mat-stroked-button style="margin-left: 5px" color="primary" *ngIf="showActionButtons"
89
(click)="editIcon()" matTooltip="Edit"><i class="material-icons">mode_edit</i></button>
910
</span>
1011
</mat-card-header>
12+
13+
<span class="copyright" *ngIf="pattern?.paperRef"> <i class="material-icons">copyright</i>
14+
<!-- Display either a textual reference for yet unpublished papers or a html link -->
15+
{{pattern?.paperRef.startsWith('http') ?
16+
"The original publication of this pattern can be found in&nbsp;" :
17+
"This pattern is originally published in " + pattern?.paperRef}}
18+
<a *ngIf="pattern?.paperRef.startsWith('http')" href="{{pattern?.paperRef}}">here</a>
19+
</span>
1120
<div>
1221
<ng-template ppPatternProperty></ng-template>
1322
</div>

src/app/core/default-pattern-renderer/default-pattern-renderer.component.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,9 @@
1717
.mat-stroked-button {
1818
margin-top: 12px;
1919
}
20+
21+
.copyright {
22+
margin-left: 3em;
23+
display: flex;
24+
align-items: center;
25+
}

src/app/core/default-pattern-renderer/default-pattern-renderer.component.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,12 +242,15 @@ export class DefaultPatternRendererComponent implements AfterViewInit, OnDestroy
242242
editIcon() {
243243
const dialogRef = this.dialog.open(EditUrlDialogComponent, {
244244
width: '50%',
245-
data: { pattern: this.pattern, icon: this.pattern.iconUrl, name: this.pattern.name }
245+
data: {
246+
pattern: this.pattern, icon: this.pattern.iconUrl, name: this.pattern.name, paperRef: this.pattern.paperRef
247+
}
246248
});
247249
dialogRef.afterClosed().subscribe(result => {
248250
if (result !== undefined) {
249251
this.pattern.iconUrl = result.icon;
250252
this.pattern.name = result.name;
253+
this.pattern.paperRef = result.paperRef;
251254
this.patternService.updatePattern(this.pattern._links.self.href, this.pattern).subscribe();
252255
}
253256
});

src/app/core/model/hal/pattern.model.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { HalLink } from './hal-link.interface';
1717

1818
class Pattern extends UriEntity {
1919
iconUrl?: string;
20+
paperRef?: string;
2021
content: any;
2122
renderedContent: any;
2223
patternLanguageId: string;

0 commit comments

Comments
 (0)