Skip to content

Commit

Permalink
Filter for appropriate file extension in file upload dialog.
Browse files Browse the repository at this point in the history
In case of an upload error, the error message will be shown received from target.
  • Loading branch information
BlueAndi committed Dec 4, 2023
1 parent 5cdc87a commit 2e4a78d
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 13 deletions.
16 changes: 12 additions & 4 deletions lib/IconTextLampPlugin/web/IconTextLampPlugin.html
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ <h3 class="mt-1">Icon</h3>
</div>
<div class="form-group">
<label for="icon">Icon:</label>
<input id="icon" type="file" />
<input id="icon" type="file" accept=".bmp" />
</div>
<input name="submit" type="submit" value="Update"/>
</form>
Expand All @@ -119,7 +119,7 @@ <h3 class="mt-1">Sprite sheet</h3>
</div>
<div class="form-group">
<label for="spriteSheet">Sprite sheet:</label>
<input id="spriteSheet" type="file" />
<input id="spriteSheet" type="file" accept=".sprite" />
</div>
<input name="submit" type="submit" value="Update"/>
</form>
Expand Down Expand Up @@ -271,7 +271,11 @@ <h3 class="mt-1">Lamp</h3>
updateForms();
alert("Ok.");
}).catch(function(rsp) {
alert("Failed.");
if (("undefined" !== typeof rsp.error) && ("string" === typeof rsp.error.msg)) {
alert("Error: " + rsp.error.msg);
} else {
alert("Failed.");
}
}).finally(function() {
enableUI();
});
Expand All @@ -294,7 +298,11 @@ <h3 class="mt-1">Lamp</h3>
updateForms();
alert("Ok.");
}).catch(function(rsp) {
alert("Failed.");
if (("undefined" !== typeof rsp.error) && ("string" === typeof rsp.error.msg)) {
alert("Error: " + rsp.error.msg);
} else {
alert("Failed.");
}
}).finally(function() {
enableUI();
});
Expand Down
16 changes: 12 additions & 4 deletions lib/IconTextPlugin/web/IconTextPlugin.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ <h3 class="mt-1">Icon</h3>
</div>
<div class="form-group">
<label for="icon">Icon:</label>
<input id="icon" type="file" />
<input id="icon" type="file" accept=".bmp" />
</div>
<input name="submit" type="submit" value="Update"/>
</form>
Expand All @@ -103,7 +103,7 @@ <h3 class="mt-1">Sprite sheet</h3>
</div>
<div class="form-group">
<label for="spriteSheet">Sprite sheet:</label>
<input id="spriteSheet" type="file" />
<input id="spriteSheet" type="file" accept=".sprite"/>
</div>
<input name="submit" type="submit" value="Update"/>
</form>
Expand Down Expand Up @@ -228,7 +228,11 @@ <h3 class="mt-1">Text</h3>
updateForms();
alert("Ok.");
}).catch(function(rsp) {
alert("Failed.");
if (("undefined" !== typeof rsp.error) && ("string" === typeof rsp.error.msg)) {
alert("Error: " + rsp.error.msg);
} else {
alert("Failed.");
}
}).finally(function() {
enableUI();
});
Expand All @@ -251,7 +255,11 @@ <h3 class="mt-1">Text</h3>
updateForms();
alert("Ok.");
}).catch(function(rsp) {
alert("Failed.");
if (("undefined" !== typeof rsp.error) && ("string" === typeof rsp.error.msg)) {
alert("Error: " + rsp.error.msg);
} else {
alert("Failed.");
}
}).finally(function() {
enableUI();
});
Expand Down
22 changes: 17 additions & 5 deletions lib/ThreeIconPlugin/web/ThreeIconPlugin.html
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ <h3 class="mt-1">Icon</h3>
</div>
<div class="form-group">
<label for="bitmap">Icon:</label>
<input id="bitmap" name="bitmap" type="file" />
<input id="bitmap" name="bitmap" type="file" accept=".bmp" />
</div>
<input name="submit" type="submit" value="Update"/>
</form>
Expand All @@ -118,7 +118,7 @@ <h3 class="mt-1">Sprite sheet</h3>
</div>
<div class="form-group">
<label for="spriteSheet">Sprite sheet:</label>
<input id="spriteSheet" name="spriteSheet" type="file" />
<input id="spriteSheet" name="spriteSheet" type="file" accept=".sprite" />
</div>
<input name="submit" type="submit" value="Update"/>
</form>
Expand Down Expand Up @@ -316,7 +316,11 @@ <h3 class="mt-1">Animation configuration</h3>
updateForms();
alert("Ok.");
}).catch(function(rsp) {
alert("Failed.");
if (("undefined" !== typeof rsp.error) && ("string" === typeof rsp.error.msg)) {
alert("Error: " + rsp.error.msg);
} else {
alert("Failed.");
}
}).finally(function() {
enableUI();
});
Expand All @@ -339,7 +343,11 @@ <h3 class="mt-1">Animation configuration</h3>
updateForms();
alert("Ok.");
}).catch(function(rsp) {
alert("Failed.");
if (("undefined" !== typeof rsp.error) && ("string" === typeof rsp.error.msg)) {
alert("Error: " + rsp.error.msg);
} else {
alert("Failed.");
}
}).finally(function() {
enableUI();
});
Expand Down Expand Up @@ -378,7 +386,11 @@ <h3 class="mt-1">Animation configuration</h3>
updateForms();
alert("Ok.");
}).catch(function(rsp) {
alert("Failed.");
if (("undefined" !== typeof rsp.error) && ("string" === typeof rsp.error.msg)) {
alert("Error: " + rsp.error.msg);
} else {
alert("Failed.");
}
}).finally(function() {
enableUI();
});
Expand Down

0 comments on commit 2e4a78d

Please sign in to comment.