Skip to content

Instantly share code, notes, and snippets.

@twokul
Created March 29, 2017 18:19
Show Gist options
  • Save twokul/107a59f2311f696a96e27f1707d85b6f to your computer and use it in GitHub Desktop.
Save twokul/107a59f2311f696a96e27f1707d85b6f to your computer and use it in GitHub Desktop.
Salary facet
import Ember from 'ember';
const MAX = 1157;
export default Ember.Component.extend({
tagName: 'rect',
attributeBindings: ['computedHeight:height'],
computedHeight: Ember.computed('facet.count', function() {
let facetCount = this.get('facet.count');
debugger;
return 100 - facetCount/MAX;
})
});
import Ember from 'ember';
export default Ember.Component.extend({
tagName: 'svg'
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
import Ember from 'ember';
export default Ember.Route.extend({
model() {
return {
facetContainers: [{
"count": 1157,
"displayValue": "$40,000+",
"value": "1"
}, {
"count": 1139,
"displayValue": "$60,000+",
"value": "2"
}, {
"count": 1026,
"displayValue": "$80,000+",
"value": "3"
}, {
"count": 787,
"displayValue": "$100,000+",
"value": "4"
}, {
"count": 515,
"displayValue": "$120,000+",
"value": "5"
}, {
"count": 198,
"displayValue": "$140,000+",
"value": "6"
}, {
"count": 58,
"displayValue": "$160,000+",
"value": "7"
}, {
"count": 19,
"displayValue": "$180,000+",
"value": "8"
}, {
"count": 1,
"displayValue": "$200,000+",
"value": "9"
}]
};
}
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{outlet}}
<br>
<br>
{{#each facets as |facet|}}
<g></g>
{{/each}}
{{salary-facets facets=model.facetContainers}}
{
"version": "0.12.1",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
"ember": "2.12.0",
"ember-template-compiler": "2.12.0",
"ember-testing": "2.12.0"
},
"addons": {
"ember-data": "2.12.1"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment