Skip to content

Commit 7a01ea9

Browse files
authored
Merge pull request #3 from yarl/dev
version 0.3
2 parents 9b59f4c + 0f1e5a2 commit 7a01ea9

7 files changed

Lines changed: 63 additions & 7 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "monumental",
3-
"version": "0.2.0",
3+
"version": "0.3.0",
44
"private": true,
55
"description": "Monumental app",
66
"main": "src/index.js",

src/components/main/monument/monument.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,21 @@ <h4 class="monument__subtitle md-headline">Properties</h4>
9191
ng-href="{{$ctrl.getCommonsLink()}}">
9292
<md-icon>collections</md-icon> {{$ctrl.monument.claims.P373.property[$ctrl.lang]}}
9393
</md-button>
94+
95+
<leaflet ng-if="$ctrl.monument.claims.P625"
96+
markers="$ctrl.map.markers"
97+
center="$ctrl.map.center"></leaflet>
98+
<div layout="row" layout-align="center center"
99+
ng-if="$ctrl.monument.claims.P625">
100+
<md-button class="md-primary" flex
101+
ng-href="https://www.google.com/maps?q={{$ctrl.map.markers.marker.lat}},{{$ctrl.map.markers.marker.lng}}">
102+
<md-icon>map</md-icon> Google Maps
103+
</md-button>
104+
<md-button class="md-primary" flex
105+
ng-href="http://www.openstreetmap.org/#map=17/{{$ctrl.map.markers.marker.lat}}/{{$ctrl.map.markers.marker.lng}}">
106+
<md-icon>map</md-icon> OSM
107+
</md-button>
108+
</div>
94109
</div>
95110
</div>
96111
</md-content>

src/components/main/monument/monument.js

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import _ from 'lodash';
22

33
import './monument.scss';
44
import template from './monument.html';
5+
import '../../../images/marker.png';
56

67
const MonumentComponent = {
78
controller: controller,
@@ -15,6 +16,7 @@ function controller($http, $q, $sce, $stateParams, $timeout, $window, WikiServic
1516
vm.getCommonsLink = getCommonsLink;
1617
vm.image = [];
1718
vm.lang = $stateParams.lang || 'pl';
19+
vm.map = {};
1820

1921
wikidata.setLanguages([vm.lang, 'en']);
2022
getWikidata();
@@ -81,9 +83,35 @@ function controller($http, $q, $sce, $stateParams, $timeout, $window, WikiServic
8183
if (vm.monument.claims.P131) {
8284
getFullLocation(claims.P131.values[0].value_id);
8385
}
84-
if(vm.monument.interwiki[vm.lang + 'wiki']) {
86+
if (vm.monument.interwiki[vm.lang + 'wiki']) {
8587
getArticleHeader(vm.monument.interwiki[vm.lang + 'wiki'].title);
8688
}
89+
if (vm.monument.claims.P625) {
90+
const value = vm.monument.claims.P625.values[0].value;
91+
const icon = {
92+
iconUrl: 'assets/images/marker.png',
93+
shadowUrl: undefined,
94+
iconSize: [40, 40],
95+
shadowSize: [0, 0],
96+
iconAnchor: [20, 20],
97+
shadowAnchor: [0, 0]
98+
};
99+
100+
vm.map = {
101+
center: {
102+
lat: value.latitude,
103+
lng: value.longitude,
104+
zoom: 15
105+
},
106+
markers: {
107+
marker: {
108+
lat: value.latitude,
109+
lng: value.longitude,
110+
icon: icon
111+
}
112+
}
113+
};
114+
}
87115
getInterwiki();
88116

89117
let title = vm.monument.labels[vm.lang] || vm.monument.labels.en || vm.monument.id;

src/components/main/monument/monument.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,4 +119,9 @@ mo-monument {
119119
}
120120
}
121121

122+
.angular-leaflet-map {
123+
width: 100%;
124+
height: 300px;
125+
margin-top: 20px;
126+
}
122127
}

src/images/marker.png

2.07 KB
Loading

src/index.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,12 @@ angular
3131
'restangular',
3232
'infinite-scroll',
3333
'leaflet-directive'
34-
])
34+
])
3535
.config(stateConfig)
36-
.config(themeConfig);
36+
.config(themeConfig)
37+
.config($logProvider => {
38+
$logProvider.debugEnabled(false);
39+
});
3740

3841
/**
3942
* Config of routing
@@ -68,10 +71,15 @@ function stateConfig($stateProvider, $urlRouterProvider) {
6871
*/
6972
function themeConfig($mdThemingProvider, $provide) {
7073
let tp = $mdThemingProvider;
74+
tp.definePalette('moRed', tp.extendPalette('red', {
75+
'500': '#8f0000',
76+
'600': '#8f0000'
77+
}));
78+
7179
tp.alwaysWatchTheme(true);
7280
tp.theme('default')
73-
.primaryPalette('blue')
74-
.accentPalette('red');
81+
.primaryPalette('moRed')
82+
.accentPalette('blue');
7583

7684
$provide.value('themeProvider', tp);
7785
}

src/styles/_general.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ md-content {
3030

3131
a, a.link {
3232
cursor: pointer;
33-
color: rgb(33,150,243);
33+
color: #8f0000;
3434
text-decoration: none;
3535
}
3636

0 commit comments

Comments
 (0)