scenario-form-page.js 591 B

1234567891011121314151617181920212223242526
  1. this.ScenarioFormPage = class ScenarioFormPage {
  2. constructor() {
  3. this.enabledSelect2();
  4. }
  5. format(icon) {
  6. if (!icon.element) return icon.text;
  7. return [
  8. ...$(document.createElement('i')).addClass(`fa-solid ${icon.element.dataset.icon}`),
  9. document.createTextNode(` ${icon.text}`),
  10. ];
  11. }
  12. enabledSelect2() {
  13. return $(".select2-fontawesome-icon").select2({
  14. width: "100%",
  15. templateResult: this.format,
  16. templateSelection: this.format,
  17. });
  18. }
  19. };
  20. $(() =>
  21. Utils.registerPage(ScenarioFormPage, { forPathsMatching: /^scenarios/ })
  22. );