@@ -76,32 +76,70 @@ CustomDataTypeDANTE.prototype.getJSKOSPreview = (data, mapbox_access_token = fal
7676  if  notations
7777    html  +=  ' <h4>' +  $$ (' custom.data.type.dante.modal.form.popup.jskospreview.notations' +  ' </h4>' +  notations
7878
79-   #  startDate + startPlace
80-   startPlaces  =  []
81-   if  data .startDate  ||  data .startPlace 
82-     html  +=  ' <h4>' +  $$ (' custom.data.type.dante.modal.form.popup.jskospreview.startDate' +  ' </h4>' 
83-     if  data .startDate 
84-       html  +=  data .startDate  +  ' <br />' 
85-     if  data .startPlace 
86-       for  key, val of  data .startPlace 
87-         startPlaces .push  '  • ' +  val .prefLabel .und 
88-       startPlaces  =  startPlaces .filter ((item , i , ar ) -> 
89-         ar .indexOf (item) ==  i
90-       )
91-       html  +=  startPlaces .join (' <br />' 
92- 
93-   #  endDate + endPlace
94-   endPlaces  =  []
95-   if  data .endDate  ||  data .endPlace 
96-     html  +=  ' <h4>' +  $$ (' custom.data.type.dante.modal.form.popup.jskospreview.endDate' +  ' </h4>' 
97-     if  data .endDate 
98-       html  +=  data .endDate  +  ' <br />' 
99-     if  data .endPlace 
100-       for  key, val of  data .endPlace 
101-         endPlaces .push  '  • ' +  val .prefLabel .und 
102-       endPlaces  =  endPlaces .filter  (item, i, ar) -> 
103-         ar .indexOf (item) ==  i
104-       html  +=  endPlaces .join (' <br />' 
79+   #  qualifiedRelation to HTML
80+   qualifiedRelationToHTML  =  (qualifiedRelation , translationKey ) -> 
81+     html  =  ' ' 
82+     titleSet  =  false 
83+     for  qualifiedRelationKey, qualifiedRelationEntry of  qualifiedRelation
84+       #  title
85+       if  translationKey and  not  titleSet
86+         titleSet  =  true 
87+         html  +=  ' <h4>' +  $$ (translationKey) +  ' </h4>' 
88+       
89+       #  .resource.prefLabel
90+       if  qualifiedRelationEntry .resource .prefLabel 
91+         prefLabel  =  that .getPrefLabelFromJSKOS (qualifiedRelationEntry .resource )
92+         html  +=  ' <span class="qualifiedRelationInfo cui-label-icon"><i class="fa fa-arrow-circle-o-right" aria-hidden="true"></i></span> ' +  prefLabel +  ' <br />' 
93+ 
94+       #  .startdate + .enddate
95+       if  qualifiedRelationEntry .startDate  ||  qualifiedRelationEntry .endDate 
96+         html  +=  ' <span class="qualifiedRelationInfo cui-label-icon"><i class="fa fa-calendar" aria-hidden="true"></i></span> ' 
97+         if  qualifiedRelationEntry .startDate 
98+           html  +=  qualifiedRelationEntry .startDate  +  '  - ' 
99+         if  qualifiedRelationEntry .endDate 
100+           html  +=  qualifiedRelationEntry .endDate  +  ' <br />' 
101+ 
102+       #  .resource.place
103+       if  qualifiedRelationEntry .resource .place 
104+         places  =  []
105+         for  key, value of  qualifiedRelationEntry .resource .place 
106+           if  value .prefLabel 
107+             placeLabel  =  that .getPrefLabelFromJSKOS (value)
108+             places .push  '  • ' +  placeLabel
109+         if  places .length  >  0 
110+           html  +=  ' <span class="qualifiedRelationInfo cui-label-icon"><i class="fa fa-map-marker" aria-hidden="true"></i></span> ' +  places .join (' <br />' +  ' <br />' 
111+ 
112+       #  .resource.startDate + .resource.startDate
113+       if  qualifiedRelationEntry .resource .startDate  ||  qualifiedRelationEntry .resource .endDate 
114+         html  +=  ' <span class="qualifiedRelationInfo cui-label-icon"><i class="fa fa-calendar" aria-hidden="true"></i></span> ' 
115+         if  qualifiedRelationEntry .resource .startDate 
116+           html  +=  qualifiedRelationEntry .resource .startDate  +  '  - ' 
117+         if  qualifiedRelationEntry .resource .endDate 
118+           html  +=  qualifiedRelationEntry .resource .endDate  +  ' <br />' 
119+ 
120+       #  add a vertical line, if not the last entry
121+       if  (qualifiedRelationKey* 1  +  1 ) <  qualifiedRelation .length       
122+         html  +=  ' <div class="qualifiedRelationsDeviderLine"></div>' 
123+         
124+     return  html
125+   
126+   qualifiedRelationsTableToEcho  =  
127+     ' https://schema.org/gender' :  ' custom.data.type.dante.modal.form.popup.jskospreview.gender' 
128+     ' https://w3id.org/dpv/pd#MaritalStatus' :  ' custom.data.type.dante.modal.form.popup.jskospreview.maritalStatus' 
129+     ' http://www.cidoc-crm.org/cidoc-crm/P11i_participated_in' :  ' custom.data.type.dante.modal.form.popup.jskospreview.participatedIn' 
130+     ' https://schema.org/hasOccupation' :  ' custom.data.type.dante.modal.form.popup.jskospreview.hasOccupation' 
131+     ' http://gov.genealogy.net/ontology.owl#hasDenomination' :  ' custom.data.type.dante.modal.form.popup.jskospreview.hasDenomination' 
132+     ' https://www.wikidata.org/wiki/Property:P102' :  ' custom.data.type.dante.modal.form.popup.jskospreview.hasPoliticalParty' 
133+     ' https://schema.org/nationality' :  ' custom.data.type.dante.modal.form.popup.jskospreview.nationality' 
134+     ' https://www.w3.org/1999/02/22-rdf-syntax-ns#type' :  ' custom.data.type.dante.modal.form.popup.jskospreview.type' 
135+ 
136+   #  Biographie / Chronologie (qualifiedRelations)
137+   if  data .qualifiedRelations 
138+     for  qualifiedRelationKey, qualifiedRelation of  data .qualifiedRelations 
139+       if  qualifiedRelationsTableToEcho[qualifiedRelationKey]
140+         translationKey  =  qualifiedRelationsTableToEcho[qualifiedRelationKey]
141+         #  title (translationKey) to title, but only once
142+         html  +=  qualifiedRelationToHTML (qualifiedRelation, translationKey)
105143
106144  #  Depiction
107145  if  data .depiction 
@@ -233,7 +271,7 @@ CustomDataTypeDANTE.prototype.getJSKOSPreview = (data, mapbox_access_token = fal
233271  if  example
234272    html  +=  ' <h4>' +  $$ (' custom.data.type.dante.modal.form.popup.jskospreview.example' +  ' </h4>' +  example
235273
236-   html  =  ' <style>.danteTooltip {  padding: 10px; min-width:200px; } .danteTooltip h4 { margin-bottom: 0px ; } .danteTooltip .danteTooltipAncestors { font-size: 13px; font-weight: bold; margin-top: 0px;} .danteTooltip .mapImage {background-color: #EFEFEF; position: relative; width: 100%; height: 150px; background-size: cover; background-repeat: no-repeat; margin-bottom: 6px; border-radius: 2px;} .danteTooltip .colorPreview{ width:100%; height: 100px; } .depictionPreview {background-size: contain; background-repeat: no-repeat; background-position: center center; width: 100%; height:150px; background-color: #EFEFEF;}</style><div class="danteTooltip">' +  html +  ' </div>' 
274+   html  =  ' <style>.danteTooltip .qualifiedRelationsDeviderLine {width: 100%; height: 6px;}  .danteTooltip {  padding: 10px; min-width:200px; } .danteTooltip h4 { margin-bottom: 3px; margin-top: 9px ; } .danteTooltip .danteTooltipAncestors { font-size: 13px; font-weight: bold; margin-top: 0px;} .danteTooltip .mapImage {background-color: #EFEFEF; position: relative; width: 100%; height: 150px; background-size: cover; background-repeat: no-repeat; margin-bottom: 6px; border-radius: 2px;} .danteTooltip .colorPreview{ width:100%; height: 100px; } .depictionPreview {background-size: contain; background-repeat: no-repeat; background-position: center center; width: 100%; height:150px; background-color: #EFEFEF;}</style><div class="danteTooltip">' +  html +  ' </div>' 
237275  return  html
238276
239277
0 commit comments