Last active
November 28, 2018 19:33
-
-
Save sukima/2495cceafba548c10f0fda6f6d53c817 to your computer and use it in GitHub Desktop.
karakalla example
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.Component.extend({ | |
classNames: ['card', 'rental-card'] | |
}); |
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 { reads } from '@ember/object/computed'; | |
export default Ember.Controller.extend({ | |
queryParams: ['city'], | |
city: '', | |
rentals: reads('model') | |
}); |
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
export default function() { | |
this.get('/rentals', function(schema, request) { | |
let city = request.queryParams.city; | |
return city | |
? schema.rentals.where({ city }) | |
: schema.rentals.all(); | |
}, { timing: 3000 }); | |
} |
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 { Factory } from 'ember-cli-mirage'; | |
export default Factory.extend({ | |
title() { return faker.company.catchPhrase(); }, | |
owner() { return faker.name.findName(); }, | |
city() { return faker.address.city(); }, | |
category: faker.list.random('Estate', 'Appartment', 'Tent'), | |
bedrooms() { return faker.random.number(); }, | |
image() { return faker.image.imageUrl(); }, | |
description() { return faker.lorem.paragraph(); } | |
}); |
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
export default function(server) { | |
server.createList('rental', 10); | |
} |
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({ | |
title: attr('string'), | |
owner: attr('string'), | |
city: attr('string'), | |
category: attr('string'), | |
bedrooms: attr('number'), | |
image: attr('string'), | |
description: 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 Ember from 'ember'; | |
export default Ember.Route.extend({ | |
queryParams: { | |
city: { refreshModel: true } | |
}, | |
model({ city }) { | |
return this.store.query('rental', { city }); | |
} | |
}); |
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.15.1", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"ENV": { | |
"ember-cli-mirage": { | |
"enabled": true | |
} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"hack_css": "https://cdnjs.cloudflare.com/ajax/libs/hack/0.8.0/hack.css", | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js", | |
"ember": "3.4.3", | |
"ember-template-compiler": "3.4.3", | |
"ember-testing": "3.4.3" | |
}, | |
"addons": { | |
"ember-data": "3.4.2", | |
"ember-cli-mirage": "latest" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment