Skip to content

Commit

Permalink
117287: Simplified the if conditions on the edit/save/discard buttons…
Browse files Browse the repository at this point in the history
… on item versions
  • Loading branch information
alexandrevryghem committed Aug 14, 2024
1 parent 9c29099 commit 04bbaf9
Showing 1 changed file with 13 additions and 17 deletions.
30 changes: 13 additions & 17 deletions src/app/item-page/versions/item-versions.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,35 +49,31 @@ <h2 *ngIf="displayTitle" class="h4">{{"item.version.history.head" | translate}}<
</ng-template>
</div>

<div class="float-right btn-group edit-field space-children-mr" *ngIf="displayActions">
<!--DISCARD EDIT -->
<ng-container *ngIf="versionDTO.canEditVersion && isThisBeingEdited(versionDTO.version)">
<button class="btn btn-sm"
[ngClass]="isThisBeingEdited(versionDTO.version) ? 'btn-outline-warning' : 'btn-outline-primary'"
<div class="float-right btn-group edit-field space-children-mr" *ngIf="displayActions && versionDTO.canEditVersion | async">
<ng-container *ngIf="isThisBeingEdited(versionDTO.version); else notThisBeingEdited">
<!--DISCARD EDIT-->
<button class="btn btn-sm btn-outline-warning"
(click)="disableVersionEditing()"
title="{{'item.version.history.table.action.discardSummary' | translate}}">
<i class="fas fa-undo-alt fa-fw"></i>
</button>
<!--SAVE-->
<button class="btn btn-outline-success btn-sm"
(click)="onSummarySubmit()"
title="{{'item.version.history.table.action.saveSummary' | translate}}">
<i class="fas fa-check fa-fw"></i>
</button>
</ng-container>
<!--EDIT / SAVE-->
<ng-container *ngIf="versionDTO.canEditVersion">
<ng-template #notThisBeingEdited>
<!--EDIT-->
<button class="btn btn-outline-primary btn-sm version-row-element-edit"
*ngIf="!isThisBeingEdited(versionDTO.version)"
[disabled]="isAnyBeingEdited()"
(click)="enableVersionEditing(versionDTO.version)"
title="{{'item.version.history.table.action.editSummary' | translate}}">
<i class="fas fa-edit fa-fw"></i>
</button>
<button class="btn btn-outline-success btn-sm"
*ngIf="isThisBeingEdited(versionDTO.version)"
(click)="onSummarySubmit()"
title="{{'item.version.history.table.action.saveSummary' | translate}}">
<i class="fas fa-check fa-fw"></i>
</button>
</ng-container>
</ng-template>
</div>


</td>
</tr>
</tbody>
Expand Down

0 comments on commit 04bbaf9

Please sign in to comment.