common/corpus-common-addon/addon/components/doc-subject.js
changeset 447 38d5789e30d0
parent 394 48458e099b05
child 474 245b4df137d3
--- a/common/corpus-common-addon/addon/components/doc-subject.js	Thu Nov 24 19:08:36 2016 +0100
+++ b/common/corpus-common-addon/addon/components/doc-subject.js	Sun Nov 27 15:12:30 2016 +0100
@@ -5,10 +5,18 @@
 export default Ember.Component.extend({
     layout: layout,
     tagName: "span",
-
+    displayLabel: Ember.computed('label', 'resolvedLabel', function() {
+      return this.get('label') || this.get('resolvedLabel');
+    }),
     bnfResolver: Ember.inject.service(),
 
-    _resolveBnfIds: Ember.on('init', Ember.observer('url', function() {
+    _resolveBnfIds: Ember.on('init', Ember.observer('url', 'label', function() {
+      if(this.get('label')) {
+        if (!(this.get('isDestroyed') || this.get('isDestroying'))) {
+          this.set('resolvedLabel', this.get('label'));
+        }
+        return;
+      }
       this.get('bnfResolver').getLabel(this.get('url')).then(function(str) {
         if (!(this.get('isDestroyed') || this.get('isDestroying'))) {
           this.set('resolvedLabel', str);