Skip to content

Commit

Permalink
Hide upload box if no image is selected
Browse files Browse the repository at this point in the history
  • Loading branch information
tbnobody committed Apr 15, 2020
1 parent d21372b commit 3f070bf
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions views/labeldesigner.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -183,15 +183,19 @@
<input type="radio" name="printType" onchange="preview()" value="qrcode_text" aria-label="QR Code + Text">
<span class="fas fa-qrcode" aria-hidden="true"></span> QR Code+Text
</label>
<label class="btn btn-secondary" id="printTypeImage">
<input type="radio" name="printType" onchange="preview()" value="image" aria-label="Image">
<span class="fas fa-image" aria-hidden="true"></span> Image
</label>
</div>

<fieldset class="form-group">
<fieldset class="form-group" id="groupLabelText">
<label for="labelText" style="margin-top: 10px; margin-bottom: 0">Label Text:</label>
<textarea rows="7" id="labelText" class="form-control" onChange="preview()" onInput="preview()"></textarea>
</fieldset>
<fieldset class="form-group">
<label>Label Image:</label>
<form action="/file-upload" class="dropzone">
<fieldset class="form-group" id="groupLabelImage">
<label style="margin-top: 10px; margin-bottom: 0">Label Image:</label>
<form action="/api/preview/image?return_format=base64" class="dropzone">
</form>
</fieldset>
</div>
Expand Down Expand Up @@ -279,6 +283,14 @@ function preview() {
$('#print_color_red').addClass('disabled');
}

if($('input[name=printType]:checked').val() == 'image') {
$('#groupLabelText').hide();
$('#groupLabelImage').show()
} else {
$('#groupLabelText').show();
$('#groupLabelImage').hide();
}

$.ajax({
type: 'POST',
url: '/api/preview/text?return_format=base64',
Expand Down

0 comments on commit 3f070bf

Please sign in to comment.