added 260907 version of worker toolkit
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import Ember from 'ember';
|
||||
import AuthenticatedRouteMixin from 'flaredown/mixins/authenticated-route-mixin';
|
||||
import CheckinByDate from 'flaredown/mixins/checkin-by-date';
|
||||
import moment from 'moment';
|
||||
|
||||
const {
|
||||
set,
|
||||
Route,
|
||||
RSVP,
|
||||
} = Ember;
|
||||
|
||||
export default Route.extend(AuthenticatedRouteMixin, CheckinByDate, {
|
||||
beforeModel: function(transition){
|
||||
set(this, 'date', transition.queryParams.date);
|
||||
},
|
||||
|
||||
model(params) {
|
||||
const date = params.date_key || moment(new Date()).format('YYYY-MM-DD');
|
||||
|
||||
return RSVP.hash({ checkins: this.checkinByDate(date), date: date })
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,29 @@
|
||||
import Ember from 'ember';
|
||||
import AuthenticatedRouteMixin from 'flaredown/mixins/authenticated-route-mixin';
|
||||
import CheckinByDate from 'flaredown/mixins/checkin-by-date';
|
||||
import moment from 'moment';
|
||||
|
||||
const {
|
||||
get,
|
||||
set,
|
||||
Route,
|
||||
} = Ember;
|
||||
|
||||
export default Route.extend(AuthenticatedRouteMixin, CheckinByDate, {
|
||||
beforeModel: function(transition){
|
||||
set(this, 'date', transition.queryParams.date);
|
||||
},
|
||||
|
||||
model() {
|
||||
const date = get(this, 'date') || moment(new Date()).format('YYYY-MM-DD');
|
||||
|
||||
this.checkinByDate(date).then(
|
||||
() => {
|
||||
this.routeToCheckin(date);
|
||||
},
|
||||
() => {
|
||||
this.routeToNewCheckin(date);
|
||||
}
|
||||
);
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,35 @@
|
||||
import Ember from 'ember';
|
||||
import AuthenticatedRouteMixin from 'flaredown/mixins/authenticated-route-mixin';
|
||||
|
||||
const {
|
||||
get,
|
||||
set,
|
||||
RSVP,
|
||||
Route,
|
||||
} = Ember;
|
||||
|
||||
export default Route.extend(AuthenticatedRouteMixin, {
|
||||
beforeModel() {
|
||||
this._super(...arguments);
|
||||
|
||||
const store = get(this, 'store');
|
||||
|
||||
if(store.peekAll('condition').length > 0){
|
||||
store.unloadAll('condition');
|
||||
}
|
||||
},
|
||||
|
||||
model(params) {
|
||||
var checkinId = params.checkin_id;
|
||||
var stepId = `${this.routeName.split('.')[0]}-${params.step_key}`;
|
||||
|
||||
return RSVP.hash({
|
||||
stepId,
|
||||
checkin: this.store.findRecord('checkin', checkinId),
|
||||
});
|
||||
},
|
||||
|
||||
afterModel(model) {
|
||||
set(this, 'stepsService.checkin', model.checkin);
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user