thecore_ui_commons 2.2.4 → 2.2.9

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: f510ad3fa384e9d3a3598f949d7a71bd233c690c72022244df397108ac0224cc
4
- data.tar.gz: 1bb0f13df31b05f4c9953b050cbcef0b16a827dc6dd950d694dd919fd57fb16d
3
+ metadata.gz: b638942c6068d65239ba5c426ac3d356987a9838d60e443200046df05e8387dc
4
+ data.tar.gz: 180e23eba6c2454161f66c323c6d7ebd75fd286155177d77648f0291a4f0a23d
5
5
  SHA512:
6
- metadata.gz: 40d0ddc4c4992240d4e0e5b1a9cbc6b9baf98a7708fa76cadbb7e30c364d2338a3965890a4c59fc259b29fc6dfcf5d68f1d8ace41eea8443142a53496498501e
7
- data.tar.gz: baf89f83fca413e37606f7ca6dd40e414d5a5a7cae102f18cdcd4e3f83f2d78aea903a22c894df9799cbe39a84390e6cd575f3f15a578eab2d7a237ae0a6c714
6
+ metadata.gz: be228ac7b20c0750d2e5200df0355b0c871b7b63fc6fe79fa2844e0cfa8bdfc2cfb4ab3a66e07fba9c9b8a07bffdb288d8557a956e0df9d0b396083fb299fd7e
7
+ data.tar.gz: 6dcbb021f056d782ee4cefa3c9c993d492fd0270d46f0b80b023bd825ea4322e7345ded8227fe639c0056272bf8a6a0024f10d4889e54b035f801d2a71f7e840
@@ -31,7 +31,7 @@
31
31
  <div class="col-md-4 col-md-offset-4 text-center">
32
32
  <img class="main-menu-app-logo" style="width: 25%; max-width: 152px" src="<%= image_url('logo.png') %>"/>
33
33
  </div>
34
- <%- unless flash.empty? %>
34
+ <%- unless flash.blank? %>
35
35
  <div class="col-md-4 col-md-offset-4" style="margin-top: 1em;">
36
36
  <%= render partial: 'shared/flash' %>
37
37
  </div>
@@ -12,26 +12,32 @@
12
12
  =end%>
13
13
 
14
14
  <style>
15
- /* layout.css Style */
16
15
  .upload-drop-zone {
16
+ display: flex;
17
+ align-items: center;
18
+ justify-content: center;
17
19
  height: 200px;
18
20
  border-width: 2px;
19
- margin-bottom: 20px;
20
- }
21
-
22
- /* skin.css Style*/
23
- .upload-drop-zone {
24
- color: #ccc;
21
+ /* margin-bottom: 20px; */
22
+ color: #bbb;
25
23
  border-style: dashed;
26
24
  border-color: #ccc;
27
- line-height: 200px;
28
- text-align: center
25
+ /* line-height: 200px; */
26
+ text-align: center
27
+ }
28
+ .upload-drop-zone i {
29
+ font-size: 8em
29
30
  }
30
31
 
31
32
  .upload-drop-zone.drop {
32
33
  color: #222;
33
34
  border-color: #222;
34
35
  }
36
+
37
+ .upload-drop-zone.disabledDnD {
38
+ background-color: darkred;
39
+ color: white;
40
+ }
35
41
  </style>
36
42
 
37
43
  <div class="panel panel-default">
@@ -46,7 +52,7 @@
46
52
 
47
53
  <!-- Drop Zone -->
48
54
  <div class="upload-drop-zone" id="<%=target%>">
49
- <%=I18n.t :please_drag_and_drop_here%>
55
+
50
56
  </div>
51
57
 
52
58
  <div id="upload-status">
@@ -55,12 +61,24 @@
55
61
  </div>
56
62
 
57
63
  <script>
64
+ // Enable D&D beahviour
65
+ function dndOn() {
66
+ $('#<%=target%>').on("drop", this.ondrop);
67
+ $('#<%=target%>').on("dragover", this.ondragover);
68
+ $('#<%=target%>').on("dragleave", this.ondragleave);
69
+ $('#<%=target%>').removeClass('disabledDnD');
70
+ $('#<%=target%>').html('<div><i class="fa fa-cloud-upload"></i><br/><span><%=I18n.t :please_drag_and_drop_here%></span></div>')
71
+ }
72
+ // Disable D&D beahviour
73
+ function dndOff() {
74
+ $('#<%=target%>').addClass('disabledDnD');
75
+ $('#<%=target%>').html('<div><i class="fa fa-ban"></i><br/><span><%=I18n.t :dont_leve_or_drag_here%></span></div>')
76
+ $('#<%=target%>').off("drop", this.ondrop);
77
+ $('#<%=target%>').off("dragover", this.ondragover);
78
+ $('#<%=target%>').off("dragleave", this.ondragleave);
79
+ }
58
80
  var fileupload = {
59
- init: function () {
60
- $('#<%=target%>').on("drop", this.ondrop);
61
- $('#<%=target%>').on("dragover", this.ondragover);
62
- $('#<%=target%>').on("dragleave", this.ondragleave);
63
- },
81
+ init: dndOn,
64
82
 
65
83
  beforeSuccess: function(){
66
84
  console.log("beforeSuccess");
@@ -69,6 +87,7 @@
69
87
  ondrop: function (e) {
70
88
  // console.log(e)
71
89
  e.preventDefault();
90
+ dndOff();
72
91
  $('#<%=target%>').removeClass('drop');
73
92
  $("#<%=target%>-upload-drop-zone-feedback").html("<i class='fa fa-spinner fa-spin '></i>");
74
93
 
@@ -87,9 +106,11 @@
87
106
  success: function () {
88
107
  fileupload.beforeSuccess();
89
108
  $("#<%=target%>-upload-drop-zone-feedback").html($('<i class="fa fa-check-square-o" aria-hidden="true"></i>').delay(3000).fadeOut(400));
109
+ fileupload.init();
90
110
  },
91
111
  error: function () {
92
112
  $("#<%=target%>-upload-drop-zone-feedback").html($('<i class="fa fa-exclamation-circle" aria-hidden="true"></i>').delay(3000).fadeOut(400));
113
+ fileupload.init();
93
114
  }
94
115
  });
95
116
  // startUpload(e.dataTransfer.files)
@@ -1,4 +1,10 @@
1
1
  en:
2
+ file_upload: Upload description, please add a translation for the element called file_upload in your translation file.
3
+ file_upload_subtitle: Descrizione aggiuntiva, prego aggiungere una traduzione per file_upload_subtitle al tuo file delle traduzioni.
4
+ dont_leve_or_drag_here: Uploading, please don't leave this page or Drag & Drop other files.
5
+ loading: Caricamento
6
+ please_drag_and_drop_here: Drag and Drop here the files to import
7
+ import_success: Import Successful!
2
8
  current_user: Current User
3
9
  devise:
4
10
  sessions:
@@ -1,4 +1,11 @@
1
1
  it:
2
+ file_upload: Descrizione della procedura, prego aggiungere una traduzione per file_upload al tuo file delle traduzioni.
3
+ file_upload_subtitle: Descrizione aggiuntiva, prego aggiungere una traduzione per file_upload_subtitle al tuo file delle traduzioni.
4
+ dont_leve_or_drag_here: Upload in corso, si prega di non lasciare la pagina o trascinare qui altri file.
5
+ loading: Caricamento
6
+ run_import: Forza l'importazione
7
+ please_drag_and_drop_here: Trascinare qui i file da importare
8
+ import_success: Importazione completata con successo
2
9
  current_user: Utente corrente
3
10
  hello: "Ciao Mondo"
4
11
  dashboard: "Pannello di controllo"
@@ -0,0 +1,6 @@
1
+ class AddSettingsForUploader < ActiveRecord::Migration[6.0]
2
+ def change
3
+ Settings.ns(:importer).import_from_folder = "tmp/imports"
4
+ Settings.ns(:importer).extension = "txt"
5
+ end
6
+ end
@@ -3,6 +3,10 @@ require 'thecore_background_jobs' # This brings backend commons also.
3
3
  require 'serviceworker-rails'
4
4
  require "groupdate"
5
5
  require "apexcharts"
6
+ # require "gtk3"
7
+ require "cairo"
8
+ require "poppler"
9
+ require "image_processing"
6
10
 
7
11
  require 'concerns/thecore_ui_commons_user'
8
12
 
@@ -13,4 +17,20 @@ require "thecore_ui_commons/engine"
13
17
 
14
18
  module ThecoreUiCommons
15
19
  # Your code goes here...
20
+
21
+ def self.save_files files
22
+ # Rails.logger.debug "AAAAAAAAAAA: POST?"
23
+ files.each do |pic|
24
+ # Rails.logger.debug "AAAAAAAAAAA: EACH PIC: #{pic.inspect}"
25
+ upload_dir = Rails.root.join(Settings.ns(:importer).import_from_folder, 'uploads')
26
+ FileUtils.mkdir_p upload_dir
27
+ # Rails.logger.debug "AAAAAAAAAAA: Fatto MKDIR di #{upload_dir}"
28
+ file_to_upload = Rails.root.join(upload_dir, "uploaded-#{Time.now.strftime("%Y%m%d%H%M%S%L")}-#{pic.original_filename}")
29
+ # Rails.logger.debug "AAAAAAAAAAA: File da uploadare #{file_to_upload}"
30
+ File.open(file_to_upload, 'wb') do |file|
31
+ # Rails.logger.debug "AAAAAAAAAAAAAAAAAA: Dentro alla scrittura"
32
+ file.write(pic.read)
33
+ end if Regexp.new("\\.#{Settings.ns(:importer).extension.gsub(/ +/, "").split(",").join("|\\.")}$").match? pic.original_filename
34
+ end
35
+ end
16
36
  end
@@ -1,3 +1,3 @@
1
1
  module ThecoreUiCommons
2
- VERSION = "#{`git describe --tags $(git rev-list --tags --max-count=1)`}"
2
+ VERSION = "#{`git describe --tags $(git rev-list --tags --max-count=1)`.chomp}"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thecore_ui_commons
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.4
4
+ version: 2.2.9
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-02-08 00:00:00.000000000 Z
11
+ date: 2021-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thecore_background_jobs
@@ -66,6 +66,48 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0.1'
69
+ - !ruby/object:Gem::Dependency
70
+ name: cairo
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.17'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.17'
83
+ - !ruby/object:Gem::Dependency
84
+ name: poppler
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '3.4'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '3.4'
97
+ - !ruby/object:Gem::Dependency
98
+ name: image_processing
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '1.2'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '1.2'
69
111
  description: Engine to serve configurations and rails module useful for all the UIs.
70
112
  email:
71
113
  - gabriele.tassoni@gmail.com
@@ -138,6 +180,7 @@ files:
138
180
  - config/routes.rb
139
181
  - db/migrate/20200515070620_add_username_to_user.rb
140
182
  - db/migrate/20200515132932_add_rememberable_to_user.rb
183
+ - db/migrate/20210208142646_add_settings_for_uploader.rb
141
184
  - lib/concerns/thecore_ui_commons_user.rb
142
185
  - lib/tasks/thecore_ui_commons_tasks.rake
143
186
  - lib/thecore_ui_commons.rb