This commit is contained in:
Oliver Walters 2021-02-22 16:48:00 +11:00
parent bf51e1bfb1
commit 7d54997cb8
3 changed files with 25 additions and 3 deletions

View File

@ -70,6 +70,8 @@ class LabelConfig(AppConfig):
'file': 'qr.html', 'file': 'qr.html',
'name': 'QR Code', 'name': 'QR Code',
'description': 'Simple QR code label', 'description': 'Simple QR code label',
'width': 24,
'height': 24,
}, },
] ]
@ -116,7 +118,9 @@ class LabelConfig(AppConfig):
description=label['description'], description=label['description'],
label=filename, label=filename,
filters='', filters='',
enabled=True enabled=True,
width=label['width'],
height=label['height'],
) )
except: except:
pass pass
@ -156,11 +160,15 @@ class LabelConfig(AppConfig):
'file': 'qr.html', 'file': 'qr.html',
'name': 'QR Code', 'name': 'QR Code',
'description': 'Simple QR code label', 'description': 'Simple QR code label',
'width': 24,
'height': 24,
}, },
{ {
'file': 'qr_and_text.html', 'file': 'qr_and_text.html',
'name': 'QR and text', 'name': 'QR and text',
'description': 'Label with QR code and name of location', 'description': 'Label with QR code and name of location',
'width': 50,
'height': 24,
} }
] ]
@ -207,7 +215,9 @@ class LabelConfig(AppConfig):
description=label['description'], description=label['description'],
label=filename, label=filename,
filters='', filters='',
enabled=True enabled=True,
width=label['width'],
height=label['height'],
) )
except: except:
pass pass

View File

@ -16,7 +16,7 @@
font-family: Arial, Helvetica, sans-serif; font-family: Arial, Helvetica, sans-serif;
display: inline; display: inline;
position: absolute; position: absolute;
left: {{ width }}, left: {{ height }}mm;
top: 2mm; top: 2mm;
} }

View File

@ -114,6 +114,18 @@ function selectLabel(labels, items, options={}) {
* (via AJAX) from the server. * (via AJAX) from the server.
*/ */
// If only a single label template is provided,
// just run with that!
if (labels.length == 1) {
if (options.success) {
options.success(labels[0].pk);
}
return;
}
var modal = options.modal || '#modal-form'; var modal = options.modal || '#modal-form';
var label_list = makeOptionsList( var label_list = makeOptionsList(