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'; | |
// this doesn't work in Ember Twiddle | |
// import { testing } = Ember; | |
export default Ember.Component.extend({ | |
actions: { | |
filesSelected(event) { | |
// this doesn't work in Ember Twiddle | |
// const files = testing ? event.testingFiles : event.target.files; |
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'; | |
const { | |
run: { | |
bind | |
} | |
} = Ember; | |
export default Ember.Component.extend({ | |
label: 'choose a file', |
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({ | |
change(event) { | |
const files = event.target.files; | |
if (files.length === 0) { | |
Ember.Logger.log('you must add a file'); | |
} else if (files.length > 0) { | |
this.sendAction('action', files); | |
} |
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'; | |
const { | |
run: { | |
bind | |
} | |
} = Ember; | |
export default Ember.Component.extend({ | |
label: 'choose a file', |
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'; | |
const { | |
run: { | |
bind | |
} | |
} = Ember; | |
export default Ember.Component.extend({ | |
label: 'choose a file', |
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 { isAjaxError, isUnauthorizedError } from 'ember-ajax/errors'; | |
export default Ember.Controller.extend({ | |
ajax: Ember.inject.service(), | |
message: null, | |
actions: { | |
loadAjax(url) { |
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
export default function() { | |
this.get('/videos', (schema) => { | |
return schema.videos.all(); | |
}); | |
this.get('/users/:id', (schema, request) => { | |
const id = request.params.id; | |
return schema.users.find(id); | |
}); | |
} |
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 DS from "ember-data"; | |
export default DS.JSONAPIAdapter.extend(); |
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.Route.extend({ | |
model() { | |
return this.store.createRecord('model').subset().then( response => { | |
this.store.pushPayload(response); | |
// we must also manually loop through items and return them as an array | |
// or use the ds-pushpayload-return feature flag until | |
// https://github.com/emberjs/data/pull/4110 is enabled by default |
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 DS from 'ember-data'; | |
import Ember from 'ember'; | |
import { memberAction, collectionAction } from 'ember-api-actions'; | |
export default DS.Model.extend({ | |
subset: collectionAction({ path: 'subset', type: 'get' }) | |
}); |