common/corpus-common-addon/addon/components/doc-literal.js
changeset 502 74fba571487e
parent 141 c0e8626a271c
equal deleted inserted replaced
501:7b2dcd2b31c1 502:74fba571487e
     2 import layout from '../templates/components/doc-literal';
     2 import layout from '../templates/components/doc-literal';
     3 
     3 
     4 export default Ember.Component.extend({
     4 export default Ember.Component.extend({
     5   layout: layout,
     5   layout: layout,
     6   tagName: 'span',
     6   tagName: 'span',
     7   value: Ember.computed('url', function() {
     7   value: Ember.computed('url', function () {
     8     var url = this.get('url');
     8     const url = this.get('url');
     9     if(typeof url === 'string') {
     9 
       
    10     if (typeof url === 'string') {
    10       return url;
    11       return url;
       
    12     } else if (typeof url === 'object' && !Array.isArray(url) && 'value' in url) {
       
    13       return url.value;
    11     }
    14     }
    12     else if (typeof url === 'object' && !Array.isArray(url) && 'value' in url) {
    15 
    13       return url['value'];
    16     return null;
       
    17   }),
       
    18   lang: Ember.computed('url', function () {
       
    19     const url = this.get('url');
       
    20 
       
    21     if (typeof url === 'object' && !Array.isArray(url) && 'lang' in url) {
       
    22       return url.lang;
    14     }
    23     }
    15     else {
    24 
    16       return null;
    25     return null;
       
    26   }),
       
    27 
       
    28   datatype: Ember.computed('url', function () {
       
    29     const url = this.get('url');
       
    30 
       
    31     if (typeof url === 'object' && !Array.isArray(url) && 'datatype' in url) {
       
    32       return url.datatype;
    17     }
    33     }
    18   }),
    34 
    19   lang: Ember.computed('url', function() {
    35     return null;
    20     var url = this.get('url');
       
    21     if (typeof url === 'object' && !Array.isArray(url) && 'lang' in url) {
       
    22       return url['lang'];
       
    23     }
       
    24     else {
       
    25       return null;
       
    26     }
       
    27   }),
       
    28   datatype: Ember.computed('url', function() {
       
    29     var url = this.get('url');
       
    30     if (typeof url === 'object' && !Array.isArray(url) && 'datatype' in url) {
       
    31       return url['datatype'];
       
    32     }
       
    33     else {
       
    34       return null;
       
    35     }
       
    36   })
    36   })
    37 
    37 
    38 });
    38 });