Skip to content

Commit

Permalink
Merge pull request #464 from UUDigitalHumanitieslab/feature/getRaw
Browse files Browse the repository at this point in the history
Node.prototype.getRaw
  • Loading branch information
jgonggrijp authored Apr 20, 2021
2 parents e2bbfda + 0df65c4 commit 0db1cba
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
7 changes: 7 additions & 0 deletions frontend/src/common-rdf/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,13 @@ export default class Node extends Model {
return value;
}

/**
* Sometimes, we still want the original, less-intelligent .get behavior.
*/
getRaw(key: string): OptimizedNative {
return super.get(key);
}

/**
* Adapt the has method to JSON-LD array semantics.
*/
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/panel-source-list/source-summary-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default class SourceSummaryView extends View {
this.fields = options.fields;
this.name = this.model.get(schema('name'))[0];
this.author = this.model.get(schema.author)[0];
this.identifier = this.model.attributes['@id'];
this.identifier = this.model.id;
if (this.query !== undefined) {
this.renderHighlights();
}
Expand Down
7 changes: 3 additions & 4 deletions frontend/src/panel-source/source-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class SourcePanel extends CompositeView {
super(options);
this.validate();
this.toolbarModel = new Model({
metadata: false,
metadata: false,
annotations: options.showHighlightsInitially || false
});
this.toolbar = new SourceToolbarView({ model: this.toolbarModel }).render();
Expand Down Expand Up @@ -117,10 +117,9 @@ class SourcePanel extends CompositeView {
// Traversing the JSON serialization, instead of a regular
// `model.get`, because the URI dereferences to plain text instead
// of a RDF-formatted resource and this would trip up the
// `Store.obtain()` call. TODO: replace this with a nicer API,
// perhaps `model.getRaw()`.
// `Store.obtain()` call.
$.get(
this.model.toJSON()[vocab('fullText')][0]['@id'] as string
this.model.getRaw(vocab('fullText'))[0]['@id'] as string
).then(this._createHtv.bind(this));
}
return this;
Expand Down

0 comments on commit 0db1cba

Please sign in to comment.