From 80a362554a2a02bada09fcc1b562dc21c0d08272 Mon Sep 17 00:00:00 2001 From: John Cowen Date: Wed, 4 Mar 2020 18:11:23 +0000 Subject: [PATCH] ui: Install ref modifier and use it instead of dom selecting (#7383) --- ui-v2/app/components/phrase-editor.js | 5 ----- ui-v2/app/components/toggle-button.js | 7 ------- ui-v2/app/templates/components/phrase-editor.hbs | 2 +- ui-v2/app/templates/components/toggle-button.hbs | 4 ++-- ui-v2/package.json | 1 + ui-v2/yarn.lock | 7 +++++++ 6 files changed, 11 insertions(+), 15 deletions(-) diff --git a/ui-v2/app/components/phrase-editor.js b/ui-v2/app/components/phrase-editor.js index 6a18652da..bea454784 100644 --- a/ui-v2/app/components/phrase-editor.js +++ b/ui-v2/app/components/phrase-editor.js @@ -6,11 +6,6 @@ export default Component.extend({ dom: service('dom'), classNames: ['phrase-editor'], item: '', - didInsertElement: function() { - this._super(...arguments); - // TODO: use {{ref}} - this.input = this.dom.element('input', this.element); - }, onchange: function(e) {}, search: function(e) { // TODO: Temporarily continue supporting `searchable` diff --git a/ui-v2/app/components/toggle-button.js b/ui-v2/app/components/toggle-button.js index 9ead01679..78edb4348 100644 --- a/ui-v2/app/components/toggle-button.js +++ b/ui-v2/app/components/toggle-button.js @@ -1,6 +1,5 @@ import Component from '@ember/component'; import { inject as service } from '@ember/service'; -import { set } from '@ember/object'; export default Component.extend({ dom: service('dom'), @@ -19,12 +18,6 @@ export default Component.extend({ this.guid = this.dom.guid(this); this._listeners = this.dom.listeners(); }, - didInsertElement: function() { - this._super(...arguments); - // TODO(octane): move to ref - set(this, 'input', this.dom.element(`#toggle-button-${this.guid}`)); - set(this, 'label', this.input.nextElementSibling); - }, willDestroyElement: function() { this._super(...arguments); this._listeners.remove(); diff --git a/ui-v2/app/templates/components/phrase-editor.hbs b/ui-v2/app/templates/components/phrase-editor.hbs index d0e8d5e74..b03553df2 100644 --- a/ui-v2/app/templates/components/phrase-editor.hbs +++ b/ui-v2/app/templates/components/phrase-editor.hbs @@ -7,5 +7,5 @@ \ No newline at end of file diff --git a/ui-v2/app/templates/components/toggle-button.hbs b/ui-v2/app/templates/components/toggle-button.hbs index 5ed486153..ddb47144d 100644 --- a/ui-v2/app/templates/components/toggle-button.hbs +++ b/ui-v2/app/templates/components/toggle-button.hbs @@ -1,4 +1,4 @@ - -