This repository has been archived by the owner on Oct 4, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Ember CLI Depreciations
Jim edited this page Aug 11, 2015
·
1 revision
A series of real world deprecations one guy saw when updating his app.
/code_js/smores-mgr/app/pods/locations/template.hbs
Before:
{{#each record in this }}
<li class="clearfix">
<span class="text">{{record.name}}</span>
<div class="tools">
{{#link-to "locations.info" record}}{{fa-icon "folder-open-o"}}{{/link-to}}
{{#link-to "locations.edit" record}}{{fa-icon "edit"}}{{/link-to}}
</div>
</li>
{{else}}
<li>no records found ... :-(</li>
{{/each}}
After:
{{#each this as |record| }}
<li class="clearfix">
<span class="text">{{record.name}}</span>
<div class="tools">
{{#link-to "locations.info" record}}{{fa-icon "folder-open-o"}}{{/link-to}}
{{#link-to "locations.edit" record}}{{fa-icon "edit"}}{{/link-to}}
</div>
</li>
{{else}}
<li>no records found ... :-(</li>
{{/each}}
/code_js/smores-mgr/app/pods/components/form-wizard/template.hbs
Before:
{{#each steps as |step| }}
{{wizard-step name=step.step activeIndex=activeIndex index=_view.contentIndex}}
{{/each}}
After:
{{#each steps as |step index| }}
{{wizard-step name=step.step activeIndex=activeIndex index=index}}
{{/each}}
Before
{{view "select"
content=genders
selection=model.gender
optionValuePath="content"
optionLabelPath="content"
prompt="Select"
class="form-control"}}
After
ember install emberx-select
...
{{x-select
content=genders
selection=model.gender
optionValuePath="content"
optionLabelPath="content"
prompt="Select"
class="form-control"}}
Async from server/store | Sync from store | Query server | |
---|---|---|---|
Single Record | findRecord(type,id) |
peekRecord(type, id) |
queryRecord(type, {query}) |
All Records | findAll(type) |
peekAll(type) |
query(type, {query})* |
The first argument to store.find() is always the record type. The optional second argument determines if a request is made for all records, a single record, or a query.
return this.store.find('account', 9); // => Get single record
return this.store.find('account'); // => Get all records
return this.store.find('account', {with: 'owners,attendees'}); // => Get list of records
return this.store.find('account', {with: 'owners,attendees', id: 9}); // => Get list of *single* records
/code_js/smores-mgr/app/pods/attendees/info/route.js
Before
model: function (params) {
return this.store.find('attendee', {id: params.attendee_id, with: 'registrations'});
}
After
model: function (params) {
return this.store.query('attendee', {id: params.attendee_id, with: 'registrations'});
}
/code_js/smores-mgr/app/pods/events/list/route.js
Before
model: function (params) {
...
return Ember.RSVP.hash({
...
locations: this.store.find('location'),
programs: this.store.find('program'),
sessions: this.store.find('session'),
cabins: this.store.find('cabin')
});
},
After
model: function (params) {
...
return Ember.RSVP.hash({
...
locations: this.store.findAll('location'),
programs: this.store.findAll('program'),
sessions: this.store.findAll('session'),
cabins: this.store.findAll('cabin')
});
},
Before
var posts = this.store.all('post'); // => no network request
After
var posts = this.store.peekAll('post'); // => no network request
Before
???
After
var post = this.store.peekRecord('post', 1); // => no network request
/code_js/smores-mgr/app/pods/registrations/add/step2/controller.js
Before
needs: ['registrations/add/step1'],
step1: Ember.computed.alias("controllers.registrations/add/step1"),
After
step1: Ember.inject.controller('registrations/add/step1'),