cms/app-client/app/helpers/annotation-content.js
author ymh <ymh.work@gmail.com>
Tue, 13 Dec 2016 23:30:54 +0100
changeset 473 1b8b29c0e95c
parent 467 762fc0eb4946
permissions -rw-r--r--
Added tag 0.0.13 for changeset 8b1e24e0ef70

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);