Last active
August 24, 2016 19:12
-
-
Save NoiseEee/130b26b3a4bdf715ae2900a7d664f243 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 DS from 'ember-data'; | |
import ENV from '../config/environment'; | |
export default DS.JSONAPIAdapter.extend({ | |
host: ENV.apiHost | |
}); |
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
/* jshint node: true */ | |
module.exports = function(environment) { | |
var ENV = { | |
modulePrefix: 'site-tech-check-in', | |
environment: environment, | |
rootURL: '/', | |
locationType: 'auto', | |
apiHost: 'http://api.debian-vm/siteTechCheckIn', | |
EmberENV: { | |
FEATURES: { | |
// Here you can enable experimental features on an ember canary build | |
// e.g. 'with-controller': true | |
} | |
}, | |
APP: { | |
// Here you can pass flags/options to your application instance | |
// when it is created | |
} | |
}; | |
if (environment === 'development') { | |
// ENV.APP.LOG_RESOLVER = true; | |
// ENV.APP.LOG_ACTIVE_GENERATION = true; | |
// ENV.APP.LOG_TRANSITIONS = true; | |
// ENV.APP.LOG_TRANSITIONS_INTERNAL = true; | |
// ENV.APP.LOG_VIEW_LOOKUPS = true; | |
} | |
if (environment === 'test') { | |
// Testem prefers this... | |
ENV.locationType = 'none'; | |
ENV.apiHost = ''; | |
// keep test console output quieter | |
ENV.APP.LOG_ACTIVE_GENERATION = false; | |
ENV.APP.LOG_VIEW_LOOKUPS = false; | |
ENV.APP.rootElement = '#ember-testing'; | |
} | |
if (environment === 'production') { | |
ENV.apiHost = 'https://api.realSite.com/siteTechCheckIn'; | |
} | |
return ENV; | |
}; |
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' | |
}); |
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 Model from "ember-data/model"; | |
import attr from "ember-data/attr"; | |
import { belongsTo, hasMany } from "ember-data/relationships"; | |
export default Model.extend({ | |
firstName: DS.attr(), | |
lastName: DS.attr(), | |
fullName: Ember.computed('firstName','lastName', function() { | |
return `${this.get('firstName')} ${this.get('lastName')}`; | |
}), | |
equipmentItems: DS.hasMany('equipment-item'), | |
jobs: DS.hasMany('job'), | |
key: DS.attr() | |
}); |
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 Model from "ember-data/model"; | |
import attr from "ember-data/attr"; | |
import { belongsTo, hasMany } from "ember-data/relationships"; | |
export default Model.extend({ | |
name: DS.attr(), | |
key: DS.attr(), | |
shortName: DS.attr(), | |
isScanner: DS.attr('boolean'), | |
isLaser: DS.attr('boolean'), | |
inventoryCount: DS.attr('number'), | |
admin: DS.belongsTo('admin') | |
}); |
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 Model from "ember-data/model"; | |
import attr from "ember-data/attr"; | |
import { belongsTo, hasMany } from "ember-data/relationships"; | |
export default Model.extend({ | |
key: DS.attr(), | |
client: DS.attr(), | |
contact: DS.attr(), | |
address: DS.attr(), | |
jobNumber: DS.attr(), | |
admin: DS.belongsTo('admin') | |
}); |
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 Model from "ember-data/model"; | |
import attr from "ember-data/attr"; | |
import { belongsTo, hasMany } from "ember-data/relationships"; | |
export default Model.extend({ | |
key: DS.attr(), | |
name: DS.attr(), | |
subtext: DS.attr(), | |
answerRequired: DS.attr('boolean'), | |
allowMultipleAnswers: DS.attr('boolean'), | |
displayOrder: DS.attr('number'), | |
preAnswersHint: DS.attr('string'), | |
postAnswersHint: DS.attr('string'), | |
placeholder: DS.attr(), | |
answerOptions: DS.attr(), | |
selectedAnswer: DS.attr(), | |
section: DS.belongsTo('survey-section') | |
}); |
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 Model from "ember-data/model"; | |
import attr from "ember-data/attr"; | |
import { belongsTo, hasMany } from "ember-data/relationships"; | |
export default Model.extend({ | |
name: DS.attr(), | |
text: DS.attr(), | |
isRequired: DS.attr('boolean'), | |
displayOrder: DS.attr(), | |
survey: DS.belongsTo('survey'), | |
questions: DS.hasMany('question') | |
}); |
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 Model from "ember-data/model"; | |
import attr from "ember-data/attr"; | |
import { belongsTo, hasMany } from "ember-data/relationships"; | |
export default Model.extend({ | |
name: DS.attr(), | |
instructions: DS.attr(), | |
type: DS.attr(), | |
key: DS.attr(), | |
sections: DS.hasMany('survey-section') | |
}); |
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'; | |
import config from './config/environment'; | |
const Router = Ember.Router.extend({ | |
location: 'none', | |
rootURL: config.rootURL | |
}); | |
Router.map(function() { | |
this.route('surveys', function() { | |
this.route('survey', { path: ':id'}); | |
}); | |
}); | |
export default Router; |
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.Route.extend({ | |
beforeModel() { | |
this.transitionTo('surveys'); | |
} | |
}); |
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.Route.extend({ | |
model() { | |
return this.store.findAll('survey'); | |
}, | |
redirect(model) { | |
if(model.get('length') === 1) { | |
this.transitionTo('surveys.survey', model.get('firstObject')); | |
} | |
} | |
}); |
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'; | |
import RSVP from 'rsvp'; | |
export default Ember.Route.extend({ | |
model(params) { | |
return RSVP.hash({ | |
survey: this.get('store').findRecord('survey', params.id), | |
sections: this.get('store').findAll('survey-section', params.id) | |
}); | |
/* | |
console.log('Model hook called for `surveys.survey` with ', params.id); | |
var survey = this.get('store').findRecord('survey', params.id); | |
return survey; | |
*/ | |
} | |
}); |
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.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