Skip to content

Instantly share code, notes, and snippets.

@jkarsrud
Forked from DidelotK/controllers.application.js
Created August 29, 2016 09:10
Show Gist options
  • Save jkarsrud/300d5c3547046d92965e9bbd0f32555d to your computer and use it in GitHub Desktop.
Save jkarsrud/300d5c3547046d92965e9bbd0f32555d to your computer and use it in GitHub Desktop.
Test helper
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
init() {
this._super(...arguments);
this.set('model', {
launchedat: null,
duration: 20
});
}
});
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.6.0",
"ember-template-compiler": "2.6.0"
},
"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