thecore_print_commons 2.1.6 → 2.3.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 +13 -13
- data/app/models/printer.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a660e7e19c51f70f096e2b7692f9e32fa0ff49fb308bc9436ca8d6e4179fc7a
|
4
|
+
data.tar.gz: 881571a78ffdd8a223c292ff34321be4fe9c90e25144db74980c3e915bbce5af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1fd987aab9e01e8e6dc24330cb9ffb21483677721e4c2098ab01ef5824811ddbda2a589663815fba799e3d54d369cdca4769ebdf53d5b2bfbd48c683993e1f4b
|
7
|
+
data.tar.gz: 18b8d864e56936271a2a44798ae9cf33a8fce903a52e7c6005ac9447be3d9d1ad1bedcae54fd79c9164188e10790a925a506996b5f265d712650454477b342d8
|
@@ -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
|
|
@@ -6,8 +6,8 @@ module RailsAdmin::Printer
|
|
6
6
|
navigation_label I18n.t("admin.settings.label")
|
7
7
|
navigation_icon 'fa fa-print'
|
8
8
|
|
9
|
-
field :print_template
|
10
9
|
field :name
|
10
|
+
field :print_template
|
11
11
|
field :ip
|
12
12
|
field :port do
|
13
13
|
default_value do
|
@@ -15,9 +15,18 @@ module RailsAdmin::Printer
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
field :default, :toggle
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
|
19
|
+
show do
|
20
|
+
field :temperature
|
21
|
+
field :description
|
22
|
+
end
|
23
|
+
|
24
|
+
edit do
|
25
|
+
field :temperature
|
26
|
+
field :description
|
27
|
+
end
|
28
|
+
|
29
|
+
field :is_online do
|
21
30
|
read_only true
|
22
31
|
formatted_value do # used in form views
|
23
32
|
(value ? "<strong style='color:green'>👍</strong>" : "<strong style='color:red'>👎</strong>").html_safe
|
@@ -31,15 +40,6 @@ module RailsAdmin::Printer
|
|
31
40
|
value ? "OK" : "KO" # used in exports, where no html/data is allowed
|
32
41
|
end
|
33
42
|
end
|
34
|
-
|
35
|
-
list do
|
36
|
-
configure :description do
|
37
|
-
visible false
|
38
|
-
end
|
39
|
-
configure :temperature do
|
40
|
-
visible false
|
41
|
-
end
|
42
|
-
end
|
43
43
|
end
|
44
44
|
end
|
45
45
|
end
|
data/app/models/printer.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.3.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:
|
11
|
+
date: 2022-02-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thecore_background_jobs
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '2.
|
19
|
+
version: '2.2'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '2.
|
26
|
+
version: '2.2'
|
27
27
|
description: Thecorized thecore_print_commons full description.
|
28
28
|
email:
|
29
29
|
- gabriele.tassoni@gmail.com
|