Skip to content

Commit

Permalink
Merge pull request #596 from OnroerendErfgoed/feature/epic_502/528_in…
Browse files Browse the repository at this point in the history
…fer_concept_relations_admin

Feature/epic 502/528 infer concept relations admin
  • Loading branch information
cedrikv committed Aug 13, 2020
2 parents 4f88207 + f55d9d9 commit 5e94a48
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 3 deletions.
17 changes: 16 additions & 1 deletion atramhasis/static/admin/src/app/ui/managers/RelationManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ define([
this._subordinateGrid.set('collection', this._subordinateStore);
this._superordinatesCollStore = new TrackableMemory({ data: [] });
this._superordinatesCollGrid.set('collection', this._superordinatesCollStore);
this.inferConceptRelationsYesNode.checked = false;
this.inferConceptRelationsNoNode.checked = false;
},

setCollectionTypes: function() {
Expand All @@ -184,6 +186,7 @@ define([
this.superordinatesCollGridNode.style.display = 'block';
this.membersContainerNode.style.display = 'block';
this.membersGridNode.style.display = 'block';
this.inferConceptRelationsContainerNode.style.display = 'block';
},

setConceptTypes: function() {
Expand All @@ -201,6 +204,7 @@ define([
this.membersGridNode.style.display = 'none';
this.superordinatesCollContainerNode.style.display = 'none';
this.superordinatesCollGridNode.style.display = 'none';
this.inferConceptRelationsContainerNode.style.display = 'none';
},

_createGrid: function(options, node) {
Expand Down Expand Up @@ -282,6 +286,10 @@ define([
con.id = item.id;
return con;
}, this);
/* jshint -W106 */
relations.infer_concept_relations = this.inferConceptRelationsYesNode.checked ?
true : (this.inferConceptRelationsNoNode.checked ? false : undefined);
/* jshint +W106 */
}

/* jshint -W106 */
Expand Down Expand Up @@ -325,7 +333,14 @@ define([
this._subordinateGrid.set('collection', this._subordinateStore);
this._superordinatesCollStore = new this.trackableMemory({data: this.concept ? this.concept.superordinates : []});
this._superordinatesCollGrid.set('collection', this._superordinatesCollStore);

/* jshint -W106 */
if (concept.infer_concept_relations === true) {
this.inferConceptRelationsYesNode.checked = true;
}
else if (concept.infer_concept_relations === false) {
this.inferConceptRelationsNoNode.checked = true;
}
/* jshint +W106 */
if (this.concept.type === 'collection') {
this.setCollectionTypes();
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,13 @@
<div class="row large-12 columns"
data-dojo-attach-point="superordinatesCollGridNode">
</div>

<div class="row" data-dojo-attach-point="inferConceptRelationsContainerNode" style="margin-top: 10px">
<div class="placeholder-container radio-container">
<label style="width: 80%">Should member concepts of this collection be seen as narrower concept of a superordinate of the collection</label>
<input type="radio" name="inferConceptRelations" data-dojo-attach-point="inferConceptRelationsYesNode" /> Yes
<input type="radio" name="inferConceptRelations" data-dojo-attach-point="inferConceptRelationsNoNode" /> No
</div>
</div>

</div>
16 changes: 14 additions & 2 deletions atramhasis/static/admin/src/app/ui/widgets/ConceptDetail.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ define([

postCreate: function () {
this.inherited(arguments);
console.debug('ConceptDetail::postCreate');
console.debug('ConceptDetail::postCreate', this.concept);
domAttr.set(this.mergeButton, 'disabled', true);
},

Expand Down Expand Up @@ -91,7 +91,6 @@ define([
},

_setData: function(concept) {
console.log(concept);
// set view data
this.conceptTitleViewNode.innerHTML = '<strong>' + this.scheme + ' : ' + concept.label + '</strong>';
this.idViewNode.innerHTML = 'ID: ' + concept.id;
Expand Down Expand Up @@ -235,6 +234,19 @@ define([
domConstruct.create('dd', {innerHTML: superString}, dt);
}

// infer_concept_relations
if (concept.type === 'collection') {
var dt = domConstruct.create('dt', {
innerHTML: 'Inheritance <i class="fa fa-info-circle">',
title: 'Should member concepts of this collection be seen as narrower concept of a superordinate ' +
'of the collection'
}, this.relationsListNode, 'last');
var cssClass = concept.infer_concept_relations === true ? 'fa-check' : 'fa-times';
var htmlTitle = concept.infer_concept_relations === true ? 'yes' : 'no';
var superString = '<i class="fa ' + cssClass + '" title="' + htmlTitle + '">';
domConstruct.create('dd', {innerHTML: superString}, dt);
}

// MATCHES
if (concept.matches) {
var matches = concept.matches;
Expand Down
7 changes: 7 additions & 0 deletions atramhasis/static/css/app-admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -15099,3 +15099,10 @@ a.admin-button:hover {
.confirm-dialog .dijitDialogPaneActionBar *:focus {
outline: none !important;
}

/* line 653, ../scss/atramhasis/_atramhasis-admin.scss */
.radio-container > input[type="radio"] {
display: inline-block;
margin: 0.5rem 1rem 0 0.5rem;
vertical-align: baseline;
}
8 changes: 8 additions & 0 deletions atramhasis/static/scss/atramhasis/_atramhasis-admin.scss
Original file line number Diff line number Diff line change
Expand Up @@ -647,4 +647,12 @@ a.admin-button:hover {
*:focus {
outline: none !important;
}
}

.radio-container {
> input[type="radio"] {
display: inline-block;
margin: 0.5rem 1rem 0 0.5rem;
vertical-align: baseline;
}
}

0 comments on commit 5e94a48

Please sign in to comment.