common/corpus-common-addon/addon/components/doc-olac.js
author ymh <ymh.work@gmail.com>
Thu, 19 Jan 2017 13:53:17 +0100
changeset 490 76da86cf9696
child 536 b64c8c35c67d
permissions -rw-r--r--
External OLAC links leads now to the OLAC documentation. Closes #0025936
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
490
76da86cf9696 External OLAC links leads now to the OLAC documentation. Closes #0025936
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
import Ember from 'ember';
76da86cf9696 External OLAC links leads now to the OLAC documentation. Closes #0025936
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
import layout from '../templates/components/doc-olac';
76da86cf9696 External OLAC links leads now to the OLAC documentation. Closes #0025936
ymh <ymh.work@gmail.com>
parents:
diff changeset
     3
import DocLiteral from './doc-literal';
76da86cf9696 External OLAC links leads now to the OLAC documentation. Closes #0025936
ymh <ymh.work@gmail.com>
parents:
diff changeset
     4
import * as utils from 'corpus-common-addon/utils/utils';
76da86cf9696 External OLAC links leads now to the OLAC documentation. Closes #0025936
ymh <ymh.work@gmail.com>
parents:
diff changeset
     5
76da86cf9696 External OLAC links leads now to the OLAC documentation. Closes #0025936
ymh <ymh.work@gmail.com>
parents:
diff changeset
     6
export default DocLiteral.extend({
76da86cf9696 External OLAC links leads now to the OLAC documentation. Closes #0025936
ymh <ymh.work@gmail.com>
parents:
diff changeset
     7
  layout,
76da86cf9696 External OLAC links leads now to the OLAC documentation. Closes #0025936
ymh <ymh.work@gmail.com>
parents:
diff changeset
     8
  olacUrl: Ember.computed('url', function () {
76da86cf9696 External OLAC links leads now to the OLAC documentation. Closes #0025936
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
    const url = this.get('url');
76da86cf9696 External OLAC links leads now to the OLAC documentation. Closes #0025936
ymh <ymh.work@gmail.com>
parents:
diff changeset
    10
    const value = this.get('value');
76da86cf9696 External OLAC links leads now to the OLAC documentation. Closes #0025936
ymh <ymh.work@gmail.com>
parents:
diff changeset
    11
76da86cf9696 External OLAC links leads now to the OLAC documentation. Closes #0025936
ymh <ymh.work@gmail.com>
parents:
diff changeset
    12
    const olacDef = utils.getOLACBaseUrl(url);
76da86cf9696 External OLAC links leads now to the OLAC documentation. Closes #0025936
ymh <ymh.work@gmail.com>
parents:
diff changeset
    13
76da86cf9696 External OLAC links leads now to the OLAC documentation. Closes #0025936
ymh <ymh.work@gmail.com>
parents:
diff changeset
    14
    if (!olacDef) {
76da86cf9696 External OLAC links leads now to the OLAC documentation. Closes #0025936
ymh <ymh.work@gmail.com>
parents:
diff changeset
    15
      return '';
76da86cf9696 External OLAC links leads now to the OLAC documentation. Closes #0025936
ymh <ymh.work@gmail.com>
parents:
diff changeset
    16
    }
76da86cf9696 External OLAC links leads now to the OLAC documentation. Closes #0025936
ymh <ymh.work@gmail.com>
parents:
diff changeset
    17
76da86cf9696 External OLAC links leads now to the OLAC documentation. Closes #0025936
ymh <ymh.work@gmail.com>
parents:
diff changeset
    18
    return olacDef.baseUrl + value;
76da86cf9696 External OLAC links leads now to the OLAC documentation. Closes #0025936
ymh <ymh.work@gmail.com>
parents:
diff changeset
    19
  })
76da86cf9696 External OLAC links leads now to the OLAC documentation. Closes #0025936
ymh <ymh.work@gmail.com>
parents:
diff changeset
    20
});