Skip to content

Commit

Permalink
Switch to es5 getters
Browse files Browse the repository at this point in the history
  • Loading branch information
Kenneth Larsen committed Mar 24, 2018
1 parent e1564e5 commit b8dcb5e
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 22 deletions.
8 changes: 3 additions & 5 deletions app/components/list-filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@ export default Component.extend({

init() {
this._super(...arguments);
this.get('filter')('').then((allResults) => this.set('results', allResults.results));
this.filter('').then((allResults) => this.set('results', allResults.results));
},

actions: {
handleFilterEntry() {
let filterInputValue = this.get('value');
let filterAction = this.get('filter');
filterAction(filterInputValue).then((resultsObj) => {
if (resultsObj.query === this.get('value')) {
this.filter(this.value).then((resultsObj) => {
if (resultsObj.query === this.value) {
this.set('results', resultsObj.results);
}
});
Expand Down
3 changes: 1 addition & 2 deletions app/components/location-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ export default Component.extend({

didInsertElement() {
this._super(...arguments);
let location = this.get('location');
let mapElement = this.get('maps').getMapElement(location);
let mapElement = this.maps.getMapElement(this.location);
this.$('.map-container').append(mapElement);
}
});
4 changes: 2 additions & 2 deletions app/controllers/rentals.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ export default Controller.extend({
actions: {
filterByCity(param) {
if (param !== '') {
return this.get('store').query('rental', { city: param }).then((filteredResults) => {
return this.store.query('rental', { city: param }).then((filteredResults) => {
return { query: param, results: filteredResults };
});
} else {
return this.get('store').findAll('rental').then((results) => {
return this.store.findAll('rental').then((results) => {
return { query: param, results: results };
});
}
Expand Down
2 changes: 1 addition & 1 deletion app/routes/rentals/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import Route from '@ember/routing/route';

export default Route.extend({
model() {
return this.get('store').findAll('rental');
return this.store.findAll('rental');
}
});
2 changes: 1 addition & 1 deletion app/routes/rentals/show.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import Route from '@ember/routing/route';

export default Route.extend({
model(params) {
return this.get('store').findRecord('rental', params.rental_id);
return this.store.findRecord('rental', params.rental_id);
}
});
6 changes: 3 additions & 3 deletions app/services/maps.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import MapUtil from '../utils/google-maps';

export default Service.extend({
init() {
if (!this.get('cachedMaps')) {
if (!this.cachedMaps) {
this.set('cachedMaps', EmberObject.create());
}
if (!this.get('mapUtil')) {
if (!this.mapUtil) {
this.set('mapUtil', MapUtil.create());
}
},
Expand All @@ -18,7 +18,7 @@ export default Service.extend({
let element = this.get(`cachedMaps.${camelizedLocation}`);
if (!element) {
element = this.createMapElement();
this.get('mapUtil').createMap(element, location);
this.mapUtil.createMap(element, location);
this.set(`cachedMaps.${camelizedLocation}`, element);
}
return element;
Expand Down
2 changes: 1 addition & 1 deletion app/utils/google-maps.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default EmberObject.extend({
},

pinLocation(location, map) {
this.get('geocoder').geocode({address: location}, (result, status) => {
this.geocoder.geocode({address: location}, (result, status) => {
if (status === google.maps.GeocoderStatus.OK) {
let coordinates = result[0].geometry.location;
let position = { lat: coordinates.lat(), lng: coordinates.lng() };
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"ember-maybe-import-regenerator": "^0.1.6",
"ember-resolver": "^4.0.0",
"ember-simple-google-maps": "^1.0.0",
"ember-source": "~3.0.0",
"ember-source": "~3.1.0-beta",
"eslint-plugin-ember": "^5.0.0",
"loader.js": "^4.2.3"
},
Expand Down
12 changes: 6 additions & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2816,9 +2816,9 @@ ember-simple-google-maps@^1.0.0:
dependencies:
ember-cli-babel "^6.0.0"

ember-source@~3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/ember-source/-/ember-source-3.0.0.tgz#51811cae98d2ceec53bcfbaa876d02b2b5b2159f"
ember-source@~3.1.0-beta:
version "3.1.0-beta.5"
resolved "https://registry.yarnpkg.com/ember-source/-/ember-source-3.1.0-beta.5.tgz#c6f66294c228bbff877fefa7a918aad5a1d0343d"
dependencies:
broccoli-funnel "^2.0.1"
broccoli-merge-trees "^2.0.0"
Expand All @@ -2831,8 +2831,8 @@ ember-source@~3.0.0:
ember-cli-version-checker "^2.1.0"
ember-router-generator "^1.2.3"
inflection "^1.12.0"
jquery "^3.2.1"
resolve "^1.3.3"
jquery "^3.3.1"
resolve "^1.5.0"

encodeurl@~1.0.1:
version "1.0.2"
Expand Down Expand Up @@ -4262,7 +4262,7 @@ [email protected]:
editions "^1.1.1"
textextensions "1 || 2"

jquery@^3.2.1:
jquery@^3.3.1:
version "3.3.1"
resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.3.1.tgz#958ce29e81c9790f31be7792df5d4d95fc57fbca"

Expand Down

0 comments on commit b8dcb5e

Please sign in to comment.