common/corpus-common-addon/addon/components/doc-literal.js
author ymh <ymh.work@gmail.com>
Tue, 07 Jun 2016 01:16:31 +0200
changeset 173 cf7b221238fd
parent 141 c0e8626a271c
child 502 74fba571487e
permissions -rw-r--r--
Work on test fixtures: - get rid both on bo and front of 2 fixtures files for documents - correct dl_fixtures to reflect this - upgrade mirage from 0.1.13 to 0.2.0 - download new version of documents fixtures including geo information

import Ember from 'ember';
import layout from '../templates/components/doc-literal';

export default Ember.Component.extend({
  layout: layout,
  tagName: 'span',
  value: Ember.computed('url', function() {
    var url = this.get('url');
    if(typeof url === 'string') {
      return url;
    }
    else if (typeof url === 'object' && !Array.isArray(url) && 'value' in url) {
      return url['value'];
    }
    else {
      return null;
    }
  }),
  lang: Ember.computed('url', function() {
    var url = this.get('url');
    if (typeof url === 'object' && !Array.isArray(url) && 'lang' in url) {
      return url['lang'];
    }
    else {
      return null;
    }
  }),
  datatype: Ember.computed('url', function() {
    var url = this.get('url');
    if (typeof url === 'object' && !Array.isArray(url) && 'datatype' in url) {
      return url['datatype'];
    }
    else {
      return null;
    }
  })

});