thecore_print_commons 2.1.4 → 2.2.0
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/app/models/concerns/api/printer.rb +6 -3
- data/app/models/concerns/rails_admin/printer.rb +1 -1
- data/app/models/printer.rb +1 -1
- data/app/workers/print_worker.rb +1 -1
- data/db/seeds.rb +0 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 670b8b4f153ad70642a153811f71d2ce797e697ddc7e5af3cbc915739954abb4
|
4
|
+
data.tar.gz: daed3ca480be8480a89d93f4f6b494ace07a93224cee549d33c0941ec00a6431
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd44e8214bddfa87012ec35e728b623eb70c8b21478670175c2f25a627a5cc246d38d5f3bb43b1e2ad5cd5252cdd1bcfdf4564d609d5241778416f479efe4b49
|
7
|
+
data.tar.gz: 21d5bc33596daeef921285ea6828a5f660f50df7389c105ffc011ed4c61bc8375351277759e1811c420c1178e4b8955a25d202c99f8e8c330dd3614fd49d40d5
|
@@ -34,11 +34,14 @@ module Api::Printer
|
|
34
34
|
# single_text = "#{printer.print_template.template.gsub("%DESCRIPTION%", item.description)}"
|
35
35
|
# text = single_text * params[:quantity].to_i
|
36
36
|
# # Preso l'ordine mi recupero l'item e ne stampo la quantità richiesta
|
37
|
-
# ::PrintWorker.perform_async(
|
37
|
+
# ::PrintWorker.perform_async('192.168.0.1', 9100, "We all love DJ")
|
38
38
|
|
39
39
|
printer = Printer.find(params[:id])
|
40
|
-
|
41
|
-
|
40
|
+
base_template = printer.print_template.template.dup
|
41
|
+
result = printer.print_template.translation_matrix.lines.map(&:strip).inject(base_template) do |base_template, replacement|
|
42
|
+
base_template.gsub("$#{replacement}", params[replacement]) unless replacement.blank? && params[replacement].blank?
|
43
|
+
end
|
44
|
+
::PrintWorker.perform_async(printer.ip, printer.port, result)
|
42
45
|
{ info: "Print job sent in background to #{printer.ip} on port #{printer.port}" }
|
43
46
|
end
|
44
47
|
|
@@ -17,7 +17,7 @@ module RailsAdmin::Printer
|
|
17
17
|
field :default, :toggle
|
18
18
|
field :temperature
|
19
19
|
field :description
|
20
|
-
field :
|
20
|
+
field :is_online do
|
21
21
|
read_only true
|
22
22
|
formatted_value do # used in form views
|
23
23
|
(value ? "<strong style='color:green'>👍</strong>" : "<strong style='color:red'>👎</strong>").html_safe
|
data/app/models/printer.rb
CHANGED
data/app/workers/print_worker.rb
CHANGED
data/db/seeds.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thecore_print_commons
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gabriele Tassoni
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thecore_background_jobs
|