cms/app-client/app/components/notice-location-component.js
changeset 447 38d5789e30d0
child 453 1059a7ae018a
equal deleted inserted replaced
446:2a93eb9f38f5 447:38d5789e30d0
       
     1 import Ember from 'ember';
       
     2 import * as commonUtils from 'corpus-common-addon/utils/utils';
       
     3 
       
     4 export default Ember.Component.extend({
       
     5   classNames: ['notice-location-component'],
       
     6   zoom: 6,
       
     7   tilesUrl: "http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
       
     8   location: Ember.computed('geoInfo', function() {
       
     9     return [this.get('geoInfo.latitude'), this.get('geoInfo.longitude')];
       
    10   }),
       
    11   hasCoordinates: Ember.computed('geoInfo', function() {
       
    12     return Boolean(this.get('geoInfo').longitude) && Boolean(this.get('geoInfo').latitude);
       
    13   }),
       
    14   geonamesLink: Ember.computed('geoInfo.ref-locs', function() {
       
    15     let link = null;
       
    16     this.get('geoInfo.ref-locs').forEach(l => {
       
    17       if(commonUtils.isGeonamesLink(l)) {
       
    18         return link=l;
       
    19       }
       
    20     });
       
    21     return link;
       
    22   }),
       
    23   otherRefLinks: Ember.computed.filter('geoInfo.ref-locs', l => { return !commonUtils.isGeonamesLink(l); })
       
    24 
       
    25 });