Last active
June 3, 2016 06:47
-
-
Save zackthehuman/aecb99c92d5c5b21115e3c5a5196cab6 to your computer and use it in GitHub Desktop.
New Twiddle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
const DAY_SUNDAY = 0; | |
const DAY_MONDAY = 1; | |
const DOW_SUNDAY_FIRST = [0, 1, 2, 3, 4, 5, 6]; | |
const DOW_MONDAY_FIRST = [1, 2, 3, 4, 5, 6, 0]; | |
export default Ember.Component.extend({ | |
displayDate: null, | |
selectedDate: null, | |
_startDayOfWeek: DAY_SUNDAY, | |
_dayOrder: DOW_SUNDAY_FIRST, | |
navigateBackward(event) { | |
console.log(event); | |
}, | |
init() { | |
this._super(...arguments); | |
const displayDate = this.getWithDefault('attrs.displayDate', new Date()); | |
const selectedDate = this.getWithDefault('attrs.selectedDate', new Date()); | |
if(this.get('_startDayOfWeek') === DAY_MONDAY) { | |
this.set('_dayOrder', DOW_MONDAY_FIRST); | |
} | |
this.setProperties({ | |
displayDate, | |
selectedDate | |
}); | |
}, | |
calendar: Ember.computed('displayDate', function() { | |
const displayDate = this.get('displayDate'); | |
return { | |
currentYear: displayDate.getFullYear(), | |
currentMonth: displayDate.getMonth(), | |
dayNames: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'], | |
weeks: [ | |
{ | |
previousMonthDays: [ | |
{ date: 30, weekday: false }, | |
{ date: 31, weekday: true } | |
], | |
days: [ | |
{ date: 1, weekday: true }, | |
{ date: 2, weekday: true }, | |
{ date: 3, weekday: true }, | |
{ date: 4, weekday: true }, | |
{ date: 5, weekday: false } | |
], | |
nextMonthDays: [ | |
] | |
}, | |
{ | |
previousMonthDays: [ | |
], | |
days: [ | |
{ date: 6, weekday: false }, | |
{ date: 7, weekday: true }, | |
{ date: 8, weekday: true }, | |
{ date: 9, weekday: true }, | |
{ date: 10, weekday: true }, | |
{ date: 11, weekday: true }, | |
{ date: 12, weekday: false } | |
], | |
nextMonthDays: [ | |
] | |
} | |
] | |
}; | |
}), | |
actions: { | |
navigateForward() { | |
}, | |
navigateBackward() { | |
} | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle', | |
tomorrow: new Date(2015, 11, 4) | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export function t(params/*, hash*/) { | |
return params; | |
} | |
export default Ember.Helper.helper(t); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.8.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.5.1", | |
"ember-data": "2.5.2", | |
"ember-template-compiler": "2.5.1" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment