diff --git a/app/assets/javascripts/discourse/ember/event_dispatcher.js b/app/assets/javascripts/discourse/ember/event_dispatcher.js deleted file mode 100644 index 7e5cea6fc71..00000000000 --- a/app/assets/javascripts/discourse/ember/event_dispatcher.js +++ /dev/null @@ -1,33 +0,0 @@ -/* - Discourse is not interested in watching `mouseMove` or `touchMove` events on an Ember views, - so we remove them from the events the EventDispatcher watches for. -*/ -Ember.EventDispatcher.reopen({ - events: { - touchstart : 'touchStart', - touchend : 'touchEnd', - touchcancel : 'touchCancel', - keydown : 'keyDown', - keyup : 'keyUp', - keypress : 'keyPress', - mousedown : 'mouseDown', - mouseup : 'mouseUp', - contextmenu : 'contextMenu', - click : 'click', - dblclick : 'doubleClick', - focusin : 'focusIn', - focusout : 'focusOut', - mouseenter : 'mouseEnter', - mouseleave : 'mouseLeave', - submit : 'submit', - input : 'input', - change : 'change', - dragstart : 'dragStart', - drag : 'drag', - dragenter : 'dragEnter', - dragleave : 'dragLeave', - dragover : 'dragOver', - drop : 'drop', - dragend : 'dragEnd' - } -}); diff --git a/app/assets/javascripts/discourse/helpers/grouped_each.js b/app/assets/javascripts/discourse/helpers/grouped-each.js.es6 similarity index 91% rename from app/assets/javascripts/discourse/helpers/grouped_each.js rename to app/assets/javascripts/discourse/helpers/grouped-each.js.es6 index d730ede8f43..b8d80ff400a 100644 --- a/app/assets/javascripts/discourse/helpers/grouped_each.js +++ b/app/assets/javascripts/discourse/helpers/grouped-each.js.es6 @@ -108,8 +108,7 @@ DiscourseGroupedEach.prototype = { } }; - -Ember.Handlebars.registerHelper('groupedEach', function(path, options) { +function groupedEachHelper(path, options) { if (arguments.length === 4) { Ember.assert("If you pass more than one argument to the groupedEach helper, it must be in the form #groupedEach foo in bar", arguments[1] === "in"); @@ -130,4 +129,11 @@ Ember.Handlebars.registerHelper('groupedEach', function(path, options) { options.hash.dataSourceBinding = path; options.data.insideGroup = true; new DiscourseGroupedEach(this, path, options).render(); +} + +Ember.Handlebars.registerHelper('groupedEach', function() { + Em.warn("The `groupedEach` helper is deprecated. Use `grouped-each` instead."); + return groupedEachHelper.apply(this, Array.prototype.slice.apply(arguments)); }); + +Ember.Handlebars.registerHelper('grouped-each', groupedEachHelper); diff --git a/app/assets/javascripts/discourse/initializers/ember-events.js.es6 b/app/assets/javascripts/discourse/initializers/ember-events.js.es6 new file mode 100644 index 00000000000..32302a2133d --- /dev/null +++ b/app/assets/javascripts/discourse/initializers/ember-events.js.es6 @@ -0,0 +1,38 @@ +export default { + name: "ember-events", + + initialize: function () { + + // By default Ember listens to too many events. This tells it the only events + // we're interested in. + Ember.EventDispatcher.reopen({ + events: { + touchstart : 'touchStart', + touchend : 'touchEnd', + touchcancel : 'touchCancel', + keydown : 'keyDown', + keyup : 'keyUp', + keypress : 'keyPress', + mousedown : 'mouseDown', + mouseup : 'mouseUp', + contextmenu : 'contextMenu', + click : 'click', + dblclick : 'doubleClick', + focusin : 'focusIn', + focusout : 'focusOut', + mouseenter : 'mouseEnter', + mouseleave : 'mouseLeave', + submit : 'submit', + input : 'input', + change : 'change', + dragstart : 'dragStart', + drag : 'drag', + dragenter : 'dragEnter', + dragleave : 'dragLeave', + dragover : 'dragOver', + drop : 'drop', + dragend : 'dragEnd' + } + }); + } +}; diff --git a/app/assets/javascripts/discourse/templates/components/basic-topic-list.js.handlebars b/app/assets/javascripts/discourse/templates/components/basic-topic-list.js.handlebars index c002ab2bb2f..1ac50166b70 100644 --- a/app/assets/javascripts/discourse/templates/components/basic-topic-list.js.handlebars +++ b/app/assets/javascripts/discourse/templates/components/basic-topic-list.js.handlebars @@ -17,7 +17,7 @@
- {{#groupedEach topic in topics}} + {{#grouped-each topic in topics}}{{clicks}} @@ -71,7 +71,7 @@ {{link-domain this}} |
@@ -59,7 +59,7 @@
|