@@ -128,19 +128,20 @@ function controller($location, $q, $scope, $state, $stateParams, $timeout, $wind
128
128
129
129
function getPlace ( ) {
130
130
return wikidata . getById ( id ) . then ( ( data ) => {
131
- const first = Object . keys ( data ) [ 0 ] ;
132
- vm . place = data [ first ] ;
131
+ vm . place = data ;
133
132
134
- const claims = vm . place . claims ;
135
- if ( vm . place . claims . P41 ) {
136
- claims . P41 . values . forEach ( image => getImage ( image . value ) ) ;
137
- } else if ( vm . place . claims . P94 ) {
138
- claims . P94 . values . forEach ( image => getImage ( image . value ) ) ;
133
+ if ( vm . place . claims . P31 && vm . place . claims . P31 . some ( claim => claim . mainsnak . datavalue . value . id === 'Q5107' ) ) {
134
+ vm . isContinent = true ;
135
+ return false ;
136
+ } else if ( id === 'Q2' ) {
137
+ vm . isContinent = true ;
138
+ return false ;
139
139
}
140
- if ( vm . place . claims . P17 ) {
141
- const country = claims . P17 . values [ 0 ] ;
142
- const countryLanguages = langService . getNativeLanguages ( country . value_id ) ;
143
140
141
+ const claims = vm . place . claims ;
142
+ if ( vm . place . claims . P17 ) {
143
+ const country = claims . P17 [ 0 ] ;
144
+ const countryLanguages = langService . getNativeLanguages ( country . mainsnak . datavalue . value . id ) ;
144
145
if ( ! countryLanguages ) { return false ; }
145
146
langs = langs . concat ( countryLanguages . map ( lang => ( { code : lang } ) ) ) ;
146
147
}
@@ -149,6 +150,7 @@ function controller($location, $q, $scope, $state, $stateParams, $timeout, $wind
149
150
}
150
151
151
152
function filterMap ( ) {
153
+ if ( ! vm . map ) { return ; }
152
154
$state . transitionTo ( 'main.list' , vm . filter , { notify : false } ) ;
153
155
vm . loading = 'map' ;
154
156
getList ( )
@@ -169,7 +171,7 @@ function controller($location, $q, $scope, $state, $stateParams, $timeout, $wind
169
171
. then ( ( ) => {
170
172
let center = { lat : 49.4967 , lng : 12.4805 , zoom : 4 } ;
171
173
if ( vm . place . claims . P625 ) {
172
- const coords = vm . place . claims . P625 . values [ 0 ] . value ;
174
+ const coords = vm . place . claims . P625 [ 0 ] . mainsnak . datavalue . value ;
173
175
center = { lat : coords . latitude , lng : coords . longitude , zoom : 7 } ;
174
176
}
175
177
return $timeout ( ( ) => {
@@ -287,7 +289,7 @@ function controller($location, $q, $scope, $state, $stateParams, $timeout, $wind
287
289
}
288
290
289
291
function setTitle ( ) {
290
- const title = vm . place . labels [ vm . lang . code ] || vm . place . labels . en || vm . place . id ;
292
+ const title = vm . place . labels [ vm . lang . code ] . value || vm . place . labels . en . value || vm . place . id ;
291
293
$window . document . title = `${ title } – Monumental` ;
292
294
}
293
295
0 commit comments