diff --git a/app/assets/javascripts/discourse/initializers/deprecations.js.es6 b/app/assets/javascripts/discourse/initializers/deprecations.js.es6 new file mode 100644 index 00000000000..f25c7ec1002 --- /dev/null +++ b/app/assets/javascripts/discourse/initializers/deprecations.js.es6 @@ -0,0 +1,21 @@ +var deprecatedViewHelpers = { + inputTip: 'input-tip' +}; + +export default { + name: 'deprecations', + initialize: function(container) { + Ember.keys(deprecatedViewHelpers).forEach(function(old) { + var newName = deprecatedViewHelpers[old]; + Ember.Handlebars.registerHelper(old, function(options) { + Em.warn("The `" + old +"` helper is deprecated. Use `" + newName + "` instead."); + var helper = container.lookupFactory('view:' + newName); + var hash = options.hash, + types = options.hashTypes; + + Discourse.Utilities.normalizeHash(hash, types); + return Ember.Handlebars.helpers.view.call(this, helper, options); + }); + }); + } +}; diff --git a/app/assets/javascripts/discourse/initializers/view-helpers.js.es6 b/app/assets/javascripts/discourse/initializers/view-helpers.js.es6 new file mode 100644 index 00000000000..97ab6e9116f --- /dev/null +++ b/app/assets/javascripts/discourse/initializers/view-helpers.js.es6 @@ -0,0 +1,21 @@ +var helpers = ['input-tip']; + +/** + Creates view helpers for some views. Many of these should probably be converted + into components in the long term as it's a better fit. +**/ +export default { + name: 'view-hlpers', + initialize: function(container) { + helpers.forEach(function(h) { + Ember.Handlebars.registerHelper(h, function(options) { + var helper = container.lookupFactory('view:' + h); + var hash = options.hash, + types = options.hashTypes; + + Discourse.Utilities.normalizeHash(hash, types); + return Ember.Handlebars.helpers.view.call(this, helper, options); + }); + }); + } +}; diff --git a/app/assets/javascripts/discourse/templates/modal/create_account.js.handlebars b/app/assets/javascripts/discourse/templates/modal/create_account.js.handlebars index 0c0ecf277a4..4dfa9d191ae 100644 --- a/app/assets/javascripts/discourse/templates/modal/create_account.js.handlebars +++ b/app/assets/javascripts/discourse/templates/modal/create_account.js.handlebars @@ -7,7 +7,7 @@