thecore_dataentry_commons 2.1.2 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 92f2e7e4a3bfa104ba81f7a96c00383c3ed9a931438084331d29b4023889e561
4
- data.tar.gz: 691573546e9b24192692ef6905d75fa5f070b73698e9ca0fb82386fb0cbaea68
3
+ metadata.gz: 30a24eebbeb7a7934ebe80b6da512a51a1d7c91fdea4c1b1a94c48c1a771ebe6
4
+ data.tar.gz: 7bdefce5d351295fb901754a426c86fe7deeac6a92119596fff1431abe10944d
5
5
  SHA512:
6
- metadata.gz: 6553d1c4ce36f489687f42e2b35786b71ea4aa2645fefc6f961a4fb12d52a2095e6f3bd1fb0d9b5a0c8e86fae2cc6c0dc8dd0b8d3a38b9fef599b6fab07301fc
7
- data.tar.gz: 4dbe2ae592394cf53a06f36491f6e2a0216090deaf6a1d428c52b6dc84c0c219a739e7bd8e88d57cd87b26a2041e532af44b16876a77d2fad6056f95cc0c9bcd
6
+ metadata.gz: 4440a5bea9e35ce6a4ac68ca88a657a68929bbfd19836d9ccd1ffacf811d6931d375b1b2312d33da94f2bbcea4a3a86fcf66e00a2202b14a9933e32ec9bd59ea
7
+ data.tar.gz: 2ae76c3f88dd68e798b8ae2feaf81958a99c50fab009e87fdb461b3b7e4f8333b468ebd17e3fcd3473d99df0195625157c0cf581e6ef64910f78815554a91bf6
@@ -71,10 +71,6 @@
71
71
  if(!primary && !secondary)
72
72
  resetAll();
73
73
  }
74
-
75
- <%-unless (hide_action rescue true)%>
76
- dataAction.init();
77
- <%-end%>
78
74
  // END of overridable functions
79
75
 
80
76
  // Operation on barcode scan
@@ -88,14 +84,20 @@
88
84
  }).then(barcodeScannedSuccess).done(barcodeScannedThen).fail(barcodeScannedFailure);
89
85
  }
90
86
 
91
- <%-if (start_disabled rescue false)%>
92
- $('#send').off('click', sendFunction);
93
- <%-else%>
94
- $('#send').on('click', sendFunction);
95
- <%-end%>
87
+ document.addEventListener("turbo:load", function (event) {
88
+ console.log("Inside Barcode Simple Scan Debug");
89
+ <%-unless (hide_action rescue true)%>
90
+ dataAction.init();
91
+ <%-end%>
92
+ <%-if (start_disabled rescue false)%>
93
+ $('#send').off('click', sendFunction);
94
+ <%-else%>
95
+ $('#send').on('click', sendFunction);
96
+ <%-end%>
96
97
 
97
- // Starting with a clean interface
98
- resetInfo();
98
+ // Starting with a clean interface
99
+ resetInfo();
100
+ });
99
101
  </script>
100
102
 
101
103
  <%= render "dataentry_commons_input_group_logic", start_disabled: (start_disabled rescue false) %>
@@ -1,8 +1,8 @@
1
1
  <div class="container" style="margin-top: 1em;" id="info-container">
2
2
  <div class="row">
3
- <div id="data-info" class="alert alert-warning col-lg-12"></div>
3
+ <div id="data-info" class="col-lg-12"></div>
4
4
  </div>
5
5
  <div class="row">
6
- <div id="data-content" class="alert alert-warning col-lg-12"></div>
6
+ <div id="data-content" class="col-lg-12"></div>
7
7
  </div>
8
8
  </div>
@@ -1,45 +1,15 @@
1
- <%-if @type == "ws" %>
2
- <style type="text/css">
3
- .input-group-addon.primary {
4
- color: rgb(255, 255, 255);
5
- background-color: rgb(50, 118, 177);
6
- border-color: rgb(40, 94, 142);
7
- }
8
- .input-group-addon.success {
9
- color: rgb(255, 255, 255);
10
- background-color: rgb(92, 184, 92);
11
- border-color: rgb(76, 174, 76);
12
- }
13
- .input-group-addon.info {
14
- color: rgb(255, 255, 255);
15
- background-color: rgb(57, 179, 215);
16
- border-color: rgb(38, 154, 188);
17
- }
18
- .input-group-addon.warning {
19
- color: rgb(255, 255, 255);
20
- background-color: rgb(240, 173, 78);
21
- border-color: rgb(238, 162, 54);
22
- }
23
- .input-group-addon.danger {
24
- color: rgb(255, 255, 255);
25
- background-color: rgb(217, 83, 79);
26
- border-color: rgb(212, 63, 58);
27
- }
28
- </style>
29
- <%-end%>
30
-
31
- <div class="row" id="barcode-container">
32
- <div class="col-lg-12">
33
- <div class="input-group input-group-lg">
1
+ <div class="card mb-3" id="barcode-container">
2
+ <div class="card-body">
3
+ <div class="input-group">
34
4
  <%-if @type == "ws" %>
35
- <span id="connection" class="input-group-addon danger">
5
+ <div id="connection" class="input-group-prepend bg-danger">
36
6
  <i class='fa fa-plug'></i>
37
- </span>
7
+ </div>
38
8
  <%-end%>
39
- <input type="text" name="barcode" class="form-control input-lg" id="barcode" placeholder="<%= I18n.t :manual_barcode %>"/>
40
- <span class="input-group-btn">
41
- <button id="send" type="button" class="btn btn-default btn-lg" data-loading-text="<i class='fa fa-spinner fa-spin '></i> <%=t :loading %>"><%= I18n.t :send %></button>
42
- </span>
9
+ <input type="text" name="barcode" class="form-control" id="barcode" placeholder="<%= I18n.t :manual_barcode %>"/>
10
+ <div class="input-group-append">
11
+ <button id="send" type="button" class="btn btn-outline-secondary" data-loading-text="<i class='fa fa-spinner fa-spin '></i> <%=t :loading %>"><%= I18n.t :send %></button>
12
+ </div>
43
13
  </div>
44
14
  </div>
45
15
  </div>
@@ -75,15 +75,18 @@
75
75
  // $("#send").focus();
76
76
  // Init
77
77
  // Disabling any previously defined keypress event
78
- $(window).off('keydown');
79
- $(document).off(kpMode);
80
- $("#barcode").off(kpMode);
81
- $("#barcode").focus();
82
- // Enabling keypress event only for this page
83
- <%-if (start_disabled rescue false)%>
84
- // disableKSCapture();
85
- <%-else%>
86
- $(window).on('keydown', manageScannedKeystrokes);
87
- // startKSCapture();
88
- <%-end%>
78
+ document.addEventListener("turbo:load", function (event) {
79
+ console.log("Inside KP Debug");
80
+ $(window).off('keydown');
81
+ $(document).off(kpMode);
82
+ $("#barcode").off(kpMode);
83
+ $("#barcode").focus();
84
+ // Enabling keypress event only for this page
85
+ <%-if (start_disabled rescue false)%>
86
+ // disableKSCapture();
87
+ <%-else%>
88
+ $(window).on('keydown', manageScannedKeystrokes);
89
+ // startKSCapture();
90
+ <%-end%>
91
+ });
89
92
  </script>
@@ -0,0 +1,51 @@
1
+ <div id="modal-interaction" class="modal fade" tabindex="-1" role="dialog">
2
+ <div class="modal-dialog" role="document">
3
+ <div class="modal-content">
4
+ <div class="modal-header">
5
+ <h4 class="modal-title" id="modal-interaction-label">&nbsp;</h4>
6
+ <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
7
+ </div>
8
+ <div class="modal-body" id="modal-interaction-body">
9
+ &nbsp;
10
+ </div>
11
+ <div class="modal-footer" id="modal-interaction-footer">
12
+ <button type="button" class="btn btn-default" data-bs-dismiss="modal" id="modal-interaction-secondary">&nbsp;</button>
13
+ <button type="button" class="btn btn-primary" id="modal-interaction-primary">&nbsp;</button>
14
+ </div>
15
+ </div>
16
+ <!-- /.modal-content -->
17
+ </div>
18
+ <!-- /.modal-dialog -->
19
+ </div>
20
+ <!-- /.modal -->
21
+
22
+ <script>
23
+ function openModal(title, message, buttonPrimary, buttonSecondary) {
24
+ $('#modal-interaction-label').html(title);
25
+ $('#modal-interaction-body').html(message);
26
+ if (buttonPrimary != null) {
27
+ $('#modal-interaction-primary').html(buttonPrimary.lbl);
28
+ $('#modal-interaction-primary').on('click', buttonPrimary.func);
29
+ $('#modal-interaction-primary').show();
30
+ }
31
+ if (buttonSecondary != null) {
32
+ $('#modal-interaction-secondary').html(buttonSecondary.lbl);
33
+ $('#modal-interaction-secondary').on('click', buttonSecondary.func);
34
+ $('#modal-interaction-secondary').show();
35
+ }
36
+ (buttonPrimary != null || buttonSecondary != null) ? $("#modal-interaction-footer").show() : $("#modal-interaction-footer").hide();
37
+ $('#modal-interaction').modal('show');
38
+ }
39
+ function closeModal() {
40
+ $('#modal-interaction').modal('hide');
41
+ $('#modal-interaction-label').html("&nbsp;");
42
+ $('#modal-interaction-body').html("&nbsp;");
43
+ $('#modal-interaction-primary').html("&nbsp;");
44
+ $('#modal-interaction-secondary').html("&nbsp;");
45
+ $('#modal-interaction-primary').hide();
46
+ $('#modal-interaction-secondary').hide();
47
+ $("#modal-interaction-footer").hide();
48
+ $('#modal-interaction-primary').off();
49
+ $('#modal-interaction-secondary').off();
50
+ }
51
+ </script>
@@ -41,11 +41,11 @@
41
41
  };
42
42
  // In production you would want this to be resiliant against the server being killed by Android, by the user navigating between pages or any other unexpected error related to connection.
43
43
  ws.onclose = function () {
44
- setSocketStatus("success", "danger");
44
+ setSocketStatus("bg-success", "bg-danger");
45
45
  socketClosed = true;
46
46
  };
47
47
  ws.onopen = function () {
48
- setSocketStatus("danger", "success");
48
+ setSocketStatus("bg-danger", "bg-success");
49
49
  socketClosed = false;
50
50
  };
51
51
  ws.onerror = function (event) {
@@ -81,10 +81,13 @@
81
81
  }
82
82
  }
83
83
 
84
- <%-if (start_disabled rescue false)%>
85
- // Do nothing, if start is disabled is true, don't print anything.
86
- // If it's not defined, it must default to starting websocket()
87
- <%-else%>
88
- startWS();
89
- <%-end%>
84
+ document.addEventListener("turbo:load", function (event) {
85
+ console.log("Inside WS Debug");
86
+ <%-if (start_disabled rescue false)%>
87
+ // Do nothing, if start is disabled is true, don't print anything.
88
+ // If it's not defined, it must default to starting websocket()
89
+ <%-else%>
90
+ startWS();
91
+ <%-end%>
92
+ });
90
93
  </script>
@@ -0,0 +1,5 @@
1
+ # This method defines the migrations paths for the engine and adds them to the migrations paths of
2
+ # the parent Rails app by using ActiveRecord::Migrator.migrations_paths.concat.
3
+ # migrations_paths = [File.expand_path("../../db/migrate", __dir__)]
4
+ # ActiveRecord::Migrator.migrations_paths.concat(migrations_paths)
5
+ Rails.application.config.paths['db/migrate'] << File.expand_path("../../db/migrate", __dir__)
@@ -1,24 +1,4 @@
1
1
  module ThecoreDataentryCommons
2
2
  class Engine < ::Rails::Engine
3
- # This code makes the static assets present in this
4
- # engine available to main app, even if this gem is
5
- # just a dependency of another engine
6
- # initializer 'thecore_dataentry_commons.load_static_assets' do |app|
7
- # # puts "Loading static assets for #{root}"
8
- # app.middleware.use ::ActionDispatch::Static, "#{root}/app"
9
- # end
10
- initializer 'thecore_dataentry_commons.add_to_migrations' do |app|
11
- # Adds the list of Thecore Engines, so to manage seeds loading, i.e.:
12
- # Thecore::Base.thecore_engines.each { |engine| engine.load_seed }
13
- Thecore::Base.thecore_engines << self.class
14
- unless app.root.to_s.match root.to_s
15
- # APPEND TO MAIN APP MIGRATIONS FROM THIS GEM
16
- config.paths['db/migrate'].expanded.each do |expanded_path|
17
- app.config.paths['db/migrate'] << expanded_path
18
- end
19
- # = app.config.paths['db/migrate'].uniq
20
- # puts app.config.paths['db/migrate'].map(:path).inspect
21
- end
22
- end
23
3
  end
24
4
  end
@@ -1,3 +1,4 @@
1
1
  module ThecoreDataentryCommons
2
- VERSION = "#{`git describe --tags $(git rev-list --tags --max-count=1)`.chomp}"
2
+ VERSION = "3.0.0".freeze
3
+ # "#{`git describe --tags $(git rev-list --tags --max-count=1)`.chomp}"
3
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thecore_dataentry_commons
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.2
4
+ version: 3.0.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-09-21 00:00:00.000000000 Z
11
+ date: 2023-05-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thecore_ui_rails_admin
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '2.0'
19
+ version: '3.0'
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.0'
26
+ version: '3.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: browser
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -54,8 +54,10 @@ files:
54
54
  - app/views/rails_admin/main/_dataentry_commons_input_group.html.erb
55
55
  - app/views/rails_admin/main/_dataentry_commons_input_group_logic.html.erb
56
56
  - app/views/rails_admin/main/_kp.html.erb
57
+ - app/views/rails_admin/main/_modal_interaction.html.erb
57
58
  - app/views/rails_admin/main/_ws.html.erb
58
59
  - app/views/thecore_utils/_html_helpers.html.erb
60
+ - config/initializers/add_to_db_migrations.rb
59
61
  - config/locales/en.thecore_datawedge_websocket_helpers.yml
60
62
  - config/locales/it.thecore_datawedge_websocket_helpers.yml
61
63
  - db/seeds.rb