aboutsummaryrefslogtreecommitdiff
path: root/javascript/app/components/type-signature.js
blob: ed1849cc3b6e2304b042a0af39b15375829dffde (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import Ember from 'ember';
export default Ember.Component.extend({
  tagName : "span",  
  expandTypeSynonyms: false,  
  expandTypeSynonymsLabel : Ember.computed('expandTypeSynonyms',function() {
    return this.get('expandTypeSynonyms') ? "Show type synonyms" : "Expand type synonyms";
  }),
  components : Ember.computed('type','expandTypeSynonyms',function() {   
    if(this.get('expandTypeSynonyms') && this.get('type.componentsExpanded')) {
      return this.get('type.componentsExpanded');
    } else {
      return this.get('type.components');
    }
  }),
  typeObserver : Ember.observer('type',function() {
    this.set('expandTypeSynonyms',false);
  }),  
  actions : {
    toggleExpandTypeSynonyms () {
      this.toggleProperty('expandTypeSynonyms');
    }
  }
});