stable, before a refactor
This commit is contained in:
@@ -4,6 +4,7 @@ export default class extends Controller {
|
||||
static targets = ["preview", "previewContainer", "logoSelect", "logofield", "initialLogoFile"];
|
||||
|
||||
async connect() {
|
||||
console.log('in connect');
|
||||
console.log(this.logofieldTarget.value)
|
||||
if (this.logofieldTarget.value.includes("Logo.")) {
|
||||
const response = await fetch(`/card_logo_files/${this.logofieldTarget.value}/image`); // Fetch the binary data
|
||||
@@ -82,13 +83,13 @@ export default class extends Controller {
|
||||
const blankOptionIndex = 0;
|
||||
const newOption = new Option(name, name, true, true)
|
||||
|
||||
if (this.logoSelectTarget.options.length > blankOptionIndex + 1) {
|
||||
this.logoSelectTarget.insertBefore(newOption, this.logoSelectTarget.options[blankOptionIndex + 1]);
|
||||
if (this.logofieldTarget.options.length > blankOptionIndex + 1) {
|
||||
this.logofieldTarget.insertBefore(newOption, this.logofieldTarget.options[blankOptionIndex + 1]);
|
||||
} else {
|
||||
this.logoSelectTarget.appendChild(newOption);
|
||||
this.logofieldTarget.appendChild(newOption);
|
||||
}
|
||||
|
||||
this.logoSelectTarget.value = name;
|
||||
this.logofieldTarget.value = name;
|
||||
}
|
||||
|
||||
determineNetworkFilename(file) {
|
||||
|
||||
Reference in New Issue
Block a user