cms/app-client/app/helpers/annotation-content.js
author ymh <ymh.work@gmail.com>
Fri, 09 Dec 2016 11:41:15 +0100
changeset 467 762fc0eb4946
parent 460 686926d132ff
permissions -rw-r--r--
Migrate d3js to v4 and correct d3js visualisations i.e. bug 3.20. Breadcrumb navigation for the language treemap has been improved

import Ember from 'ember';

export function annotationContent(params/*, hash*/) {
  if(!params || (params.length === 0)) {
    return "";
  }

  let content = params[0];
  if(typeof content === "string") {
    return content;
  } else if(typeof content === "object") {
    let res = `[ ${content.ctype}`;
    for(let k in content) {
      if(k !== 'ctype') {
        res += `, ${k}: ${content[k]}`;
      }
    }
    return res + " ]";
  } else {
    return content;
  }
}

export default Ember.Helper.helper(annotationContent);