thecore_dataentry_commons 3.0.3 → 3.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -0
- data/app/views/higher_level/_barcode_simple_scan.html.erb +7 -2
- data/app/views/rails_admin/main/_dataentry_commons_data_action.html.erb +5 -3
- data/app/views/rails_admin/main/_dataentry_commons_input_group_logic.html.erb +3 -1
- data/app/views/rails_admin/main/_modal_interaction.html.erb +13 -0
- data/app/views/rails_admin/main/_ws.html.erb +5 -0
- data/lib/thecore_dataentry_commons/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 83ac19448569e15906807044ad59ad9f141f1ef18a50c22f24e74c3700fe3bb0
|
|
4
|
+
data.tar.gz: 40c64d9814c0ff42dc5232743296bb3a810ee5328a825fe5f9b0eccfc0f953bd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 02446fa190e5eb7f6483d0b7631a1d144c717df70ba8e60c5952cb269fd92acce33822e099176c92caa45c5071de6c8d5ca752e1bf8d754657b263740aca7483
|
|
7
|
+
data.tar.gz: b84dd1972f3c05f45c0cefbf7ee527eb92e7792fe7e0e66cfbfefff50906d13e1c8a12fdbd1ca90bb60ef364c761ee983983712da0ed2113cbfb0fd68c9789ca
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 3.0.4
|
|
4
|
+
|
|
5
|
+
Scan screen (`higher_level/barcode_simple_scan`, used by thecore_spot_check_items' Check items and
|
|
6
|
+
thecore_tracker_tracks' Follow tracks):
|
|
7
|
+
|
|
8
|
+
- Keyboard mode: the barcode field is cleared once a scan's answer arrives (`cleanBarcode`); before,
|
|
9
|
+
the next scan was appended to the previous barcode and the server received both. The data action
|
|
10
|
+
posts the barcode of the last scan, not the cleared field.
|
|
11
|
+
- The partial renders the modal it uses (`rails_admin/main/modal_interaction`, now rendered once per
|
|
12
|
+
page even if the screen renders it too): on a screen without it, a rejected scan threw
|
|
13
|
+
`openModal is not defined`, showed no error and left the field disabled.
|
|
14
|
+
- `openModal` replaces the buttons' click handlers instead of adding one more at each opening, and
|
|
15
|
+
hides a button the call does not ask for.
|
|
16
|
+
- WebSocket mode: a message that is not a scan is ignored instead of throwing; the data action no
|
|
17
|
+
longer references keyboard capture, which exists only in keyboard mode.
|
|
18
|
+
|
|
3
19
|
## 3.0.3
|
|
4
20
|
|
|
5
21
|
- Fix: the English `ask_yes` label loaded as the boolean `true` (bare YAML `Yes`); it is now the string "Yes".
|
|
@@ -4,15 +4,19 @@
|
|
|
4
4
|
<%= render "dataentry_commons_data_container", hide_action: (hide_action rescue true)%>
|
|
5
5
|
|
|
6
6
|
<%= render "dataentry_commons_data_action" %>
|
|
7
|
+
<%# barcodeScannedFailure and the data action open it: without it a rejected scan threw and left the field disabled. %>
|
|
8
|
+
<%= render "rails_admin/main/modal_interaction" %>
|
|
7
9
|
<script>
|
|
8
10
|
var code;
|
|
11
|
+
// The barcode of the last scan sent: the field is cleared once its answer arrives.
|
|
12
|
+
var lastBarcode;
|
|
9
13
|
var returnedData;
|
|
10
14
|
var additionalData = {};
|
|
11
15
|
var disableKeyManagement = false;
|
|
12
16
|
var cleanBarcode = true;
|
|
13
17
|
|
|
14
18
|
function resetInfo() {
|
|
15
|
-
returnedData = code = undefined;
|
|
19
|
+
returnedData = code = lastBarcode = undefined;
|
|
16
20
|
$("#data-info").empty().hide();
|
|
17
21
|
$("#data-content").empty().hide();
|
|
18
22
|
<%-unless (hide_action rescue true)%>
|
|
@@ -76,10 +80,11 @@
|
|
|
76
80
|
// Operation on barcode scan
|
|
77
81
|
function sendFunction() {
|
|
78
82
|
code = $('#barcode');
|
|
83
|
+
lastBarcode = code.val();
|
|
79
84
|
code.prop('disabled', true);
|
|
80
85
|
$(this).button('loading');
|
|
81
86
|
$.get('<%=rails_admin.send("#{action_name}_path")%>', {
|
|
82
|
-
barcode:
|
|
87
|
+
barcode: lastBarcode,
|
|
83
88
|
parameters: additionalData
|
|
84
89
|
}).then(barcodeScannedSuccess).done(barcodeScannedThen).fail(barcodeScannedFailure);
|
|
85
90
|
}
|
|
@@ -27,7 +27,7 @@ var dataAction = {
|
|
|
27
27
|
$(this).button('loading');
|
|
28
28
|
this.before();
|
|
29
29
|
$.post('<%=rails_admin.send("#{action_name}_path")%>', {
|
|
30
|
-
barcode: code.val(),
|
|
30
|
+
barcode: (lastBarcode !== undefined ? lastBarcode : code.val()),
|
|
31
31
|
parameters: additionalData,
|
|
32
32
|
what_to_do: "data-action",
|
|
33
33
|
data: returnedData
|
|
@@ -35,7 +35,9 @@ var dataAction = {
|
|
|
35
35
|
},
|
|
36
36
|
|
|
37
37
|
init: function() {
|
|
38
|
-
|
|
38
|
+
// manageScannedKeystrokes exists only in keyboard mode (_kp): in WebSocket mode referencing it
|
|
39
|
+
// threw and stopped the page setup, so the send button was never wired.
|
|
40
|
+
if (typeof manageScannedKeystrokes === "function") $(window).off('keydown', manageScannedKeystrokes);
|
|
39
41
|
let dataActionHtml = $([
|
|
40
42
|
'<div class="row" id="data-action-container">',
|
|
41
43
|
' <button id="data-action" onclick="dataAction.run(); return false;" class="btn btn-danger col-lg-12" data-loading-text="<i class=\'fa fa-spinner fa-spin \'></i> <%=t :loading %>"><%=t "barcode.action.name"%></button>',
|
|
@@ -48,7 +50,7 @@ var dataAction = {
|
|
|
48
50
|
dispose: function() {
|
|
49
51
|
$("#data-action-container").remove();
|
|
50
52
|
$(window).off('keydown');
|
|
51
|
-
$(window).on('keydown', manageScannedKeystrokes);
|
|
53
|
+
if (typeof manageScannedKeystrokes === "function") $(window).on('keydown', manageScannedKeystrokes);
|
|
52
54
|
}
|
|
53
55
|
}
|
|
54
56
|
</script>
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
function resetCurrentBtn() {
|
|
3
3
|
$("#send").button('reset');
|
|
4
4
|
$("#barcode").prop('disabled', false);
|
|
5
|
-
|
|
5
|
+
// An <input> has no children: .empty() never cleared it, so in keyboard mode the next scan
|
|
6
|
+
// was appended to the previous barcode. The data action posts lastBarcode, not the field.
|
|
7
|
+
if (cleanBarcode) $("#barcode").val("");
|
|
6
8
|
// sendMessageToServer(msg_input_plugin_enable); clickedBtn = code = null;
|
|
7
9
|
}
|
|
8
10
|
</script>
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
<%# Rendered once per page: higher_level/barcode_simple_scan renders it (its error path calls openModal),
|
|
2
|
+
and screens written before that (thecore_tracker_tracks' follow_tracks) still render it themselves. %>
|
|
3
|
+
<%- unless @thecore_modal_interaction_rendered -%>
|
|
4
|
+
<%- @thecore_modal_interaction_rendered = true -%>
|
|
1
5
|
<div id="modal-interaction" class="modal fade" tabindex="-1" role="dialog">
|
|
2
6
|
<div class="modal-dialog" role="document">
|
|
3
7
|
<div class="modal-content">
|
|
@@ -23,15 +27,23 @@
|
|
|
23
27
|
function openModal(title, message, buttonPrimary, buttonSecondary) {
|
|
24
28
|
$('#modal-interaction-label').html(title);
|
|
25
29
|
$('#modal-interaction-body').html(message);
|
|
30
|
+
// The modal can be closed by its X or a data-bs-dismiss button without closeModal(): drop the
|
|
31
|
+
// previous handlers here, or each reopening adds one more and a click runs them all.
|
|
32
|
+
$('#modal-interaction-primary').off('click');
|
|
33
|
+
$('#modal-interaction-secondary').off('click');
|
|
26
34
|
if (buttonPrimary != null) {
|
|
27
35
|
$('#modal-interaction-primary').html(buttonPrimary.lbl);
|
|
28
36
|
$('#modal-interaction-primary').on('click', buttonPrimary.func);
|
|
29
37
|
$('#modal-interaction-primary').show();
|
|
38
|
+
} else {
|
|
39
|
+
$('#modal-interaction-primary').hide();
|
|
30
40
|
}
|
|
31
41
|
if (buttonSecondary != null) {
|
|
32
42
|
$('#modal-interaction-secondary').html(buttonSecondary.lbl);
|
|
33
43
|
$('#modal-interaction-secondary').on('click', buttonSecondary.func);
|
|
34
44
|
$('#modal-interaction-secondary').show();
|
|
45
|
+
} else {
|
|
46
|
+
$('#modal-interaction-secondary').hide();
|
|
35
47
|
}
|
|
36
48
|
(buttonPrimary != null || buttonSecondary != null) ? $("#modal-interaction-footer").show() : $("#modal-interaction-footer").hide();
|
|
37
49
|
$('#modal-interaction').modal('show');
|
|
@@ -49,3 +61,4 @@
|
|
|
49
61
|
$('#modal-interaction-secondary').off();
|
|
50
62
|
}
|
|
51
63
|
</script>
|
|
64
|
+
<%- end -%>
|
|
@@ -35,6 +35,11 @@
|
|
|
35
35
|
// il label_type è event.extras["com.symbol.datawedge.label_type"]: String contains the barcode label type. In the example above: LABEL-TYPE-EAN13
|
|
36
36
|
// il decode_data è event.extras["com.symbol.datawedge.decode_data"]: Decode data is returned as a list of byte arrays. In most cases there will be one byte array per decode. For barcode symbologies that support concatenation (i.e. Codabar, Code128, MicroPDF, etc.) the decoded data is stored in multiple byte arrays (one byte array per bar code). Clients can get data in each byte array by passing an index.
|
|
37
37
|
var results = barcodeScanRegExp.exec(event.data);
|
|
38
|
+
if (results === null) {
|
|
39
|
+
// Not a scan (the DataWedge bridge can send other messages): ignore it instead of throwing.
|
|
40
|
+
console.warn("Ignoring a WebSocket message that is not a barcode scan:", event.data);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
38
43
|
$('input[name=barcode]').val(results[1]);
|
|
39
44
|
$('input[name=label-type]').val(results[2]);
|
|
40
45
|
$("#send").click();
|