Skip to content

Commit

Permalink
Item view (#99)
Browse files Browse the repository at this point in the history
* add geodata layout

* add testdata

* wip

* add swiss map projection

* delete 'format' from browse page

* add testdata in new datamodel

* wip

* wip

* wip

* wip

* wip

* wip

* add testdata

* improve external links

* undo changes in file

* add links in description

* adopt infoclio citation style

* adopt new link notation

* delete testdata

* rename display_names and fix label

* fix download-button

* fix external_link
  • Loading branch information
koilebeit authored Jun 3, 2024
1 parent 6852f26 commit 3919464
Show file tree
Hide file tree
Showing 16 changed files with 6,219 additions and 40 deletions.
2 changes: 1 addition & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ source-code: https://github.com/Stadt-Geschichte-Basel/forschung.stadtgeschichte
# SITE SETTINGS
#
# title of site appears in banner
title: Stadt.Geschichte.Basel
title: Forschungsdatenplattform
# tagline, a short phrase that will appear throughout the site in the top banner
tagline: Forschung, Quellen und Daten zur Geschichte der Stadt Basel
# description appears in meta tags and other locations
Expand Down
1 change: 1 addition & 0 deletions _data/config-browse.csv
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ subject,Themen,true,,
era,Epoche,true,,
creator,,,true,
publisher,,,true,
language,,,true,
20 changes: 10 additions & 10 deletions _data/config-metadata.csv
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
field,display_name,browse_link,external_link,dc_map,schema_map
objectid,Identifikator,,,DCTERMS.identifier,identifier
title,Titel,,,DCTERMS.title,headline
creator,Ersteller*in,,,DCTERMS.creator,creator
date,Datum,,,DCTERMS.date,dateCreated
era,Epoche,true,,DCTERMS.temporal,
description,Beschreibung,,,DCTERMS.description,description
subject,Thema,true,,DCTERMS.subject,keywords
publisher,Rechteinhaber*in,true,,DCTERMS.publisher,publisher
source,Quelle,,,DCTERMS.source,
relation,Link,,true,DCTERMS.relation,
hasVersion,IIIF Manifest,,true,DCTERMS.hasVersion,version
type,Typ,,,DCTERMS.type,
era,Epoche,true,,DCTERMS.temporal,
isPartOf,Gehört zu,,true,DCTERMS.isPartOf,isPartOf
creator,Ersteller*in,,true,DCTERMS.creator,creator
publisher,Verantwortliche Gedächtnisinstitution,,true,DCTERMS.publisher,publisher
date,Datum,,,DCTERMS.date,dateCreated
source,Quelle,,true,DCTERMS.source,
type,Typ,,true,DCTERMS.type,
format,Format,,,DCTERMS.format,encodingFormat
extent,Auflösung,,,DCTERMS.extent,
language,Sprache,true,,DCTERMS.language,inLanguage
rights,Rechte,,,DCTERMS.rights,usageInfo
license,Lizenz,,true,DCTERMS.license,license
isReferencedBy,Abbildung,,,DCTERMS.isReferencedBy,
isPartOf,Band,,,DCTERMS.isPartOf,isPartOf
relation,Verwandte Ressourcen,,true,DCTERMS.relation,relation


29 changes: 15 additions & 14 deletions _data/theme.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ metadata-facets-fields: "subject,creator,format"
# Note, like other items, child objects will only appear in visualizations if they have the correct metadata (lat long for map; date for timeline)
# select true below if you'd like your compound object's child objects to appear in any of the pages or features listed
map-child-objects: false # true / false - if true, and if child item has latitude and longitude, child objects will be displayed on map
timeline-child-objects: false # true / false - if true, and if child object has date, child objects will appear as thumbnails on timeline page
data-child-objects: false # true / false - if true, child objects will appear linked in table on data page
timeline-child-objects: true # true / false - if true, and if child object has date, child objects will appear as thumbnails on timeline page
data-child-objects: true # true / false - if true, child objects will appear linked in table on data page
carousel-child-objects: true # true / false - if true, child objects will appear on homepage carousel
browse-child-objects: false # true / false - if true, child objects will appear on browse page and child objects' metadata will populate cloud pages like Subjects page and Locations page, as well as featured terms boxes on the home page
browse-child-objects: true # true / false - if true, child objects will appear on browse page and child objects' metadata will populate cloud pages like Subjects page and Locations page, as well as featured terms boxes on the home page
search-child-objects: true # true / false - if true, child objects will appear on on search page along with parent objects


Expand Down Expand Up @@ -122,14 +122,15 @@ font-cdn: "<link rel='preload' href='/assets/fonts/EuclidCircularB-Regular-WebS.
# the template uses Bootstrap Icons, https://icons.getbootstrap.com/
# find the names on the BI icons page, e.g. file-image
#
# icons:
# icon-image: image
# icon-audio: soundwave
# icon-video: film
# icon-pdf: file-pdf
# icon-record: file-text
# icon-panorama: image-alt
# icon-compound-object: collection
# icon-multiple: postcard
# icon-default: file-earmark # fall back icon
# icon-back-to-top: arrow-up-square
icons:
icon-image: image
icon-audio: soundwave
icon-video: film
icon-pdf: file-pdf
icon-record: file-text
icon-panorama: image-alt
icon-compound-object: collection
icon-multiple: postcard
icon-default: file-earmark # fall back icon
icon-back-to-top: arrow-up-square
icon-external-link: box-arrow-up-right
167 changes: 167 additions & 0 deletions _includes/feature/geodata_map.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
{% comment %}

Mini Leaflet Map item feature.
This include adds a small leaflet map.

E.G> --> {% include feature/geodata_map.html %}

Options:
- "latitude" = center of map, required if not using objectid
- "longitude" = center of map, required if not using objectid
- "height" = height of the mini map in px (default 400px)
- "map-zoom" = provide a zoom level, default 10
- "map-link" = true/false, add a button link to the collection's default full map page (default false)
- "basemap" = set basemap option, Esri_WorldStreetMap, Esri_NatGeoWorldMap, Esri_WorldImagery. default Esri_WorldImagery.

{% endcomment %}
{% capture map_id %}mini-map_{{ include.latitude | slugify }}{% endcapture %}
{% assign map-item = site.data[site.metadata] | where: "objectid", include.objectid | first %}
{% assign geojson = page.object_location %}
<style>
#{{ map_id }} { height: {{ include.height | default: '500px' }}; z-index: 98; }
</style>
<div id="{{ map_id }}" class="text-start"></div>
{% if include.map-link == true %}
<a href="{{ '/map.html' | relative_url }}?location={{ map-item.latitude | default: include.latitude }},{{ map-item.longitude | default: include.longitude }}{%if include.objectid %}&marker={{ include.objectid }}{% endif %}" class="btn btn-outline-primary my-3">View on Full Map</a>{% endif %}
<!-- load leaflet dependencies -->
<link rel="stylesheet" href="{{ '/assets/lib/leaflet/leaflet.css' | relative_url }}">
<link rel="stylesheet" href="{{ '/assets/lib/leaflet/leaflet.fullscreen.css' | relative_url }}">
<script src="{{ '/assets/lib/leaflet/leaflet.js' | relative_url }}"></script>
<script src="{{ '/assets/lib/leaflet/Leaflet.fullscreen.min.js' | relative_url }}"></script>
<script src="{{ '/assets/lib/proj4leaflet/proj4.js' | relative_url }}"></script>
<script src="{{ '/assets/lib/proj4leaflet/proj4leaflet.js' | relative_url }}"></script>

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/Leaflet.TileLayer.Swiss.umd.js"
crossorigin integrity="sha384-M4p8VfZ8RG6qNiPYA3vOCApQXAlLtnJXVPdydMYPAsvvIDsWp2dqqzF2OEeWWNhy">
</script>

<script>
var url = '{{ geojson | default: 'null' }}';
var geoJsonData;

fetch(url)
.then(response => response.json())
.then(data => {
geoJsonData = data;
const crsValue = geoJsonData.crs.properties.name;

/* initial start point */
var mapCenter = [{{ map-item.latitude | default: 0 }}, {{ map-item.longitude | default: 0 }}];
var mapZoom = {{ include.map-zoom | default: 10 }};

if (crsValue === 'urn:ogc:def:crs:EPSG::2056') {
proj4.defs(crsValue, "+proj=somerc +lat_0=46.9524055555556 +lon_0=7.43958333333333 +k_0=1 +x_0=2600000 +y_0=1200000 +ellps=bessel +towgs84=674.374,15.056,405.346,0,0,0,0 +units=m +no_defs");
var map = L.map('{{ map_id }}', {
// Use LV95 (EPSG:2056) projection
crs: L.CRS.EPSG2056,
}).setView(mapCenter, mapZoom);

var mapLayer = L.tileLayer.swiss({
layer: 'ch.swisstopo.pixelkarte-grau',
maxNativeZoom: 28
});
var satelliteLayer = L.tileLayer.swiss({
layer: 'ch.swisstopo.swissimage',
maxNativeZoom: 28
});
var baseMaps = {
'Karte': mapLayer,
'Satellit (Swissimage)': satelliteLayer
};
var overlayMaps = {
'Höhenmodell': L.tileLayer.swiss({
format: 'png',
layer: 'ch.swisstopo.digitales-hoehenmodell_25_reliefschattierung',
maxNativeZoom: 28,
opacity: 1,
timestamp: 'current'
}),
'Dufourkarte': L.tileLayer.swiss({
format: 'png',
layer: 'ch.swisstopo.hiks-dufour',
maxNativeZoom: 28,
opacity: 1,
timestamp: 'current'
}),
'Siegfriedkarte (1870-1926)': L.tileLayer.swiss({
format: 'png',
layer: 'ch.swisstopo.hiks-siegfried',
maxNativeZoom: 28,
opacity: 1,
timestamp: 'current'
}),
'Kantonsgrenzen': L.tileLayer.swiss({
format: 'png',
layer: 'ch.swisstopo.swissboundaries3d-kanton-flaeche.fill',
maxNativeZoom: 28,
opacity: 0.7,
timestamp: 'current'
})
};
map.fitSwitzerland();

L.control.layers(baseMaps, overlayMaps, { collapsed: true }).addTo(map);
/* load base map */
{{ include.basemap | default: 'mapLayer' }}.addTo(map);

/* add fullscreen control */
map.addControl(new L.Control.Fullscreen());


/* add geojson layer */
const layer = L.Proj.geoJson(geoJsonData, {
onEachFeature: function (f, l) {
l.bindPopup('<pre>'+JSON.stringify(f.properties,null,' ').replace(/[\{\}"]/g,'')+'</pre>');
}
}).addTo(map);
}
else {
var map = L.map('{{ map_id }}').setView(mapCenter, mapZoom);

/* add map layer options */
var Esri_WorldTopoMap = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}', {
attribution: 'Tiles &copy; Esri &mdash; Esri, DeLorme, NAVTEQ, TomTom, Intermap, iPC, USGS, FAO, NPS, NRCAN, GeoBase, Kadaster NL, Ordnance Survey, Esri Japan, METI, Esri China (Hong Kong), and the GIS User Community'
});
var Esri_WorldGrayCanvas = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/{z}/{y}/{x}', {
attribution: 'Tiles &copy; Esri &mdash; Esri, DeLorme, NAVTEQ',
maxZoom: 16
});
var Esri_WorldShadedRelief = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Shaded_Relief/MapServer/tile/{z}/{y}/{x}', {
attribution: 'Tiles &copy; Esri &mdash; Source: Esri',
maxZoom: 13
});
var Esri_WorldImagery = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
attribution: 'Tiles &copy; Esri &mdash; Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community'
});
/* add base map switcher */
var baseMaps = {
"Esri World TopoMap": Esri_WorldTopoMap,
"Esri World Gray Canvas": Esri_WorldGrayCanvas,
"Esri World Shaded Relief": Esri_WorldShadedRelief,
"Esri Imagery": Esri_WorldImagery
};
L.control.layers(baseMaps).addTo(map);
/* load base map */
{{ include.basemap | default: 'Esri_WorldImagery' }}.addTo(map);

/* add fullscreen control */
map.addControl(new L.Control.Fullscreen());

/* add geojson layer */
const layer = L.geoJSON(geoJsonData, {
onEachFeature: function (f, l) {
l.bindPopup('<pre>'+JSON.stringify(f.properties,null,' ').replace(/[\{\}"]/g,'')+'</pre>');
}
}).addTo(map);
/* Fit map to GeoJSON layer bounds */
map.fitBounds(layer.getBounds());
}

})
.catch(error => {
console.error('Error fetching GeoJSON data:', error);
});



</script>
6 changes: 5 additions & 1 deletion _includes/item/child/citation-box.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
<div class="card-body">
<dl>
<dt>{{ site.data.translations['_includes']['item']['child']['citation-box.html']['preferred-citation'][site.lang] | default: "Preferred Citation" }}:</dt>
<dd>"{{ child.title | default: page.title }}", {{ site.title }}, {{ site.organization-name }}</dd>
<dd>{{ site.organization-name }}: {{ child['title'] }}. {{ site['title'] }},
{% if child['date'] %}
{{ child['date'] }},
{% endif %}
&lt;{{ page.url | absolute_url }}#{{ child.objectid }}&gt;, Stand: {{ "now" | date: "%d.%m.%Y" }}.</dd>
<dt>{{ site.data.translations['_includes']['item']['child']['citation-box.html']['reference-link'][site.lang] | default: "Reference Link" }}:</dt>
<dd>{{ page.url | absolute_url }}#{{ child.objectid }}</dd>
</dl>
Expand Down
14 changes: 13 additions & 1 deletion _includes/item/child/compound-item-download-buttons.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,19 @@
<a href="{{ year | strip | prepend: '/timeline.html#y' | relative_url }}" class="btn btn-outline-primary">{{ site.data.translations['_includes']['item']['child']['compound-item-download-buttons.html']['timeline'][site.lang] | default: "View on Timeline"}}</a>{% endif %}
{% if page.latitude and page.longitude %}
<a href="{{ '/map.html?location=' | append: page.latitude | append: ',' | append: page.longitude | append: '&marker=' | append: page.objectid | relative_url }}" class="btn btn-outline-primary">{{ site.data.translations['_includes']['item']['child']['compound-item-download-buttons.html']['map'][site.lang] | default: "View on Map" }}</a>{% endif %}

{% assign has_download_options = false %}
{% if page.object_location %}
{% assign has_download_options = true %}
{% endif %}
{% for child in children %}
{% if child.object_location %}
{% assign has_download_options = true %}
{% endif %}
{% endfor %}

<div class="btn-group" role="group">
<button class="btn btn-outline-primary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
<button class="btn dropdown-toggle {% unless has_download_options %}btn-secondary{% else %}btn-outline-primary{% endunless %}" type="button" data-bs-toggle="dropdown" aria-expanded="false" {% unless has_download_options %}disabled{% endunless %}>
{{ site.data.translations['_includes']['item']['child']['compound-item-download-buttons.html']['download'][site.lang] | default: "Download" }}
</button>
<ul class="dropdown-menu">
Expand All @@ -28,5 +38,7 @@
{% endunless %}
{% endfor %}
</ul>
<a class="btn btn-outline-primary text-danger d-flex align-items-center" href="mailto:{{ site.report-email }}?subject={{ site.data.translations['_includes']['item']['download-buttons.html']['subject'][site.lang] | default: 'Report faulty metadata for'}} {{ page.title | escape }}&body={{ site.data.translations['_includes']['item']['download-buttons.html']['body'][site.lang] | default: 'Please describe the issue with the metadata for'}} {{ page.title | escape }}.%0D%0A%0D%0A- URL: {{ site.url | append: page.url | url_encode }}%0D%0A- ID: {{ page.objectid | escape }}">{{ site.data.translations['_includes']['item']['download-buttons.html']['report'][site.lang] | default: "Report faulty metadata" }}</a>

</div>
</div>
2 changes: 2 additions & 0 deletions _includes/item/child/compound-item-modal-gallery.html
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ <h3 class="h5">{{ page.title }}
<div class="m-2">
{% if child.display_template == 'image' %}
{% include item/child/image-gallery.html %}
{% elsif child.display_template == 'geodata' %}
{% include item/child/geodata_child.html %}
{% elsif child.display_template == 'video' %}
{% if child.object_location contains 'vimeo' or child.object_location contains 'youtu' %}
{% include item/child/video-embed.html %}
Expand Down
2 changes: 2 additions & 0 deletions _includes/item/child/download-buttons.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
<a href="{{ '/map.html?location=' | append: page.latitude | append: ',' | append: page.longitude | append: '&marker=' | append: page.objectid | relative_url }}" class="btn btn-outline-primary">{{ site.data.translations['_includes']['item']['child']['download-buttons.html']['map'][site.lang] | default: "View on Map" }}</a>{% endif %}{% if child.object_location %}<a target="_blank" rel="noopener" href="{{ child.object_location | relative_url }}" class="btn btn-outline-primary">
{% if child.display_template == 'video' and child.object_location contains 'vimeo' %}{{ site.data.translations['_includes']['item']['child']['download-buttons.html']['vimeo'][site.lang] | default: "View on Vimeo" }}{% elsif child.display_template == 'video' and child.object_location contains 'youtu' %}{{ site.data.translations['_includes']['item']['child']['download-buttons.html']['youtube'][site.lang] | default: "View on YouTube" }}e{% elsif child.display_template == 'record'%}{{ site.data.translations['_includes']['item']['child']['download-buttons.html']['link-to-object'][site.lang] | default: "Link to Object" }}{% else %}Download {{ child.format | split: '/' | last | default: page.display_template | upcase }}{% endif %}
</a>{% endif %}
<a class="btn btn-outline-primary text-danger d-flex align-items-center" href="mailto:{{ site.report-email }}?subject={{ site.data.translations['_includes']['item']['download-buttons.html']['subject'][site.lang] | default: 'Report faulty metadata for'}} {{ child.title | escape }}&body={{ site.data.translations['_includes']['item']['download-buttons.html']['body'][site.lang] | default: 'Please describe the issue with the metadata for'}} {{ child.title | escape }}.%0D%0A%0D%0A- URL: {{ site.url | append: page.url | url_encode }}#{{ child.objectid }}%0D%0A- ID: {{ child.objectid | escape }}">{{ site.data.translations['_includes']['item']['download-buttons.html']['report'][site.lang] | default: "Report faulty metadata" }}</a>

</div>
{% if child.object_transcript %}
<div class="collapse mt-3" id="collapseTranscript{{ child.objectid }}">
Expand Down
Loading

0 comments on commit 3919464

Please sign in to comment.