REFACTOR: Don't use `layoutName` in select-kit (#10556)

REFACTOR: Don’t use layoutName in select-kit (#10556)

Instead import the templates as modules, the way Ember CLI wants us to.

diff --git a/app/assets/javascripts/app-boot.js b/app/assets/javascripts/app-boot.js
index ef47026..870551b 100644
--- a/app/assets/javascripts/app-boot.js
+++ b/app/assets/javascripts/app-boot.js
@@ -11,6 +11,14 @@
     "discourse-common/lib/raw-templates"
   ).__DISCOURSE_RAW_TEMPLATES;
 
+  // required for select kit to work without Ember CLI
+  Object.keys(Ember.TEMPLATES).forEach(k => {
+    if (k.indexOf("select-kit") === 0) {
+      let template = Ember.TEMPLATES[k];
+      define(k, () => template);
+    }
+  });
+
   // ensure Discourse is added as a global
   window.Discourse = Discourse;
 })();
diff --git a/app/assets/javascripts/select-kit/addon/components/category-drop/category-drop-header.js b/app/assets/javascripts/select-kit/addon/components/category-drop/category-drop-header.js
index 7f641fb..48f809f 100644
--- a/app/assets/javascripts/select-kit/addon/components/category-drop/category-drop-header.js
+++ b/app/assets/javascripts/select-kit/addon/components/category-drop/category-drop-header.js
@@ -2,10 +2,10 @@ import { readOnly } from "@ember/object/computed";
 import { schedule } from "@ember/runloop";
 import ComboBoxSelectBoxHeaderComponent from "select-kit/components/combo-box/combo-box-header";
 import discourseComputed from "discourse-common/utils/decorators";
+import layout from "select-kit/templates/components/category-drop/category-drop-header";
 
 export default ComboBoxSelectBoxHeaderComponent.extend({
-  layoutName:
-    "select-kit/templates/components/category-drop/category-drop-header",
+  layout,
   classNames: ["category-drop-header"],
   classNameBindings: ["categoryStyleClass"],
   categoryStyleClass: readOnly("site.category_style"),
diff --git a/app/assets/javascripts/select-kit/addon/components/category-row.js b/app/assets/javascripts/select-kit/addon/components/category-row.js
index e861deb..ad15b6a 100644
--- a/app/assets/javascripts/select-kit/addon/components/category-row.js
+++ b/app/assets/javascripts/select-kit/addon/components/category-row.js
@@ -5,9 +5,10 @@ import { categoryBadgeHTML } from "discourse/helpers/category-link";
 import { isEmpty, isNone } from "@ember/utils";
 import { computed } from "@ember/object";
 import { setting } from "discourse/lib/computed";
+import layout from "select-kit/templates/components/category-row";
 
 export default SelectKitRowComponent.extend({
-  layoutName: "select-kit/templates/components/category-row",
+  layout,
   classNames: ["category-row"],
   hideParentCategory: bool("selectKit.options.hideParentCategory"),
   allowUncategorized: bool("selectKit.options.allowUncategorized"),
diff --git a/app/assets/javascripts/select-kit/addon/components/color-palettes/color-palettes-row.js b/app/assets/javascripts/select-kit/addon/components/color-palettes/color-palettes-row.js
index f8a00b7..781ec0b 100644
--- a/app/assets/javascripts/select-kit/addon/components/color-palettes/color-palettes-row.js
+++ b/app/assets/javascripts/select-kit/addon/components/color-palettes/color-palettes-row.js
@@ -1,12 +1,11 @@
 import { escapeExpression } from "discourse/lib/utilities";
 import SelectKitRowComponent from "select-kit/components/select-kit/select-kit-row";
 import { computed } from "@ember/object";
+import layout from "select-kit/templates/components/color-palettes/color-palettes-row";
 
 export default SelectKitRowComponent.extend({
   classNames: ["color-palettes-row"],
-
-  layoutName:
-    "select-kit/templates/components/color-palettes/color-palettes-row",
+  layout,
 
   palettes: computed("item.colors.[]", function() {
     return (this.item.colors || [])
diff --git a/app/assets/javascripts/select-kit/addon/components/combo-box/combo-box-header.js b/app/assets/javascripts/select-kit/addon/components/combo-box/combo-box-header.js
index 3c7472d..d1fcc5c 100644
--- a/app/assets/javascripts/select-kit/addon/components/combo-box/combo-box-header.js
+++ b/app/assets/javascripts/select-kit/addon/components/combo-box/combo-box-header.js
@@ -1,9 +1,10 @@
 import { reads, and } from "@ember/object/computed";
 import SingleSelectHeaderComponent from "select-kit/components/select-kit/single-select-header";
 import { computed } from "@ember/object";
+import layout from "select-kit/templates/components/combo-box/combo-box-header";
 
 export default SingleSelectHeaderComponent.extend({
-  layoutName: "select-kit/templates/components/combo-box/combo-box-header",
+  layout,
   classNames: ["combo-box-header"],
   clearable: reads("selectKit.options.clearable"),
   caretUpIcon: reads("selectKit.options.caretUpIcon"),
diff --git a/app/assets/javascripts/select-kit/addon/components/create-color-row.js b/app/assets/javascripts/select-kit/addon/components/create-color-row.js
index 9c4f5aa..16a9a92 100644
--- a/app/assets/javascripts/select-kit/addon/components/create-color-row.js
+++ b/app/assets/javascripts/select-kit/addon/components/create-color-row.js
@@ -1,9 +1,10 @@
 import SelectKitRowComponent from "select-kit/components/select-kit/select-kit-row";
 import { escapeExpression } from "discourse/lib/utilities";
 import { schedule } from "@ember/runloop";
+import layout from "select-kit/templates/components/create-color-row";
 
 export default SelectKitRowComponent.extend({
-  layoutName: "select-kit/templates/components/create-color-row",
+  layout,
   classNames: ["create-color-row"],
 
   didReceiveAttrs() {
diff --git a/app/assets/javascripts/select-kit/addon/components/dropdown-select-box/dropdown-select-box-header.js b/app/assets/javascripts/select-kit/addon/components/dropdown-select-box/dropdown-select-box-header.js
index 7404513..2d44cf8 100644
--- a/app/assets/javascripts/select-kit/addon/components/dropdown-select-box/dropdown-select-box-header.js
+++ b/app/assets/javascripts/select-kit/addon/components/dropdown-select-box/dropdown-select-box-header.js
@@ -1,10 +1,10 @@
 import SingleSelectHeaderComponent from "select-kit/components/select-kit/single-select-header";
 import { computed } from "@ember/object";
 import { readOnly } from "@ember/object/computed";
+import layout from "select-kit/templates/components/dropdown-select-box/dropdown-select-box-header";
 
 export default SingleSelectHeaderComponent.extend({
-  layoutName:
-    "select-kit/templates/components/dropdown-select-box/dropdown-select-box-header",
+  layout,
   classNames: ["btn-default", "dropdown-select-box-header"],
   tagName: "button",
   classNameBindings: ["btnClassName"],
diff --git a/app/assets/javascripts/select-kit/addon/components/dropdown-select-box/dropdown-select-box-row.js b/app/assets/javascripts/select-kit/addon/components/dropdown-select-box/dropdown-select-box-row.js
index 0944404..9b8774f 100644
--- a/app/assets/javascripts/select-kit/addon/components/dropdown-select-box/dropdown-select-box-row.js
+++ b/app/assets/javascripts/select-kit/addon/components/dropdown-select-box/dropdown-select-box-row.js
@@ -1,9 +1,9 @@
 import { readOnly } from "@ember/object/computed";
 import SelectKitRowComponent from "select-kit/components/select-kit/select-kit-row";
+import layout from "select-kit/templates/components/dropdown-select-box/dropdown-select-box-row";
 
 export default SelectKitRowComponent.extend({
-  layoutName:
-    "select-kit/templates/components/dropdown-select-box/dropdown-select-box-row",
+  layout,
   classNames: ["dropdown-select-box-row"],
 
   description: readOnly("item.description")
diff --git a/app/assets/javascripts/select-kit/addon/components/future-date-input-selector/future-date-input-selector-header.js b/app/assets/javascripts/select-kit/addon/components/future-date-input-selector/future-date-input-selector-header.js
index b120d70..8bee9ae 100644
--- a/app/assets/javascripts/select-kit/addon/components/future-date-input-selector/future-date-input-selector-header.js
+++ b/app/assets/javascripts/select-kit/addon/components/future-date-input-selector/future-date-input-selector-header.js
@@ -1,7 +1,7 @@

[... diff too long, it was truncated ...]

GitHub sha: aae97457

This commit appears in #10556 which was merged by eviltrout.