@@ -11,12 +11,12 @@ const ListComponent = {
1111
1212function controller ( $state , $stateParams , $timeout , leafletData , wikidata ) {
1313 let vm = this ;
14- const ids = $stateParams . id . split ( '-in-' ) . map ( id => id [ 0 ] === 'Q' ? id : 'Q' + id ) ;
14+ const id = $stateParams . id [ 0 ] === 'Q' ? $stateParams . id : 'Q' + $stateParams . id ;
1515
1616 vm . map = { } ;
1717 vm . listParams = { } ;
1818
19- vm . goToItem = ( item ) => item ? $state . go ( 'main.list' , { id : ids [ 0 ] . substring ( 1 ) + '-in-' + item . id . substring ( 1 ) } ) : false ;
19+ vm . goToItem = ( item ) => item ? $state . go ( 'main.list' , { id : item . id . substring ( 1 ) } ) : false ;
2020 vm . querySearch = ( text ) => wikidata . getSearch ( text ) ;
2121 vm . search = { } ;
2222
@@ -38,34 +38,19 @@ function controller($state, $stateParams, $timeout, leafletData, wikidata) {
3838 markers : { }
3939 } ;
4040
41- wikidata . getSearch ( ids [ 1 ] ) . then ( results => {
41+ wikidata . getSearch ( id ) . then ( results => {
4242 vm . search . selectedItem = results . length ? results [ 0 ] : undefined ;
4343 } ) ;
4444
45- /*
46- wikidata.getLabels(ids).then(labels => {
47- angular.extend(vm.listParams, {
48- object: {
49- id: ids[0],
50- label: labels[ids[0]]
51- },
52- place: {
53- id: ids[1],
54- label: labels[ids[1]]
55- }
56- });
57- });
58- */
59-
6045 wikidata . getSPARQL ( `SELECT DISTINCT ?item ?itemLabel ?admin ?adminLabel ?coord ?image WHERE {
6146 ?item p:P1435 ?monument .
62- ?item wdt:P131* wd:` + ids [ 1 ] + ` .
47+ ?item wdt:P131* wd:` + id + ` .
6348 ?item wdt:P131 ?admin .
6449 ?item wdt:P625 ?coord .
6550 OPTIONAL { ?item wdt:P18 ?image }
6651 SERVICE wikibase:label { bd:serviceParam wikibase:language "pl,en" }
6752 }` ) . then ( data => {
68- console . log ( data )
53+ // console.log(data)
6954 vm . list = data . map ( element => ( {
7055 name : {
7156 value_id : element . item . value . substring ( element . item . value . indexOf ( '/Q' ) + 1 ) ,
@@ -86,6 +71,7 @@ function controller($state, $stateParams, $timeout, leafletData, wikidata) {
8671 vm . map . markers [ element . name . value_id ] = {
8772 lat : + element . coord [ 1 ] ,
8873 lng : + element . coord [ 0 ] ,
74+ message : element . name . value ,
8975 icon : icon
9076 } ;
9177 bounds . push ( [ + element . coord [ 1 ] , + element . coord [ 0 ] ] ) ;
0 commit comments