Created
August 15, 2016 16:19
-
-
Save alcance/77127a545ed563e8c86c04b1eca6ebc8 to your computer and use it in GitHub Desktop.
scheduler
This file contains hidden or 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'; | |
import moment from 'moment'; | |
export default Ember.Component.extend({ | |
init(){ | |
this._super(...arguments); | |
console.log(`${this.get('day')}`); | |
isActive: true; | |
}, | |
day: Ember.computed('dayPassed', function(){ | |
return moment().day(`${this.get('dayPassed')}`).format('MM/DD/YYYY'); | |
}), | |
actions: { | |
toggleState(){ | |
this.toggleProperty('isActive'); | |
}, | |
submit() { | |
const startDate = this.get('day') + ' ' + this.get('start'); | |
const endDate = this.get('day') + ' ' + this.get('end'); | |
const dayDate = moment(this.get('day')).day(); | |
const selectedDate = { | |
day: this.get('dayPassed').toLowerCase(), | |
start: moment(startDate).utc().format(), | |
end: moment(endDate).utc().format() | |
}; | |
this.get('onAdd')(selectedDate); | |
} | |
} | |
}); |
This file contains hidden or 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.Component.extend({ | |
scheduleDates: Ember.inject.service(), | |
actions: { | |
remove(date) { | |
this.get('scheduleDates').remove(date); | |
}, | |
addDate(date){ | |
this.get('scheduleDates').add(date); | |
} | |
} | |
}); |
This file contains hidden or 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' | |
}); |
This file contains hidden or 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.Service.extend({ | |
dates: null, | |
init() { | |
this._super(...arguments); | |
this.set('dates', []); | |
}, | |
add(date) { | |
this.get('dates').addObject(date); | |
}, | |
remove(date) { | |
this.get('dates').removeObject(date); | |
}, | |
empty() { | |
this.get('dates').clear(); | |
} | |
}); |
This file contains hidden or 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.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.7.0", | |
"ember-data": "2.7.0", | |
"ember-template-compiler": "2.7.0" | |
}, | |
"addons": {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment