Skip to content

Commit

Permalink
Pridani informace o neverejnem dnnt dokumentu do panelu s metadaty s …
Browse files Browse the repository at this point in the history
…proklikem do dialogu s vysvetlujicim textem
  • Loading branch information
honza-rychtar committed Feb 12, 2020
1 parent 6953f45 commit f59d847
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 7 deletions.
8 changes: 6 additions & 2 deletions src/app/dialog/dialog-policy/dialog-policy.component.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
<mz-modal #modal [fixedFooter]="false" class="app-dialog-policy">
<mz-modal-content>
<mz-input-container>
<mz-input-container *ngIf="type=='private'">
<div *ngIf="!appSettings.customRightMessage" class="app-text">
{{ 'alert.inaccessible_document_description' | translate }}
</div>
<div *ngIf="appSettings.customRightMessage" class="app-html"
[innerHTML]="(krameriusInfo.data$ | async).rightMsg">
</div>
</mz-input-container>

<mz-input-container *ngIf="type=='dnnt'">
<div class="app-text">
{{ 'alert.inaccessible_document_dnnt_description' | translate }}
</div>
</mz-input-container>
</mz-modal-content>
<mz-modal-footer>
<button mz-button [flat]="true" mz-modal-close>{{ 'common.close' | translate }}</button>
Expand Down
10 changes: 8 additions & 2 deletions src/app/metadata/metadata.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,14 @@ <h5 [class.app-cut]="metadata.getTitle().length > 75 && showingTitle == false">
</ng-container>

<div *ngIf="!metadata.isPublic" class="app-policy">
<i mz-icon-mdi [icon]="'lock'" [size]="'18px'" [class]="'app-lock'"></i>
<span class="app-message">{{ 'metadata.policy_private' | translate }} (<span><i (click)="showPolicyPrivateDialog()" mz-icon-mdi [icon]="'help'" class="app-help" [size]="'15px'"></i></span>)</span>
<ng-container *ngIf="metadata.isDnnt">
<i mz-icon-mdi [icon]="'lock'" [size]="'18px'" [class]="'app-lock app-dnnt'"></i>
<span class="app-message">{{ 'metadata.policy_dnnt' | translate }} (<span><i (click)="showPolicyDnntDialog()" mz-icon-mdi [icon]="'help'" class="app-help" [size]="'15px'"></i></span>)</span>
</ng-container>
<ng-container *ngIf="!metadata.isDnnt">
<i mz-icon-mdi [icon]="'lock'" [size]="'18px'" [class]="'app-lock'"></i>
<span class="app-message">{{ 'metadata.policy_private' | translate }} (<span><i (click)="showPolicyPrivateDialog()" mz-icon-mdi [icon]="'help'" class="app-help" [size]="'15px'"></i></span>)</span>
</ng-container>
<div class="divider"></div>
</div>

Expand Down
4 changes: 4 additions & 0 deletions src/app/metadata/metadata.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ export class MetadataComponent implements OnInit {
this.modalService.open(DialogPolicyComponent, { type: 'private' } );
}

showPolicyDnntDialog() {
this.modalService.open(DialogPolicyComponent, { type: 'dnnt' } );
}

showCitation() {
this.analytics.sendEvent('metadata', 'citation');
this.modalService.open(DialogCitationComponent, { metadata: this.metadata });
Expand Down
4 changes: 4 additions & 0 deletions src/app/model/metadata.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export class Metadata {
public volume: Volume;

public isPublic = true;
public isDnnt = false;

public currentIssue: PeriodicalItem;
public nextIssue: PeriodicalItem;
Expand Down Expand Up @@ -63,9 +64,12 @@ export class Metadata {

public assignDocument(item: DocumentItem) {
this.isPublic = item.public;
this.isDnnt = item.dnnt;
this.model = item.doctype;
this.donator = item.donator;
this.originUrl = item.originUrl;
console.log('assignDocument item', item);
console.log('assignDocument data', this);
}

public getOriginUrl() {
Expand Down
4 changes: 1 addition & 3 deletions src/app/services/book.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,7 @@ export class BookService {
this.isPrivate = !item.public;
this.api.getMods(item.root_uuid).subscribe(response => {
this.metadata = this.modsParserService.parse(response, item.root_uuid);
this.metadata.isPublic = item.public;
this.metadata.model = item.doctype;
this.metadata.donator = item.donator;
this.metadata.assignDocument(item);
this.analytics.sendEvent('viewer', 'open', this.metadata.getShortTitle());
this.pageTitle.setTitle(null, this.metadata.getShortTitle());
if (item.doctype) {
Expand Down
1 change: 1 addition & 0 deletions src/app/services/utils.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export class Utils {
item.root_uuid = json['root_pid'];
item.public = json['policy'] === 'public';
item.doctype = json['model'];
item.dnnt = json['dnnt'];
item.date = json['datumstr'];
item.authors = json['author'];
if (json['replicatedFrom'] && json['replicatedFrom'].length > 0) {
Expand Down

0 comments on commit f59d847

Please sign in to comment.