common/corpus-common-addon/addon/components/doc-location.js
changeset 392 4fbe94af93e8
parent 391 4f6118afabee
child 394 48458e099b05
--- a/common/corpus-common-addon/addon/components/doc-location.js	Thu Nov 03 11:14:41 2016 +0100
+++ b/common/corpus-common-addon/addon/components/doc-location.js	Fri Nov 04 19:03:25 2016 +0100
@@ -1,5 +1,5 @@
 import Ember from 'ember';
-import * as constants from 'corpus-common-addon/utils/constants';
+import * as utils from 'corpus-common-addon/utils/utils';
 import layout from '../templates/components/doc-location';
 
 export default Ember.Component.extend({
@@ -16,14 +16,7 @@
   })),
 
   code: Ember.computed('url', function () {
-    let rawLocation = this.get('url');
-    const m = rawLocation.match(constants.GEONAMES_BASE_URLS);
-
-    if (m) {
-      rawLocation = rawLocation.slice(m[0].length);
-    }
-
-    return rawLocation.replace(/\/+$/, '');
+    return utils.getGeonamesCode(this.get('url'));
   }),
   isLocationLink: Ember.computed.match('url', /^http:\/\//)