cms/app-client/app/helpers/annotation-content.js
author ymh <ymh.work@gmail.com>
Mon, 12 Dec 2016 17:37:54 +0100
changeset 468 8fe093d88efe
parent 467 762fc0eb4946
permissions -rw-r--r--
correct min, max calculations when theme list change
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
460
686926d132ff add events, comment, etc to transcripts
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
import Ember from 'ember';
686926d132ff add events, comment, etc to transcripts
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
686926d132ff add events, comment, etc to transcripts
ymh <ymh.work@gmail.com>
parents:
diff changeset
     3
export function annotationContent(params/*, hash*/) {
467
762fc0eb4946 Migrate d3js to v4 and correct d3js visualisations i.e. bug 3.20. Breadcrumb navigation for the language treemap has been improved
ymh <ymh.work@gmail.com>
parents: 460
diff changeset
     4
  if(!params || (params.length === 0)) {
460
686926d132ff add events, comment, etc to transcripts
ymh <ymh.work@gmail.com>
parents:
diff changeset
     5
    return "";
686926d132ff add events, comment, etc to transcripts
ymh <ymh.work@gmail.com>
parents:
diff changeset
     6
  }
686926d132ff add events, comment, etc to transcripts
ymh <ymh.work@gmail.com>
parents:
diff changeset
     7
686926d132ff add events, comment, etc to transcripts
ymh <ymh.work@gmail.com>
parents:
diff changeset
     8
  let content = params[0];
686926d132ff add events, comment, etc to transcripts
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
  if(typeof content === "string") {
686926d132ff add events, comment, etc to transcripts
ymh <ymh.work@gmail.com>
parents:
diff changeset
    10
    return content;
686926d132ff add events, comment, etc to transcripts
ymh <ymh.work@gmail.com>
parents:
diff changeset
    11
  } else if(typeof content === "object") {
686926d132ff add events, comment, etc to transcripts
ymh <ymh.work@gmail.com>
parents:
diff changeset
    12
    let res = `[ ${content.ctype}`;
686926d132ff add events, comment, etc to transcripts
ymh <ymh.work@gmail.com>
parents:
diff changeset
    13
    for(let k in content) {
686926d132ff add events, comment, etc to transcripts
ymh <ymh.work@gmail.com>
parents:
diff changeset
    14
      if(k !== 'ctype') {
686926d132ff add events, comment, etc to transcripts
ymh <ymh.work@gmail.com>
parents:
diff changeset
    15
        res += `, ${k}: ${content[k]}`;
686926d132ff add events, comment, etc to transcripts
ymh <ymh.work@gmail.com>
parents:
diff changeset
    16
      }
686926d132ff add events, comment, etc to transcripts
ymh <ymh.work@gmail.com>
parents:
diff changeset
    17
    }
686926d132ff add events, comment, etc to transcripts
ymh <ymh.work@gmail.com>
parents:
diff changeset
    18
    return res + " ]";
686926d132ff add events, comment, etc to transcripts
ymh <ymh.work@gmail.com>
parents:
diff changeset
    19
  } else {
686926d132ff add events, comment, etc to transcripts
ymh <ymh.work@gmail.com>
parents:
diff changeset
    20
    return content;
686926d132ff add events, comment, etc to transcripts
ymh <ymh.work@gmail.com>
parents:
diff changeset
    21
  }
686926d132ff add events, comment, etc to transcripts
ymh <ymh.work@gmail.com>
parents:
diff changeset
    22
}
686926d132ff add events, comment, etc to transcripts
ymh <ymh.work@gmail.com>
parents:
diff changeset
    23
686926d132ff add events, comment, etc to transcripts
ymh <ymh.work@gmail.com>
parents:
diff changeset
    24
export default Ember.Helper.helper(annotationContent);