Skip to content

Commit

Permalink
Update Visibility Settings
Browse files Browse the repository at this point in the history
First changes from Kompakkt#40
  • Loading branch information
vmalieske committed Aug 1, 2024
1 parent dfe7f92 commit 94bc835
Show file tree
Hide file tree
Showing 7 changed files with 149 additions and 128 deletions.
222 changes: 113 additions & 109 deletions src/app/components/actionbar/actionbar.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,133 +88,137 @@
<div id="quick-actions">
<!-- TODO: Simplify conditionals -->

<!-- Publishing option -->
@if ((isAuthenticated$ | async) && allowEditing && isEntity(element)) {
<div>
@if (!isPublished) {
<button
<div id="button-actions">
<!-- Publishing option -->
@if ((isAuthenticated$ | async) && allowEditing && isEntity(element)) {
<div>
@if (!isPublished) {
<button
mat-flat-button
color="primary"
matTooltip="{{ 'This object is currently hidden from the public. Click to publish!' | translate }}"
(click)="togglePublished()"
>
<mat-icon>publish</mat-icon>
{{ 'Publish!' | translate }}
</button>
}
@if (isPublished && isEntity(element)) {
<button
mat-flat-button
color="primary"
matTooltip="{{ 'This object is currently open to the public. Click to unpublish!' | translate }}"
(click)="togglePublished()"
>
<mat-icon>flip_to_back</mat-icon>
{{ 'Unpublish' | translate }}
</button>
}
</div>
}

<!-- Switch to annotation mode -->
@if (showAnnotateButton) {
<div
[matTooltip]="(allowAnnotating ? '' : 'To be able to annotate, add this object to one of your collections.') | translate"
>
<button
mat-flat-button
color="primary"
matTooltip="{{ 'This object is currently hidden from the public. Click to publish!' | translate }}"
(click)="togglePublished()"
[disabled]="!allowAnnotating || !element" [routerLink]="annotateLink"
>
<mat-icon>publish</mat-icon>
{{ 'Publish!' | translate }}
<mat-icon>location_on</mat-icon>
{{ 'Annotate' | translate }}
</button>
}
@if (isPublished && isEntity(element)) {
</div>
}
</div>

<div id="modify-action">
<!-- Explore Collections with Object -->
@if (element && showUsesInCollection) {
<div
[matTooltip]="
(selectHistory.usedInCompilations.compilations.length === 0
? 'This object is not used in any collection.'
: 'Explore collections containing this object.') | translate
"
>
<button
mat-flat-button
color="primary"
matTooltip="{{ 'This object is currently open to the public. Click to unpublish!' | translate }}"
(click)="togglePublished()"
[disabled]="selectHistory.usedInCompilations.compilations.length === 0"
mat-icon-button
[matMenuTriggerFor]="usedInCompilationsMenu"
>
<mat-icon>flip_to_back</mat-icon>
{{ 'Unpublish' | translate }}
<mat-icon>playlist_add_check</mat-icon>
</button>
}
</div>
}
</div>
}

<!-- Switch to annotation mode -->
@if (showAnnotateButton) {
<div
[matTooltip]="(allowAnnotating ? '' : 'You are not allowed to annotate right now.') | translate"
>
<button
mat-flat-button
color="primary"
[disabled]="!allowAnnotating || !element" [routerLink]="annotateLink"
<!-- Edit Entity settings -->
@if (showEditButton && isEntity(element) && allowEditing) {
<div
matTooltip="{{ 'Adjust the viewer settings, metadata or visibility of this object.' | translate }}"
>
<mat-icon>location_on</mat-icon>
{{ 'Annotate' | translate }}
</button>
</div>
}
<button mat-icon-button [matMenuTriggerFor]="editMenu">
<mat-icon>edit</mat-icon>
</button>
</div>
}
<!-- Edit collection -->
@if (showEditButton && isCompilation(element) && allowEditing) {
<div
matTooltip="{{ 'Edit this collection.' | translate }}"
>
<button mat-icon-button (click)="editCompilation()">
<mat-icon>edit</mat-icon>
</button>
</div>
}
<!-- Edit permissions -->
@if (showEditButton && !allowEditing) {
<div
matTooltip="{{ 'Only the object owner is able to edit settings of this object.' | translate }}"
>
<button mat-icon-button disabled>
<mat-icon>edit</mat-icon>
</button>
</div>
}
<!-- Quick add entity to compilation -->
@if ((isAuthenticated$ | async) && isEntity(element)) {
<div
matTooltip="{{ 'Use this object in a collection' | translate }}"
>
<button mat-icon-button [matMenuTriggerFor]="quickAddToCollectionMenu">
<mat-icon>library_add</mat-icon>
</button>
</div>
}

<!-- Explore Collections with Object -->
@if (element && showUsesInCollection) {
<div
[matTooltip]="
(selectHistory.usedInCompilations.compilations.length === 0
? 'This object is not used in any collection.'
: 'Explore collections containing this object.') | translate
"
>
@if (element) {
<div class="button-row">
<button
[disabled]="selectHistory.usedInCompilations.compilations.length === 0"
mat-icon-button
[matMenuTriggerFor]="usedInCompilationsMenu"
mat-flat-button
matTooltip="{{ 'Embed This Object on Your Web Page' | translate }}"
(click)="copyEmbed()"
>
<mat-icon>playlist_add_check</mat-icon>
<mat-icon>perm_media</mat-icon>
</button>
</div>
}

<!-- Edit Entity settings -->
@if (showEditButton && isEntity(element) && allowEditing) {
<div
matTooltip="{{ 'Adjust the viewer settings, metadata or visibility of this object.' | translate }}"
<a
[href]="downloadJsonHref"
[download]="downloadFileName"
(click)="generateDownloadJsonUri()"
>
<button mat-icon-button [matMenuTriggerFor]="editMenu">
<mat-icon>edit</mat-icon>
<button mat-flat-button matTooltip="{{ 'Download Metadata' | translate }}">
<mat-icon>list_alt</mat-icon>
</button>
</div>
}
<!-- Edit collection -->
@if (showEditButton && isCompilation(element) && allowEditing) {
<div
matTooltip="{{ 'Edit this collection.' | translate }}"
>
<button mat-icon-button (click)="editCompilation()">
<mat-icon>edit</mat-icon>
</a>
<button mat-flat-button matTooltip="{{ 'Copy ID' | translate }}" (click)="copyId()">
<mat-icon>fingerprint</mat-icon>
</button>
</div>
}
<!-- Edit permissions -->
@if (showEditButton && !allowEditing) {
<div
matTooltip="{{ 'Only the object owner is able to edit settings of this object.' | translate }}"
>
<button mat-icon-button disabled>
<mat-icon>edit</mat-icon>
</button>
</div>
}
<!-- Quick add entity to compilation -->
@if ((isAuthenticated$ | async) && isEntity(element)) {
<div
matTooltip="{{ 'Use this object in a collection' | translate }}"
>
<button mat-icon-button [matMenuTriggerFor]="quickAddToCollectionMenu">
<mat-icon>library_add</mat-icon>
</button>
</div>
}

@if (element) {
<div class="button-row">
<button
mat-flat-button
matTooltip="{{ 'Embed This Object on Your Web Page' | translate }}"
(click)="copyEmbed()"
>
<mat-icon>perm_media</mat-icon>
</button>
<a
[href]="downloadJsonHref"
[download]="downloadFileName"
(click)="generateDownloadJsonUri()"
>
<button mat-flat-button matTooltip="{{ 'Download Metadata' | translate }}">
<mat-icon>list_alt</mat-icon>
</button>
</a>
<button mat-flat-button matTooltip="{{ 'Copy ID' | translate }}" (click)="copyId()">
<mat-icon>fingerprint</mat-icon>
</button>
}
</div>
}
</div>
</mat-toolbar>

Expand Down
30 changes: 23 additions & 7 deletions src/app/components/actionbar/actionbar.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
z-index: 998;
left: 0;

display: flex;
flex-direction: row;
justify-content: end;
// display: flex;
// flex-direction: row;
// justify-content: end;

padding-right: 24px;

Expand All @@ -41,9 +41,12 @@
}

> #quick-actions {
width: 100%;
display: flex;
align-items: center;
gap: 8px;
justify-content: space-between;
justify-items: space-between;
// gap: 8px;
}

.mat-mdc-icon-button {
Expand All @@ -58,9 +61,9 @@
text-align: center;
padding: 0;

.mat-icon {
//color: white;
}
// .mat-icon {
// //color: white;
// }
}

.mat-mdc-icon-button .mat-mdc-button-touch-target {
Expand Down Expand Up @@ -95,6 +98,10 @@
}
}

.button-actions {
left: 0;
}

.button-row .mat-icon {
padding-left: auto;
padding-right: auto;
Expand All @@ -114,3 +121,12 @@
margin-left: 0 !important;
}

#modify-action {
display: flex;
}

#button-actions {
display: flex;
gap: 8px;
}

3 changes: 1 addition & 2 deletions src/app/components/navigation/navbar/navbar.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ a {
height: 67px;
background-color: rgba(255, 255, 255, 1);
border-bottom: 3px solid #eee;
padding: 0;
padding-right: 24px;
padding: 0 24px;

mat-toolbar {
border-radius: 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ <h2>{{ 'Who is able to see my object?' | translate }}</h2>
}
@if (entity.finished) {
@if (!entity.online) {
<p>{{ 'Only you can see this object.' | translate }}</p>
<!-- <p>{{ 'Only you can see this object.' | translate }}</p> -->
<p [innerHTML]="'Only you can see this object.' | translate"></p>
}
@if (entity.online && !entity.whitelist.enabled) {
{{ 'Since whitelist is disabled and your object is online, everyone can see it' | translate }}
Expand All @@ -119,12 +120,12 @@ <h2>{{ 'Who is able to see my object?' | translate }}</h2>
}
}
<div class="entity-settings-dialog-buttons" class="row end">
<button mat-raised-button color="warn" [disabled]="isSubmitting" (click)="cancel()">
{{ 'Cancel' | translate }}
</button>
<button mat-raised-button color="primary" [disabled]="isSubmitting" (click)="submit()">
{{ 'Submit' | translate }}
</button>
<button mat-raised-button color="warn" [disabled]="isSubmitting" (click)="cancel()">
{{ 'Cancel' | translate }}
</button>
</div>
</div>
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.entity-settings-dialog-content {
max-width: 50rem;
// min-height: 75vh;
max-height: 90vh;
min-height: 45vh;
max-height: 95vh;
overflow-y: auto;

.entity-settings-dialog-tab-content {
Expand Down Expand Up @@ -47,6 +47,7 @@ mat-slide-toggle {
align-items: center;
&.end {
justify-content: flex-end;
margin-top: 10px;
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@
"Note: you can still remove from the whitelist": "Note: you can still remove from the whitelist",
"Who is able to see my object?": "Who is able to see my object?",
"Object creation has not been finished.": "Object creation has not been finished.",
"Only you can see this object.": "Only you can see this object.",
"Only you can see this object.": "Only <b>you</b> can see this object.",
"To finish this object, click on the edit button of the object and complete all necessary steps.": "To finish this object, click on the edit button of the object and complete all necessary steps.",
"Since whitelist is disabled and your object is online, everyone can see it": "Since whitelist is disabled and your object is online, everyone can see it",
"Since whitelist is enabled and your object is online, persons and groups configured above can see it.": "Since whitelist is enabled and your object is online, persons and groups configured above can see it.",
Expand Down Expand Up @@ -454,7 +454,7 @@
"Click to switch to ": "Click to switch to ",
"This object is not used in any collection.": "This object is not used in any collection.",
"Explore collections containing this object.": "Explore collections containing this object.",
"You are not allowed to annotate right now.": "You are not allowed to annotate right now.",
"To be able to annotate, add this object to one of your collections.": "To be able to annotate, add this object to one of your collections.",
"Show ": "Show ",
" preview": " preview",
"object": "object",
Expand Down
Loading

0 comments on commit 94bc835

Please sign in to comment.