cms/app-client/app/helpers/annotation-content.js
changeset 460 686926d132ff
child 467 762fc0eb4946
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cms/app-client/app/helpers/annotation-content.js	Fri Dec 02 17:22:16 2016 +0100
@@ -0,0 +1,24 @@
+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);