From 03b8c4b03d865b3b1d34394266e5405b3324587a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Marynowski?= Date: Fri, 19 Oct 2018 00:02:02 +0200 Subject: [PATCH] feat: show place of burial in the modal Closes #5. --- src/models/Grave.js | 9 +++++++++ src/views/About.vue | 3 ++- src/views/Map.vue | 16 ++++++++++++++-- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/models/Grave.js b/src/models/Grave.js index 6df6c6f..4e6f1f0 100644 --- a/src/models/Grave.js +++ b/src/models/Grave.js @@ -9,6 +9,7 @@ export default class Grave { description; birthDate; deathDate; + graveyard; constructor(grave) { this.id = grave.person.value @@ -45,6 +46,14 @@ export default class Grave { }; } catch (err) { /* safely ignore */ } + try { + this.graveyard = { + url: grave.graveyard.value, + value: grave.graveyardLabel.value, + lang: grave.graveyardLabel['xml:lang'], + }; + } catch (err) { /* safely ignore */ } + try { this.description = { value: grave.personDescription.value, diff --git a/src/views/About.vue b/src/views/About.vue index ddb3b36..2b7b31a 100644 --- a/src/views/About.vue +++ b/src/views/About.vue @@ -5,7 +5,7 @@

This web application is using Wikidata data using SPARQL query listed below. You can find source code on GitHub.

- SELECT ?person ?personLabel ?personDescription ?coord ?graveImage ?image ?birthDate ?deathDate + SELECT ?person ?personLabel ?personDescription ?graveyard ?graveyardLabel ?coord ?graveImage ?image ?birthDate ?deathDate WHERE { SERVICE wikibase:box { ?statement pq:P625 ?coord. @@ -13,6 +13,7 @@ bd:serviceParam wikibase:cornerEast <coordinates>. } ?person p:P119 ?statement; wdt:P31 wd:Q5. + ?person wdt:P119 ?graveyard. OPTIONAL { ?person wdt:P1442 ?graveImage } OPTIONAL { ?person wdt:P18 ?image } OPTIONAL { ?person wdt:P569 ?birthDate } diff --git a/src/views/Map.vue b/src/views/Map.vue index 82a9209..235a4dc 100644 --- a/src/views/Map.vue +++ b/src/views/Map.vue @@ -40,6 +40,13 @@
+

+ + {{ modalPerson.graveyard.value }} + +

@@ -147,12 +154,13 @@ * Computes SPARQL query for people with P119 statements */ function getQuery() { - return `SELECT ?person ?personLabel ?personDescription ?coord ?graveImage ?image ?birthDate ?deathDate + return `SELECT ?person ?personLabel ?personDescription ?graveyard ?graveyardLabel ?coord ?graveImage ?image ?birthDate ?deathDate WHERE { SERVICE wikibase:box { ?statement pq:P625 ?coord. ${getBBox()} } ?person p:P119 ?statement; wdt:P31 wd:Q5. + ?person wdt:P119 ?graveyard. OPTIONAL { ?person wdt:P1442 ?graveImage } OPTIONAL { ?person wdt:P18 ?image } OPTIONAL { ?person wdt:P569 ?birthDate } @@ -231,7 +239,7 @@ (element, index, array) => array.findIndex(t => t.person.value === element.person.value) === index) .map(grave => new Grave(grave)); - console.info('Graves loaded:', this.graves); + // console.info('Graves loaded:', this.graves); }); } @@ -360,6 +368,10 @@ max-height: 100%; margin: auto; } + .modal .card .graveyard-info { + margin-left: 64px; + margin-bottom: 5px; + } .modal .card .title.is-4 { margin-bottom: 0; }