From 1136af5b7460352a365a793aa596a74813992937 Mon Sep 17 00:00:00 2001 From: jelhan Date: Wed, 19 Aug 2015 22:24:20 +0200 Subject: [PATCH] remove deprecation: COMPUTED PROPERTIES WITH A SHARED GETTER AND SETTER http://emberjs.com/deprecations/v1.x/#toc_computed-properties-with-a-shared-getter-and-setter --- app/controllers/create/options.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/app/controllers/create/options.js b/app/controllers/create/options.js index 48dc986..5e16d32 100644 --- a/app/controllers/create/options.js +++ b/app/controllers/create/options.js @@ -71,9 +71,13 @@ export default Ember.Controller.extend(EmberValidations.Mixin, { /* * maps optionsDates for bootstrap datepicker as a simple array of date objects */ - optionsBootstrapDatepicker: function(key, value) { - // setter - if (arguments.length > 1) { + optionsBootstrapDatepicker: Ember.computed('optionsDates', { + get: function() { + return this.get('optionsDates').map(function(item){ + return item.title; + }); + }, + set: function(key, value) { var newOptionsDates = []; if(Ember.isArray(value) && value.length > 0) { newOptionsDates = value.map(function(item) { @@ -81,13 +85,10 @@ export default Ember.Controller.extend(EmberValidations.Mixin, { }); } this.set('optionsDates', newOptionsDates); - } - // getter - return this.get('optionsDates').map(function(item){ - return item.title; - }); - }.property('optionsDates'), + return value; + }, + }), validations: { enoughOptions: {