Skip to content

Instantly share code, notes, and snippets.

@DidelotK
Last active August 29, 2016 09:10
Show Gist options
  • Save DidelotK/4c743ea0eaec4f8d55e6d3be392d8b87 to your computer and use it in GitHub Desktop.
Save DidelotK/4c743ea0eaec4f8d55e6d3be392d8b87 to your computer and use it in GitHub Desktop.
Test helper
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
import Ember from 'ember';
export function date(params/*, hash*/) {
let date = params[0],
duration = params[1];
if (date === null) {
return 0;
}
else if (date + duration * 60 < Date.now()) {
return 1;
}
return 2;
}
export default Ember.Helper.helper(date);
import Ember from 'ember';
export default Ember.Route.extend({
model(){
return {
launchedat: null,
duration: 20
};
}
});
<h1>Welcome to {{appName}}</h1>
{{#if (eq (date model.launchedat model.duration) 0)}}
Heyy
{{/if}}
{{outlet}}
<br>
<br>
{
"version": "0.10.4",
"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.6.2",
"ember-data": "2.7.0",
"ember-template-compiler": "2.6.2"
},
"addons": {
"ember-truth-helpers": "1.2.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment