-
-
Save grapho/9219e6957cd2960e70abb47d7999b232 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'; | |
import config from './config/environment'; | |
const Router = Ember.Router.extend({ | |
location: 'none', | |
rootURL: config.rootURL | |
}); | |
Router.map(function() { | |
this.route('schedule'); | |
}); | |
export default Router; |
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.6.0", | |
"ember-data": "2.6.0", | |
"ember-template-compiler": "2.6.0" | |
}, | |
"addons": { | |
"ember-moment": "4.1.0", | |
"ember-pikaday": "2.1.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment