diff --git a/src/controller/WebController.php b/src/controller/WebController.php
index 4c25f9c18..9e4220230 100644
--- a/src/controller/WebController.php
+++ b/src/controller/WebController.php
@@ -552,6 +552,8 @@ public function invokeVocabularyHome($request)
$vocabTypes = $this->model->getTypes($request->getVocabid(), $request->getLang());
+ $customLabels = $vocab->getConfig()->getPropertyLabelOverrides();
+
echo $template->render(
array(
'languages' => $this->languages,
@@ -561,7 +563,8 @@ public function invokeVocabularyHome($request)
'active_tab' => $defaultView,
'request' => $request,
'types' => $vocabTypes,
- 'plugin_params' => $pluginParameters
+ 'plugin_params' => $pluginParameters,
+ 'custom_labels' => $customLabels
)
);
}
diff --git a/src/view/vocab-info.inc.twig b/src/view/vocab-info.inc.twig
index fcc550b4b..fc195a6d4 100644
--- a/src/view/vocab-info.inc.twig
+++ b/src/view/vocab-info.inc.twig
@@ -14,7 +14,13 @@
{% for key, values in vocabInfo %}
-
{{ key | trans }}
+ {%- set label = custom_labels[key]['label'][request.lang] | default(key | trans) -%}
+ {%- set tooltip = custom_labels[key]['description'][request.lang] | default('') -%}
+
+ {%- if tooltip is not empty %}
+ {{ tooltip }}
+ {%- endif %}
+
{% for val in values %}
diff --git a/tests/VocabularyConfigTest.php b/tests/VocabularyConfigTest.php
index aeb21f853..28c8a4d54 100644
--- a/tests/VocabularyConfigTest.php
+++ b/tests/VocabularyConfigTest.php
@@ -752,6 +752,8 @@ public function testGetPropertyLabelOverrides()
'description' => array( 'en' => 'Class Number') ),
'skos:exactMatch' => array( 'label' => array( 'fi' => 'vastaava luokka', 'sv' => 'motsvarande klasser', 'en' => 'exactly matching classes' ),
'description' => array( 'en' => 'exactly matching classes in another vocabulary.' ) ),
+ 'unknown:vocabularyProperty' => array( 'label' => array( 'en' => 'Vocabulary Property' ),
+ 'description' => array( 'en' => 'Vocabulary Property description' ) )
);
$this->assertEquals($expected, $overrides);
}
diff --git a/tests/cypress/template/concept.cy.js b/tests/cypress/template/concept.cy.js
index ddaf51230..2b174005c 100644
--- a/tests/cypress/template/concept.cy.js
+++ b/tests/cypress/template/concept.cy.js
@@ -142,7 +142,7 @@ describe('Concept page', () => {
// Check that "my property" property label is capitalized correctly
cy.get('.prop-my_property .property-label h2').invoke('text').should('include', 'My property')
})
- it('overrides property labels', () => {
+ it('overrides concept property labels', () => {
// Go to "Carp" concept page in vocab with property label overrides
cy.visit('/conceptPropertyLabels/en/page/ta112')
// Check that prefLabel property label is overridden correctly
@@ -155,6 +155,19 @@ describe('Concept page', () => {
// Check that mapping property title is overridden correctly
cy.get('.prop-mapping .property-label').eq(0).should('have.attr', 'title').and('contain', 'Exactly matching classes in another vocabulary.')
})
+ it('overrides vocabulary property labels', () => {
+ // Go to "Carp" concept page in vocab with property label overrides
+ cy.visit('/conceptPropertyLabels/en/')
+ // Loop through all .row.property and if the element has a .property-value ul li with text "Overridden property value", check the label and title of the .property-label for this row
+ cy.get('.row.property').each($row => {
+ cy.wrap($row).find('.property-value ul li').each($li => {
+ if ($li.text().includes('Overridden property value')) {
+ cy.wrap($row).find('.property-label h2').eq(0).invoke('text').should('include', 'Vocabulary Property')
+ cy.wrap($row).find('.property-label h2').eq(0).should('have.attr', 'data-title').and('contain', 'Vocabulary Property description')
+ }
+ })
+ })
+ })
it('contains SKOS XL information for concept prefLabel', () => {
cy.visit('/yso/en/page/p4625?clang=se') // go to "bronsaƔigi" concept page ('Bronze Age' in Northern Sami)
diff --git a/tests/test-vocab-data/conceptPropertyLabels.ttl b/tests/test-vocab-data/conceptPropertyLabels.ttl
index f363fe12c..009418d8b 100644
--- a/tests/test-vocab-data/conceptPropertyLabels.ttl
+++ b/tests/test-vocab-data/conceptPropertyLabels.ttl
@@ -10,6 +10,7 @@
@prefix xml: .
@prefix xsd: .
@prefix mads: .
+@prefix unknown: .
test:ta112 a skos:Concept ;
skos:notation "665" ;
@@ -44,4 +45,5 @@ test:conceptscheme a skos:ConceptScheme ;
rdfs:label "Test conceptscheme"@en ;
dct:modified "2014-10-01T16:29:03+00:00"^^xsd:dateTime ;
owl:versionInfo "The latest and greatest version"^^xsd:string ;
+ unknown:vocabularyProperty "Overridden property value"^^xsd:string ;
skos:hasTopConcept test:ta1 .
diff --git a/tests/testconfig.ttl b/tests/testconfig.ttl
index 4ce246cba..1cec10831 100644
--- a/tests/testconfig.ttl
+++ b/tests/testconfig.ttl
@@ -16,6 +16,7 @@
@prefix my: .
@prefix mdrtype: .
@prefix test: .
+@prefix unknown: .
@prefix : .
# Skosmos main configuration
@@ -415,7 +416,10 @@
rdfs:comment "Class Number"@en ],
[ skosmos:property skos:exactMatch ;
rdfs:label "vastaava luokka"@fi, "motsvarande klasser"@sv, "exactly matching classes"@en ;
- rdfs:comment "exactly matching classes in another vocabulary."@en ] ;
+ rdfs:comment "exactly matching classes in another vocabulary."@en ],
+ [ skosmos:property unknown:vocabularyProperty ;
+ rdfs:label "Vocabulary Property"@en ;
+ rdfs:comment "Vocabulary Property description"@en ] ;
skosmos:sparqlGraph .
:cbd a skosmos:Vocabulary, void:Dataset ;