Last active
August 29, 2015 14:28
-
-
Save levibrown/a724abc74b7640306646 to your computer and use it in GitHub Desktop.
new serializer test
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 ActiveModelAdapter from 'active-model-adapter'; | |
import ENV from 'self-storage-search/config/environment'; | |
export default ActiveModelAdapter.extend({ | |
host: 'http://g5-inventory.herokuapp.com/', | |
namespace: 'api/v1' | |
}); |
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 ApplicationAdapter from './application'; | |
export default ApplicationAdapter.extend({ | |
primaryKey: 'client_id' | |
}); |
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({ | |
}); |
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'; | |
export default DS.Model.extend({ | |
name: DS.attr('string') | |
}); |
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'; | |
export default DS.Model.extend({ | |
name: DS.attr('string'), | |
state_id: DS.belongsTo('state', { async: false }), | |
searches: DS.belongsTo('search', { async: false }) | |
}); |
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 Ember from 'ember'; | |
export default DS.Model.extend({ | |
states: DS.hasMany('states', { async: false }), | |
cities: DS.hasMany('cities', { async: false }), | |
categories: DS.hasMany('categories', { async: false }), | |
codes: Ember.computed('states', 'cities', function(){ | |
var Code = Ember.Object.extend({}); | |
var codes = Ember.A([]); | |
this.get('states').forEach(function(state){ | |
// states to state match | |
codes.pushObject(Code.create({ | |
loc: state.get('name'), | |
state: state.get('name') | |
})); | |
state.get('cities').forEach(function(city){ | |
// city to city/state | |
codes.pushObject(Code.create({ | |
loc: city.get('name') + ", " + state.get('name'), | |
state: state.get('name'), | |
city: city.get('name') | |
})); | |
}); | |
}); | |
return codes; | |
}), | |
codesSorting: ['state', 'city'], | |
completes: Ember.computed.sort('codes', 'codesSorting') | |
}); |
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'; | |
export default DS.Model.extend({ | |
name: DS.attr('string'), | |
cities: DS.hasMany('cities', { async: false }), | |
searches: DS.belongsTo('search', { async: false }) | |
}); |
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'; | |
var Router = Ember.Router.extend({ | |
location: config.locationType | |
}); | |
Router.map(function() { | |
this.route('search', { path: "/" }); | |
}); | |
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({ | |
model: function(){ | |
return this.store.find('search', 1); | |
} | |
}); |
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.4.8", | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/1.13.8/ember.js", | |
"ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/1.13.9/ember-data.js", | |
"ember-template-compiler": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/1.13.8/ember-template-compiler.js", | |
"active-model-adapter": "1.13.6" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment