Skip to content

Commit

Permalink
add the shortDescription in grid view on hover - see #243
Browse files Browse the repository at this point in the history
  • Loading branch information
lsteinmann committed Aug 8, 2024
1 parent 60e2ed9 commit 504782c
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Input, Component } from '@angular/core';
import { SafeResourceUrl } from '@angular/platform-browser';
import { FieldDocument, ProjectConfiguration } from 'idai-field-core';
import { FieldDocument, I18N, Labels, ProjectConfiguration } from 'idai-field-core';


@Component({
Expand All @@ -18,7 +18,8 @@ export class GridItemComponent {
@Input() subDocuments: Array<FieldDocument>;


constructor(private projectConfiguration: ProjectConfiguration) {}
constructor(private projectConfiguration: ProjectConfiguration,
private labels: Labels) {}


public getSubDocumentsLabel(): string {
Expand All @@ -33,4 +34,10 @@ export class GridItemComponent {

return this.projectConfiguration.getCategory(this.document.resource.category).scanCodes !== undefined;
}


public getLabelFromI18NString(i18nString: I18N.String|string): string {

return this.labels.getFromI18NString(i18nString);
}
}
3 changes: 3 additions & 0 deletions desktop/src/app/components/resources/grid-list/grid-item.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@
[imageUrls]="images"></grid-item-icon>
<div class="grid-resource-info">
{{document.resource.identifier}}
<span *ngIf="document.resource.shortDescription" class="grid-resource-shortdescription">
{{getLabelFromI18NString(document.resource.shortDescription)}}
</span>
</div>
12 changes: 11 additions & 1 deletion desktop/src/app/components/resources/grid-list/grid-item.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ grid-item {

.grid-resource-info {
position: absolute;
height: 25px;
min-height: 25px;
width: 192px;
line-height: 25px;
text-align: center;
Expand All @@ -39,6 +39,16 @@ grid-item {
}
}

.grid-resource-shortdescription {
display: none;
font-style: italic;
text-align: left;
overflow: hidden;
text-overflow: ellipsis;
overflow-wrap: break-word;
width: calc(100% - 1px);
}

.badge {
position: absolute;
top: 6px;
Expand Down
8 changes: 8 additions & 0 deletions desktop/src/app/components/resources/grid-list/grid.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ grid {

&:hover {
box-shadow: 1px 10px 30px 0 rgba(0, 0, 0, 0.3);

.grid-resource-info {
height: auto;
}

.grid-resource-shortdescription {
display: block;
}
}
}
}

0 comments on commit 504782c

Please sign in to comment.