cms/app-client/app/components/notice-location-component.js
changeset 447 38d5789e30d0
child 453 1059a7ae018a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cms/app-client/app/components/notice-location-component.js	Sun Nov 27 15:12:30 2016 +0100
@@ -0,0 +1,25 @@
+import Ember from 'ember';
+import * as commonUtils from 'corpus-common-addon/utils/utils';
+
+export default Ember.Component.extend({
+  classNames: ['notice-location-component'],
+  zoom: 6,
+  tilesUrl: "http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
+  location: Ember.computed('geoInfo', function() {
+    return [this.get('geoInfo.latitude'), this.get('geoInfo.longitude')];
+  }),
+  hasCoordinates: Ember.computed('geoInfo', function() {
+    return Boolean(this.get('geoInfo').longitude) && Boolean(this.get('geoInfo').latitude);
+  }),
+  geonamesLink: Ember.computed('geoInfo.ref-locs', function() {
+    let link = null;
+    this.get('geoInfo.ref-locs').forEach(l => {
+      if(commonUtils.isGeonamesLink(l)) {
+        return link=l;
+      }
+    });
+    return link;
+  }),
+  otherRefLinks: Ember.computed.filter('geoInfo.ref-locs', l => { return !commonUtils.isGeonamesLink(l); })
+
+});