mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Import Ember.on
from @ember/object/evented (#8268)
* DEV: Import `Ember.on` from @ember/object/evented * Dont import "on" outsie of the js or admin app * Fixed error when resolving merge conflicts
This commit is contained in:
parent
d8f7f363cd
commit
02a886ce13
@ -1,6 +1,7 @@
|
||||
import Component from "@ember/component";
|
||||
import loadScript from "discourse/lib/load-script";
|
||||
import { observes } from "ember-addons/ember-computed-decorators";
|
||||
import { on } from "@ember/object/evented";
|
||||
|
||||
export default Component.extend({
|
||||
mode: "css",
|
||||
@ -49,7 +50,7 @@ export default Component.extend({
|
||||
}
|
||||
},
|
||||
|
||||
_destroyEditor: Ember.on("willDestroyElement", function() {
|
||||
_destroyEditor: on("willDestroyElement", function() {
|
||||
if (this._editor) {
|
||||
this._editor.destroy();
|
||||
this._editor = null;
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { alias, oneWay } from "@ember/object/computed";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import { categoryLinkHTML } from "discourse/helpers/category-link";
|
||||
import { on } from "@ember/object/evented";
|
||||
import Mixin from "@ember/object/mixin";
|
||||
|
||||
const CUSTOM_TYPES = [
|
||||
@ -91,7 +92,7 @@ export default Mixin.create({
|
||||
return settingDefault !== bufferedValue;
|
||||
},
|
||||
|
||||
_watchEnterKey: Ember.on("didInsertElement", function() {
|
||||
_watchEnterKey: on("didInsertElement", function() {
|
||||
$(this.element).on("keydown.setting-enter", ".input-setting-string", e => {
|
||||
if (e.keyCode === 13) {
|
||||
// enter key
|
||||
@ -100,7 +101,7 @@ export default Mixin.create({
|
||||
});
|
||||
}),
|
||||
|
||||
_removeBindings: Ember.on("willDestroyElement", function() {
|
||||
_removeBindings: on("willDestroyElement", function() {
|
||||
$(this.element).off("keydown.setting-enter");
|
||||
}),
|
||||
|
||||
|
@ -49,6 +49,7 @@ var define, requirejs;
|
||||
},
|
||||
"@ember/object/mixin": { default: Ember.Mixin },
|
||||
"@ember/object/proxy": { default: Ember.ObjectProxy },
|
||||
"@ember/object/evented": { on: Ember.on },
|
||||
"@ember/routing/route": { default: Ember.Route },
|
||||
"@ember/runloop": {
|
||||
bind: Ember.run.bind,
|
||||
|
@ -3,6 +3,7 @@ import { ajax } from "discourse/lib/ajax";
|
||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import UploadMixin from "discourse/mixins/upload";
|
||||
import { on } from "@ember/object/evented";
|
||||
|
||||
export default Component.extend(UploadMixin, {
|
||||
tagName: "span",
|
||||
@ -35,7 +36,7 @@ export default Component.extend(UploadMixin, {
|
||||
};
|
||||
},
|
||||
|
||||
_init: Ember.on("didInsertElement", function() {
|
||||
_init: on("didInsertElement", function() {
|
||||
const $upload = $(this.element);
|
||||
|
||||
$upload.on("fileuploadadd", (e, data) => {
|
||||
|
@ -1,6 +1,7 @@
|
||||
import Component from "@ember/component";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import UploadMixin from "discourse/mixins/upload";
|
||||
import { on } from "@ember/object/evented";
|
||||
|
||||
export default Component.extend(UploadMixin, {
|
||||
type: "csv",
|
||||
@ -32,7 +33,7 @@ export default Component.extend(UploadMixin, {
|
||||
return { autoUpload: false };
|
||||
},
|
||||
|
||||
_init: Ember.on("didInsertElement", function() {
|
||||
_init: on("didInsertElement", function() {
|
||||
const $upload = $(this.element);
|
||||
|
||||
$upload.on("fileuploadadd", (e, data) => {
|
||||
|
@ -1,5 +1,7 @@
|
||||
import { later } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import { on } from "@ember/object/evented";
|
||||
|
||||
export default Component.extend({
|
||||
action: "showCreateAccount",
|
||||
|
||||
@ -15,7 +17,7 @@ export default Component.extend({
|
||||
}
|
||||
},
|
||||
|
||||
_turnOffIfHidden: Ember.on("willDestroyElement", function() {
|
||||
_turnOffIfHidden: on("willDestroyElement", function() {
|
||||
if (this.session.get("hideSignupCta")) {
|
||||
this.session.set("showSignupCta", false);
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import computed from "ember-addons/ember-computed-decorators";
|
||||
import { bufferedRender } from "discourse-common/lib/buffered-render";
|
||||
import { findRawTemplate } from "discourse/lib/raw-templates";
|
||||
import { wantsNewWindow } from "discourse/lib/intercept-click";
|
||||
import { on } from "@ember/object/evented";
|
||||
|
||||
export function showEntrance(e) {
|
||||
let target = $(e.target);
|
||||
@ -204,7 +205,7 @@ export const ListItemDefaults = {
|
||||
$topic.on("animationend", () => $topic.removeClass("highlighted"));
|
||||
},
|
||||
|
||||
_highlightIfNeeded: Ember.on("didInsertElement", function() {
|
||||
_highlightIfNeeded: on("didInsertElement", function() {
|
||||
// highlight the last topic viewed
|
||||
if (this.session.get("lastTopicIdViewed") === this.get("topic.id")) {
|
||||
this.session.set("lastTopicIdViewed", null);
|
||||
|
@ -6,6 +6,7 @@ import {
|
||||
observes
|
||||
} from "ember-addons/ember-computed-decorators";
|
||||
import LoadMore from "discourse/mixins/load-more";
|
||||
import { on } from "@ember/object/evented";
|
||||
|
||||
export default Component.extend(LoadMore, {
|
||||
tagName: "table",
|
||||
@ -16,7 +17,7 @@ export default Component.extend(LoadMore, {
|
||||
// Overwrite this to perform client side filtering of topics, if desired
|
||||
filteredTopics: alias("topics"),
|
||||
|
||||
_init: Ember.on("init", function() {
|
||||
_init: on("init", function() {
|
||||
this.addObserver("hideCategory", this.rerender);
|
||||
this.addObserver("order", this.rerender);
|
||||
this.addObserver("ascending", this.rerender);
|
||||
|
@ -7,9 +7,10 @@ import DiscourseURL from "discourse/lib/url";
|
||||
import Draft from "discourse/models/draft";
|
||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||
import { getOwner } from "discourse-common/lib/get-owner";
|
||||
import { on } from "@ember/object/evented";
|
||||
|
||||
export default Component.extend(LoadMore, {
|
||||
_initialize: Ember.on("init", function() {
|
||||
_initialize: on("init", function() {
|
||||
const filter = this.get("stream.filter");
|
||||
if (filter) {
|
||||
this.set("classNames", [
|
||||
@ -27,7 +28,7 @@ export default Component.extend(LoadMore, {
|
||||
schedule("afterRender", () => $(document).scrollTop(0));
|
||||
}.observes("stream.user.id"),
|
||||
|
||||
_inserted: Ember.on("didInsertElement", function() {
|
||||
_inserted: on("didInsertElement", function() {
|
||||
this.bindScrolling({ name: "user-stream-view" });
|
||||
|
||||
$(window).on("resize.discourse-on-scroll", () => this.scrolled());
|
||||
@ -43,7 +44,7 @@ export default Component.extend(LoadMore, {
|
||||
}),
|
||||
|
||||
// This view is being removed. Shut down operations
|
||||
_destroyed: Ember.on("willDestroyElement", function() {
|
||||
_destroyed: on("willDestroyElement", function() {
|
||||
this.unbindScrolling("user-stream-view");
|
||||
$(window).unbind("resize.discourse-on-scroll");
|
||||
$(this.element).off("click.details-disabled", "details.disabled");
|
||||
|
@ -1,12 +1,14 @@
|
||||
import { on } from "@ember/object/evented";
|
||||
import Mixin from "@ember/object/mixin";
|
||||
|
||||
// Include this mixin if you want to be notified when the dom should be
|
||||
// cleaned (usually on route change.)
|
||||
export default Mixin.create({
|
||||
_initializeChooser: Ember.on("didInsertElement", function() {
|
||||
_initializeChooser: on("didInsertElement", function() {
|
||||
this.appEvents.on("dom:clean", this, "cleanUp");
|
||||
}),
|
||||
|
||||
_clearChooser: Ember.on("willDestroyElement", function() {
|
||||
_clearChooser: on("willDestroyElement", function() {
|
||||
this.appEvents.off("dom:clean", this, "cleanUp");
|
||||
})
|
||||
});
|
||||
|
@ -4,6 +4,7 @@ import {
|
||||
} from "discourse/lib/utilities";
|
||||
|
||||
import getUrl from "discourse-common/lib/get-url";
|
||||
import { on } from "@ember/object/evented";
|
||||
import Mixin from "@ember/object/mixin";
|
||||
|
||||
export default Mixin.create({
|
||||
@ -35,7 +36,7 @@ export default Mixin.create({
|
||||
return {};
|
||||
},
|
||||
|
||||
_initialize: Ember.on("didInsertElement", function() {
|
||||
_initialize: on("didInsertElement", function() {
|
||||
const $upload = $(this.element);
|
||||
const reset = () =>
|
||||
this.setProperties({ uploading: false, uploadProgress: 0 });
|
||||
@ -105,7 +106,7 @@ export default Mixin.create({
|
||||
});
|
||||
}),
|
||||
|
||||
_destroy: Ember.on("willDestroyElement", function() {
|
||||
_destroy: on("willDestroyElement", function() {
|
||||
this.messageBus && this.messageBus.unsubscribe("/uploads/" + this.type);
|
||||
|
||||
const $upload = $(this.element);
|
||||
|
Loading…
Reference in New Issue
Block a user