/
properties.component.html
208 lines (197 loc) · 10.9 KB
/
properties.component.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
<!-- toolbar -->
<div class="toolbar" *ngIf="project" [class.deleted]="deletedResource || resource.res.isDeleted">
<!-- resource info -->
<h3 class="label mat-title">
{{resource.res.label}} <span *ngIf="deletedResource">(deleted)</span>
</h3>
<span class="fill-remaining-space"></span>
<!-- tools: share, add to favorites, edit, delete etc. -->
<span class="action">
<!-- Toggle list of properties: all or only the ones with value -->
<button mat-icon-button class="toggle-props" *ngIf="!resource.res.isDeleted"
[matTooltip]="(showAllProps ? 'Hide empty' : 'Show all')+' properties'" matTooltipPosition="above"
(click)="toggleAllProps(showAllProps)">
<mat-icon>{{showAllProps ? 'unfold_less' : 'unfold_more'}}</mat-icon>
<!-- <span class="desktop-only">{{showAllProps ? 'Hide empty' : 'Show all'}} properties</span> -->
</button>
<!-- Share resource: copy ark url, add to favorites or open in new tab -->
<button mat-icon-button class="share-res" matTooltip="Share resource: {{resource.res.versionArkUrl}}"
matTooltipPosition="above" [disabled]="deletedResource" [matMenuTriggerFor]="share">
<mat-icon>share</mat-icon>
<!-- <span class="desktop-only">Citation Link</span> -->
</button>
<mat-menu #share="matMenu" class="res-share-menu">
<button mat-menu-item matTooltip="Copy ARK url" matTooltipPosition="above"
[cdkCopyToClipboard]="resource.res.versionArkUrl"
(click)="openSnackBar('ARK URL copied to clipboard!')">
<mat-icon>content_copy</mat-icon>
Copy ARK url to clipboard
</button>
<button mat-menu-item matTooltip="Copy internal link" matTooltipPosition="above"
[cdkCopyToClipboard]="resource.res.id" (click)="openSnackBar('Internal link copied to clipboard!')">
<mat-icon>content_copy</mat-icon>
Copy internal link to clipboard
</button>
<button mat-menu-item matTooltip="Open in new tab" matTooltipPosition="above"
(click)="openResource(resource.res.id)">
<mat-icon>open_in_new</mat-icon>
Open resource in new tab
</button>
<!-- TODO: activate favorite action to add resource to collection -->
<!--
<button mat-button class="add-res-to-collection">
<mat-icon>star_border</mat-icon>
</button>
-->
</mat-menu>
<!-- permission info: display full info in case of system or project admin; otherwise display only user's permissions -->
<app-permission-info *ngIf="adminPermissions" [hasPermissions]="resource.res.hasPermissions" [userHasPermission]="resource.res.userHasPermission"></app-permission-info>
<app-permission-info *ngIf="!adminPermissions" [userHasPermission]="resource.res.userHasPermission"></app-permission-info>
<!-- more menu with: delete, erase resource -->
<button *ngIf="editPermissions && project?.status" mat-icon-button class="more-menu" matTooltip="More"
matTooltipPosition="above" [matMenuTriggerFor]="more" [disabled]="deletedResource">
<mat-icon>more_vert</mat-icon>
</button>
<mat-menu #more="matMenu" class="res-more-menu">
<button mat-menu-item matTooltip="Edit the label of this resource" matTooltipPosition="above"
(click)="openDialog('edit')">
<mat-icon>edit</mat-icon>
Edit label
</button>
<button *ngIf="deleteButtonIsVisible" mat-menu-item matTooltip="Move resource to trash bin." matTooltipPosition="above"
(click)="openDialog('delete')">
<mat-icon>delete</mat-icon>
Delete resource
<!-- TODO: or in case of already deleted resource: re-activate resource -->
</button>
<button *ngIf="adminPermissions" mat-menu-item matTooltip="Erase resource forever. This cannot be undone."
matTooltipPosition="above" (click)="openDialog('erase')">
<mat-icon>delete_forever</mat-icon>
Erase resource
</button>
</mat-menu>
</span>
</div>
<!-- additional line with project and user information -->
<div class="infobar mat-caption" *ngIf="project && user">
<span *ngIf="displayProjectInfo">This resource {{ resource.res.isDeleted ? 'belonged' : 'belongs' }} to the project
<span class="project link" (click)="openProject(project)" (mouseover)="previewProject(project)">
<strong>{{project?.shortname}}</strong>
<mat-icon inline>open_in_new</mat-icon>
</span>
</span>
<span class="fill-remaining-space desktop-only"></span>
<span *ngIf="user || resource.res.creationDate">
Created
<span *ngIf="user">by {{(user.username ? user.username : user.givenName + ' ' + user.familyName)}}</span>
<span *ngIf="resource.res.creationDate"> on {{resource.res.creationDate | date}}</span>
</span>
</div>
<!-- list of properties -->
<div class="properties-container">
<div class="properties" *ngIf="resource.resProps.length > 0; else noProperties">
<!-- list of properties -->
<div *ngFor="let prop of resource.resProps; let last = last">
<!-- show property; all in case of showAll === true or only the ones with prop.values -->
<div *ngIf="(showAllProps || ( prop.values && prop.values.length > 0 )) && (
!prop.propDef['isLinkProperty'] &&
prop.propDef.objectType !== representationConstants.stillImage &&
prop.propDef.objectType !== representationConstants.movingImage &&
prop.propDef.objectType !== representationConstants.audio &&
prop.propDef.objectType !== representationConstants.document &&
prop.propDef.objectType !== representationConstants.text &&
prop.propDef.objectType !== representationConstants.archive &&
!(isAnnotation && (
prop.propDef.subjectType === representationConstants.region &&
prop.propDef.objectType !== representationConstants.color
))
)" [class.border-bottom]="prop.values && !last" class="property">
<div class="property-label">
<!-- label of the property -->
<h3 class="label mat-subheading-1" [class.label-info]="prop.propDef.comment"
[matTooltip]="prop.propDef.comment" matTooltipPosition="above">
{{prop.propDef.label}}
</h3>
</div>
<div class="property-value">
<!-- the value(s) of the property -->
<div *ngFor="let val of prop.values">
<app-display-edit *ngIf="val" #displayEdit [parentResource]="resource.res" [displayValue]="val"
[propArray]="resource.resProps" [canDelete]="deleteValueIsAllowed(prop)"
[projectStatus]="project?.status" [valueUuidToHighlight]="valueUuidToHighlight"
(referredResourceClicked)="openResource($event)"
(referredResourceHovered)="previewResource($event)">
</app-display-edit>
</div>
<!-- Add value form -->
<div *ngIf="addValueFormIsVisible && propID === prop.propDef.id && project?.status">
<app-add-value #addValue class="add-value" [parentResource]="resource.res"
[resourcePropertyDefinition]="$any(resource.res.entityInfo.properties[prop.propDef.id])"
(operationCancelled)="hideAddValueForm()">
</app-add-value>
</div>
<!-- Add button -->
<div *ngIf="addValueIsAllowed(prop) && project?.status">
<button mat-icon-button type="button" class="value-action create"
(click)="showAddValueForm(prop, $event)" title="Add a new value">
<mat-icon>add_box</mat-icon>
</button>
</div>
<!-- in case of incoming links we have to display them here -->
<div *ngIf="prop.propDef.id === hasIncomingLinkIri && incomingLinkResources.length > 0">
<app-progress-indicator *ngIf="loading"></app-progress-indicator>
<div *ngIf="!loading">
<!-- the value(s) of the incoming links -->
<a class="link link-value" *ngFor="let inRes of incomingLinkResources"
(click)="openResource(inRes.id)">{{inRes.resourceClassLabel}}: <strong>{{inRes.label}}</strong></a>
<mat-paginator *ngIf="numberOffAllIncomingLinkRes > 25" [length]=numberOffAllIncomingLinkRes
[pageSize]="25" [hidePageSize]="true" [pageIndex]="pageEvent.pageIndex"
(page)="goToPage($event)">
</mat-paginator>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- deleted resource or resource without any defined properties -->
<ng-template #noProperties>
<div *ngIf="resource.res.isDeleted" class="properties">
<div class="property border-bottom">
<div class="property-label">
<!-- delete date -->
<h3 class="label mat-subheading-1">
Deleted on
</h3>
</div>
<div class="property-value">
{{ resource.res.deleteDate | date }}
</div>
</div>
<div class="property">
<div class="property-label">
<!-- Delete comment -->
<h3 class="label mat-subheading-1">
Comment
</h3>
</div>
<div class="property-value">
{{ resource.res.deleteComment }}
</div>
</div>
</div>
<!-- no defined property -->
<div *ngIf="!resource.res.isDeleted" class="properties">
<div class="property border-bottom">
<div class="property-label">
<h3 class="label mat-subheading-1">
Info
</h3>
</div>
<div class="property-value">
This resource has no defined properties.
</div>
</div>
</div>
</ng-template>
</div>