diff -r 76a47f714766 -r 4a0fc5c5f420 common/corpus-common-addon/addon/components/doc-language.js --- a/common/corpus-common-addon/addon/components/doc-language.js Fri Nov 18 14:48:49 2016 +0100 +++ b/common/corpus-common-addon/addon/components/doc-language.js Sat Nov 19 21:29:56 2016 +0100 @@ -3,26 +3,35 @@ import layout from '../templates/components/doc-language'; export default Ember.Component.extend({ - layout: layout, - tagName: "span", + layout: layout, + tagName: 'span', + + lexvoResolver: Ember.inject.service(), - lexvoResolver: Ember.inject.service(), + _resolveLexvoIds: Ember.on('init', Ember.observer('url', function () { + this.get('lexvoResolver').getName(this.get('url')).then(function (str) { + if (!(this.get('isDestroyed') || this.get('isDestroying'))) { + this.set('resolvedName', str); + } + }.bind(this)); + })), - _resolveLexvoIds: Ember.on('init', Ember.observer('url', function() { - this.get('lexvoResolver').getName(this.get('url')).then(function(str) { - if (!(this.get('isDestroyed') || this.get('isDestroying'))) { - this.set('resolvedName', str); - } - }.bind(this)); - })), + code: Ember.computed('url', function () { + const rawLanguage = this.get('url'); + + if (this.get('isLanguageNode')) { + return constants.LANGUAGES_NODES[rawLanguage]; + } - code: Ember.computed('url', function() { - var rawLanguage = this.get('url'); - if(rawLanguage && rawLanguage.startsWith(constants.LEXVO_BASE_URL) ) { - return rawLanguage.substr(constants.LEXVO_BASE_URL.length); - } - return rawLanguage; - }), - isLanguageLink: Ember.computed.match('url', /^http\:\/\//) + if (rawLanguage && rawLanguage.startsWith(constants.LEXVO_BASE_URL)) { + return rawLanguage.substr(constants.LEXVO_BASE_URL.length); + } + + return rawLanguage; + }), + isLanguageLink: Ember.computed.match('url', /^http\:\/\//), + isLanguageNode: Ember.computed('url', function () { + return this.get('url') in constants.LANGUAGES_NODES; + }) });