From c7beecd8e382cf64da6839347c7e1512dcd41499 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Mon, 9 May 2016 13:05:16 -0400 Subject: [PATCH] Deprecation: `somethingBinding` is deprecated in newer embers --- .../discourse/components/category-chooser.js.es6 | 1 - .../javascripts/discourse/helpers/bound-i18n.js.es6 | 1 - app/assets/javascripts/discourse/lib/utilities.js | 12 ------------ .../discourse/templates/modal/history.hbs | 2 +- app/assets/javascripts/discourse/templates/topic.hbs | 2 +- app/assets/javascripts/discourse/views/topic.js.es6 | 6 +++--- app/assets/javascripts/discourse/views/user.js.es6 | 1 - 7 files changed, 5 insertions(+), 20 deletions(-) diff --git a/app/assets/javascripts/discourse/components/category-chooser.js.es6 b/app/assets/javascripts/discourse/components/category-chooser.js.es6 index 110785db144..ddc8aad2b0b 100644 --- a/app/assets/javascripts/discourse/components/category-chooser.js.es6 +++ b/app/assets/javascripts/discourse/components/category-chooser.js.es6 @@ -7,7 +7,6 @@ import PermissionType from 'discourse/models/permission-type'; export default ComboboxView.extend({ classNames: ['combobox category-combobox'], dataAttributes: ['id', 'description_text'], - valueBinding: Ember.Binding.oneWay('source'), overrideWidths: true, castInteger: true, diff --git a/app/assets/javascripts/discourse/helpers/bound-i18n.js.es6 b/app/assets/javascripts/discourse/helpers/bound-i18n.js.es6 index 8ce28a51043..4061a474d4d 100644 --- a/app/assets/javascripts/discourse/helpers/bound-i18n.js.es6 +++ b/app/assets/javascripts/discourse/helpers/bound-i18n.js.es6 @@ -1,4 +1,3 @@ Ember.Handlebars.registerBoundHelper("boundI18n", function(property, options) { return new Handlebars.SafeString(I18n.t(property, options.hash)); }); - diff --git a/app/assets/javascripts/discourse/lib/utilities.js b/app/assets/javascripts/discourse/lib/utilities.js index 8e85d1c796e..374cfbaf492 100644 --- a/app/assets/javascripts/discourse/lib/utilities.js +++ b/app/assets/javascripts/discourse/lib/utilities.js @@ -27,18 +27,6 @@ Discourse.Utilities = { return size; }, - /** - Allows us to supply bindings without "binding" to a helper. - **/ - normalizeHash: function(hash, hashTypes) { - for (var prop in hash) { - if (hashTypes[prop] === 'ID') { - hash[prop + 'Binding'] = hash[prop]; - delete hash[prop]; - } - } - }, - // Handlebars no longer allows spaces in its `escapeExpression` code which makes it // unsuitable for many of Discourse's uses. Use `Handlebars.Utils.escapeExpression` // when escaping an attribute in HTML, otherwise this one will do. diff --git a/app/assets/javascripts/discourse/templates/modal/history.hbs b/app/assets/javascripts/discourse/templates/modal/history.hbs index 47b3f36a270..e9820aab8fd 100644 --- a/app/assets/javascripts/discourse/templates/modal/history.hbs +++ b/app/assets/javascripts/discourse/templates/modal/history.hbs @@ -5,7 +5,7 @@ {{d-button action="loadPreviousVersion" icon="backward" title="post.revisions.controls.previous" disabled=loadPreviousDisabled}}
{{#conditional-loading-spinner condition=loading size="small"}} - {{boundI18n revisionsTextKey previousBinding="previousVersion" currentBinding="model.current_version" totalBinding="model.version_count"}} + {{boundI18n revisionsTextKey previous=previousVersion current=model.current_version total=model.version_count}} {{/conditional-loading-spinner}}
{{d-button action="loadNextVersion" icon="forward" title="post.revisions.controls.next" disabled=loadNextDisabled}} diff --git a/app/assets/javascripts/discourse/templates/topic.hbs b/app/assets/javascripts/discourse/templates/topic.hbs index f785b0bce69..0cd943b0267 100644 --- a/app/assets/javascripts/discourse/templates/topic.hbs +++ b/app/assets/javascripts/discourse/templates/topic.hbs @@ -20,7 +20,7 @@ {{text-field id="edit-title" value=buffered.title maxlength=siteSettings.max_topic_title_length autofocus="true"}} {{#if showCategoryChooser}}
- {{category-chooser valueAttribute="id" value=buffered.category_id source=buffered.category_id}} + {{category-chooser valueAttribute="id" value=buffered.category_id}} {{/if}} {{#if canEditTags}} diff --git a/app/assets/javascripts/discourse/views/topic.js.es6 b/app/assets/javascripts/discourse/views/topic.js.es6 index 08175db3006..67ac67af069 100644 --- a/app/assets/javascripts/discourse/views/topic.js.es6 +++ b/app/assets/javascripts/discourse/views/topic.js.es6 @@ -5,9 +5,9 @@ import Scrolling from 'discourse/mixins/scrolling'; const TopicView = Ember.View.extend(AddCategoryClass, AddArchetypeClass, Scrolling, { templateName: 'topic', - topicBinding: 'controller.model', + topic: Ember.computed.alias('controller.model'), - userFilters: Ember.computed.alias('controller.model.userFilters'), + userFilters: Ember.computed.alias('topic.userFilters'), classNameBindings: ['controller.multiSelect:multi-select', 'topic.archetype', 'topic.is_warning', @@ -119,7 +119,7 @@ const TopicView = Ember.View.extend(AddCategoryClass, AddArchetypeClass, Scrolli this.set("offset", offset); - const topic = this.get('controller.model'); + const topic = this.get('topic'); const showTopic = this.showTopicInHeader(topic, offset); if (showTopic !== this._lastShowTopic) { this._lastShowTopic = showTopic; diff --git a/app/assets/javascripts/discourse/views/user.js.es6 b/app/assets/javascripts/discourse/views/user.js.es6 index 99ccfdb60e1..2ae0d55a42c 100644 --- a/app/assets/javascripts/discourse/views/user.js.es6 +++ b/app/assets/javascripts/discourse/views/user.js.es6 @@ -2,5 +2,4 @@ import ScrollTop from 'discourse/mixins/scroll-top'; export default Ember.View.extend(ScrollTop, { templateName: 'user/user', - userBinding: 'controller.content' });