diff --git a/app/assets/javascripts/admin/templates/flags.js.handlebars b/app/assets/javascripts/admin/templates/flags.js.handlebars index 77e830f40cf..fdd1b627a41 100644 --- a/app/assets/javascripts/admin/templates/flags.js.handlebars +++ b/app/assets/javascripts/admin/templates/flags.js.handlebars @@ -42,7 +42,7 @@

{{#if flaggedPost.topic.isPrivateMessage}} - {{icon envelope}} + {{fa-icon envelope}} {{/if}} {{topic-status topic=flaggedPost.topic}} {{flaggedPost.topic.title}} diff --git a/app/assets/javascripts/discourse/helpers/application_helpers.js b/app/assets/javascripts/discourse/helpers/application_helpers.js index f34ab5cb2c6..4de1ceea777 100644 --- a/app/assets/javascripts/discourse/helpers/application_helpers.js +++ b/app/assets/javascripts/discourse/helpers/application_helpers.js @@ -199,22 +199,3 @@ Handlebars.registerHelper('link-domain', function(property, options) { } } }); - -/** - Renders a font-awesome icon with an optional i18n string as hidden text for - screen readers. - - @method icon - @for Handlebars -**/ -Handlebars.registerHelper('icon', function(icon, options) { - var labelKey, html; - if (options.hash) { labelKey = options.hash.label; } - html = ""; - } - return new safe(html); -}); diff --git a/app/assets/javascripts/discourse/helpers/category-link.js.es6 b/app/assets/javascripts/discourse/helpers/category-link.js.es6 index 7a7c73a2dd4..f206a4a9847 100644 --- a/app/assets/javascripts/discourse/helpers/category-link.js.es6 +++ b/app/assets/javascripts/discourse/helpers/category-link.js.es6 @@ -1,5 +1,5 @@ import { categoryLinkHTML } from 'discourse/lib/html-builder'; -export default Handlebars.registerHelper('category-link', function(property, options) { +Handlebars.registerHelper('category-link', function(property, options) { return categoryLinkHTML(Ember.Handlebars.get(this, property, options), options); }); diff --git a/app/assets/javascripts/discourse/helpers/fa-icon.js.es6 b/app/assets/javascripts/discourse/helpers/fa-icon.js.es6 new file mode 100644 index 00000000000..25ac7aebce7 --- /dev/null +++ b/app/assets/javascripts/discourse/helpers/fa-icon.js.es6 @@ -0,0 +1,12 @@ +Handlebars.registerHelper('fa-icon', function(icon, options) { + var labelKey; + if (options.hash) { labelKey = options.hash.label; } + + var html = ""; + } + return new Handlebars.SafeString(html); +}); diff --git a/app/assets/javascripts/discourse/helpers/shorten-text.js.es6 b/app/assets/javascripts/discourse/helpers/shorten-text.js.es6 index cfa0f8d9655..fb1c18be7a5 100644 --- a/app/assets/javascripts/discourse/helpers/shorten-text.js.es6 +++ b/app/assets/javascripts/discourse/helpers/shorten-text.js.es6 @@ -1,3 +1,3 @@ -export default Handlebars.registerHelper('shorten-text', function(property, options) { +Handlebars.registerHelper('shorten-text', function(property, options) { return Ember.Handlebars.get(this, property, options).substring(0,35); }); diff --git a/app/assets/javascripts/discourse/helpers/shorten-url.js.es6 b/app/assets/javascripts/discourse/helpers/shorten-url.js.es6 index 77744acbb4d..9548f47c459 100644 --- a/app/assets/javascripts/discourse/helpers/shorten-url.js.es6 +++ b/app/assets/javascripts/discourse/helpers/shorten-url.js.es6 @@ -1,4 +1,4 @@ -export default Handlebars.registerHelper('shorten-url', function(property, options) { +Handlebars.registerHelper('shorten-url', function(property, options) { var url = Ember.Handlebars.get(this, property, options), matches = url.match(/\//g); @@ -9,4 +9,3 @@ export default Handlebars.registerHelper('shorten-url', function(property, optio url = url.replace(/^www\./, ''); return url.substring(0, 80); }); - diff --git a/app/assets/javascripts/discourse/helpers/topic-link.js.es6 b/app/assets/javascripts/discourse/helpers/topic-link.js.es6 index f4264647c76..fcbeaeb350a 100644 --- a/app/assets/javascripts/discourse/helpers/topic-link.js.es6 +++ b/app/assets/javascripts/discourse/helpers/topic-link.js.es6 @@ -1,4 +1,4 @@ -export default Handlebars.registerHelper('topic-link', function(property, options) { +Handlebars.registerHelper('topic-link', function(property, options) { var topic = Ember.Handlebars.get(this, property, options), title = topic.get('fancy_title'); diff --git a/app/assets/javascripts/discourse/initializers/deprecations.js.es6 b/app/assets/javascripts/discourse/initializers/deprecations.js.es6 index 4227e2f62ce..e13f63c9226 100644 --- a/app/assets/javascripts/discourse/initializers/deprecations.js.es6 +++ b/app/assets/javascripts/discourse/initializers/deprecations.js.es6 @@ -9,6 +9,10 @@ var deprecatedViewHelpers = { 'discourse-activity-filter': 'activity-filter' }; +var renamedHelpers = { + icon: "fa-icon" +}; + export default { name: 'deprecations', initialize: function(container) { @@ -24,5 +28,14 @@ export default { return Ember.Handlebars.helpers.view.call(this, helper, options); }); }); + + Ember.keys(renamedHelpers).forEach(function(old) { + var newName = renamedHelpers[old]; + Ember.Handlebars.registerHelper(old, function() { + Em.warn("The `" + old +"` helper is deprecated. Use `" + newName + "` instead."); + var newHelper = container.lookupFactory('helper:' + newName); + return newHelper.apply(this, Array.prototype.slice.call(arguments)); + }); + }); } }; diff --git a/app/assets/javascripts/discourse/templates/header.js.handlebars b/app/assets/javascripts/discourse/templates/header.js.handlebars index 17986977452..71e4ad35791 100644 --- a/app/assets/javascripts/discourse/templates/header.js.handlebars +++ b/app/assets/javascripts/discourse/templates/header.js.handlebars @@ -11,7 +11,7 @@ {{/if}}

{{#if showPrivateMessageGlyph}} - {{icon envelope}} + {{fa-icon envelope}} {{/if}} {{#if topic.category.parentCategory}} {{bound-category-link topic.category.parentCategory}} @@ -40,14 +40,14 @@ {{/if}} {{/unless}}