summaryrefslogtreecommitdiff
path: root/ext/bg/js/settings/scan-inputs-controller.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-10-07 21:23:42 -0400
committerGitHub <noreply@github.com>2020-10-07 21:23:42 -0400
commit05e51a950e3fb7da3f9a252a742c068a9daad6b2 (patch)
tree0649a711633648c379adb79ca4b8344d8da001d7 /ext/bg/js/settings/scan-inputs-controller.js
parentcb1902eaddeb092bf1e3d78f9e601109bd32202c (diff)
Settings templates refactor (#897)
* Add template instantiation API to SettingsController * Use SettingsController.instantiateTemplate
Diffstat (limited to 'ext/bg/js/settings/scan-inputs-controller.js')
-rw-r--r--ext/bg/js/settings/scan-inputs-controller.js12
1 files changed, 5 insertions, 7 deletions
diff --git a/ext/bg/js/settings/scan-inputs-controller.js b/ext/bg/js/settings/scan-inputs-controller.js
index ec2758cb..04469a8d 100644
--- a/ext/bg/js/settings/scan-inputs-controller.js
+++ b/ext/bg/js/settings/scan-inputs-controller.js
@@ -65,6 +65,10 @@ class ScanInputsController {
this._settingsController.setProfileSetting(path, value);
}
+ instantiateTemplate(name) {
+ return this._settingsController.instantiateTemplate(name);
+ }
+
// Private
_onOptionsChanged({options}) {
@@ -139,7 +143,7 @@ class ScanInputField {
}
prepare(container, include, exclude) {
- const node = this._instantiateTemplate('#scan-input-template');
+ const node = this._parent.instantiateTemplate('scan-input');
const includeInputNode = node.querySelector('.scan-input-field[data-property=include]');
const includeMouseButton = node.querySelector('.mouse-button[data-property=include]');
const excludeInputNode = node.querySelector('.scan-input-field[data-property=exclude]');
@@ -188,12 +192,6 @@ class ScanInputField {
this._parent.removeInput(this._index);
}
- _instantiateTemplate(templateSelector) {
- const template = document.querySelector(templateSelector);
- const content = document.importNode(template.content, true);
- return content.firstChild;
- }
-
_isPointerTypeSupported(pointerType) {
if (this._node === null) { return false; }
const node = this._node.querySelector(`input.scan-input-settings-checkbox[data-property="types.${pointerType}"]`);