cms/app-client/app/components/notice-location-component.js
author ymh <ymh.work@gmail.com>
Fri, 09 Dec 2016 11:41:15 +0100
changeset 467 762fc0eb4946
parent 453 1059a7ae018a
child 502 74fba571487e
permissions -rw-r--r--
Migrate d3js to v4 and correct d3js visualisations i.e. bug 3.20. Breadcrumb navigation for the language treemap has been improved

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); })

});