Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:netwerk-digitaal-erfgoed/solid-c…
Browse files Browse the repository at this point in the history
…bs into develop
  • Loading branch information
lem-onade committed Nov 9, 2021
2 parents 22c2fd0 + 47dd504 commit c2373d4
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import { map } from 'rxjs/operators';
import { from } from 'rxjs';
import { Interpreter, State } from 'xstate';
import { RxLitElement } from 'rx-lit';
import { Connect, Dots, Identity, Image, Object as ObjectIcon, Download, Theme, Cross, Open } from '@netwerk-digitaal-erfgoed/solid-crs-theme';
import { Connect, Dots, Identity, Image, Object as ObjectIcon, Theme, Cross, Open } from '@netwerk-digitaal-erfgoed/solid-crs-theme';
import { unsafeSVG } from 'lit-html/directives/unsafe-svg';
import { fetch as solidFetch } from '@netwerk-digitaal-erfgoed/solid-crs-client';
import { AddAlertEvent, DismissAlertEvent } from '../../app.events';
import { SelectedCollectionEvent } from '../collection/collection.events';
import { ObjectContext } from './object.machine';
Expand Down Expand Up @@ -132,9 +133,28 @@ export class ObjectRootComponent extends RxLitElement {
const alerts = this.alerts?.map((alert) => html`<nde-alert .logger='${this.logger}' .translator='${this.translator}' .alert='${alert}' @dismiss="${this.handleDismiss}"></nde-alert>`);
const collection = this.collections?.find((coll) => coll.uri === this.object?.collection);

const toggleImage = () => { this.imagePopup.toggle(); };
const toggleImage = () => { this.imagePopup.toggle(); };

const toggleInfo = () => { this.infoPopup.toggle(); };
const toggleInfo = () => { this.infoPopup.toggle(); };

const downloadRDF = () => {

solidFetch(this.object?.uri)
.then((response) => response.blob())
.then((blob) => {

const blobURL = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = blobURL;
const slashSplit = this.object?.uri.split('/');
a.download = `${slashSplit[slashSplit.length - 1]}.ttl`;
(a as any).style = 'display: none';
document.body.appendChild(a);
a.click();

});

};

return this.object ? html`
Expand All @@ -151,7 +171,7 @@ export class ObjectRootComponent extends RxLitElement {
${ unsafeSVG(Dots) }
<nde-popup id="info-popup">
<div slot="content">
<a target="_blank" rel="noopener noreferrer" href="${this.object.uri}">
<a @click="${downloadRDF}">
${this.translator.translate('object.root.menu.view-rdf')}
</a>
</div>
Expand Down
6 changes: 3 additions & 3 deletions packages/solid-crs-presentation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@
],
"coverageThreshold": {
"global": {
"statements": 87.06,
"statements": 85.95,
"branches": 83.59,
"lines": 88.2,
"functions": 71.72
"lines": 86.98,
"functions": 72.14
}
},
"automock": false,
Expand Down

0 comments on commit c2373d4

Please sign in to comment.