thecore_ui_partial_snippets 1.1.14 → 1.1.15

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: c371fe0c5be69de0e1d0c5054b53e9442f89b86379b3d9d2538d316d89a6e7ad
4
- data.tar.gz: 238cabcdb3fda9595c37073618d71ceb43ec229a42b41392220a6ba0c178d645
3
+ metadata.gz: 13b60dd93240a3031e6899871cfc8988bb821419570bca55b108d9ebbf872da7
4
+ data.tar.gz: 96df5ac94d1c5a04d862911729b89d57b1225f243c58b82840fa8d891ec1ccf2
5
5
  SHA512:
6
- metadata.gz: ef365053aa3db2f537ab133c018c4b45b959c9111fc895c5e5d02ac6ccb34b5059b999dc26457191f682a2ddc47d53b9b64b738a5f7326ff0158f08b9416da58
7
- data.tar.gz: a2e2e540a3e305d03b6053c38674a5d87386227dc5582e623057a595742183ab247a24a1e3581d052908ecb2616c5bdd0ff7b2a94f984d438d9ba7730fd0b1e8
6
+ metadata.gz: 526ab718cd30db793b2f9c3fc9e2b28db0e7b4023d11849d5a5edb77467568146024489a9f607e9b285fe10950f3b27776757281eabf0fd384215dec1b634bf5
7
+ data.tar.gz: 5675d75fb6aaa0d6a56efc2caf673e8a00b32fcd5c9e7ccab752c545196eaae0786cf5ae87a1fd6d83bfab91d6ad11cefcd9f05c47fd2ca02ff0a8125691bc4e
@@ -22,8 +22,12 @@
22
22
  </style>
23
23
 
24
24
  <div class="panel panel-default">
25
- <div class="panel-heading"><strong><%=I18n.t :file_upload%></strong>
25
+ <div class="panel-heading">
26
+ <strong><%=I18n.t :file_upload%></strong>
26
27
  <small><%=I18n.t :file_upload_subtitle, extension: Settings.ns(:xls_item_codes_importer).extension%></small>
28
+ <div class="pull-right" id="<%=target%>-upload-drop-zone-feedback">
29
+
30
+ </div>
27
31
  </div>
28
32
  <div class="panel-body">
29
33
 
@@ -39,45 +43,45 @@
39
43
 
40
44
  <script>
41
45
  var fileupload = {
42
- dropZone: $('#<%=target%>'),
43
-
44
- init: function(){
45
- this.dropZone.ondrop = this.ondrop;
46
- this.dropZone.ondragover = this.ondragover;
47
- this.dropZone.ondragleave = this.ondragleave;
48
-
46
+ init: function () {
47
+ $('#<%=target%>').on("drop", this.ondrop);
48
+ $('#<%=target%>').on("dragover", this.ondragover);
49
+ $('#<%=target%>').on("dragleave", this.ondragleave);
49
50
  },
50
51
 
51
- success: function(response) {console.log('file uploaded');},
52
- failure: function(error) {console.log('file not uploaded');},
53
-
54
52
  ondrop: function (e) {
53
+ // console.log(e)
55
54
  e.preventDefault();
56
- this.className = 'upload-drop-zone';
55
+ $('#<%=target%>').removeClass('drop');
56
+ $("#<%=target%>-upload-drop-zone-feedback").html("<i class='fa fa-spinner fa-spin '></i>");
57
57
 
58
- console.log(e.dataTransfer.files);
58
+ // console.log(e.dataTransfer.files);
59
59
  var fd = new FormData();
60
- $.each(e.dataTransfer.files, function (i, file) {
60
+ $.each(e.originalEvent.dataTransfer.files, function (i, file) {
61
61
  fd.append('files[]', file);
62
62
  });
63
63
 
64
64
  $.ajax({
65
65
  url: '<%=url%>',
66
- type: 'post',
67
66
  data: fd,
67
+ processData: false,
68
68
  contentType: false,
69
- processData: false
70
- }).then(this.success).fail(this.failure);
69
+ type: 'POST',
70
+ success: function () {
71
+
72
+ $("#<%=target%>-upload-drop-zone-feedback").html($("<span><%=I18n.t :upload_ok%></span>").delay(3000).fadeOut(400));
73
+ }
74
+ });
71
75
  // startUpload(e.dataTransfer.files)
72
76
  },
73
77
 
74
78
  ondragover: function () {
75
- this.className = 'upload-drop-zone drop';
79
+ $('#<%=target%>').addClass('drop');
76
80
  return false;
77
81
  },
78
82
 
79
83
  ondragleave: function () {
80
- this.className = 'upload-drop-zone';
84
+ $('#<%=target%>').removeClass('drop');
81
85
  return false;
82
86
  }
83
87
 
@@ -0,0 +1,3 @@
1
+ it:
2
+ upload_not_ok: Latest upload failed
3
+ upload_ok: File correctly saved
@@ -0,0 +1,3 @@
1
+ it:
2
+ upload_not_ok: Ultimo caricamento fallito
3
+ upload_ok: File correttamente salvato
@@ -1,3 +1,3 @@
1
1
  module ThecoreUiPartialSnippets
2
- VERSION = '1.1.14'.freeze
2
+ VERSION = '1.1.15'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thecore_ui_partial_snippets
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.14
4
+ version: 1.1.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriele Tassoni
@@ -36,6 +36,8 @@ files:
36
36
  - Rakefile
37
37
  - app/views/thecore_utils/_drag_drop_uploader.html.erb
38
38
  - app/views/thecore_utils/_html_helpers.html.erb
39
+ - config/locales/thecore_ui_partial_snippets.en.yml
40
+ - config/locales/thecore_ui_partial_snippets.it.yml
39
41
  - lib/thecore_ui_partial_snippets.rb
40
42
  - lib/thecore_ui_partial_snippets/engine.rb
41
43
  - lib/thecore_ui_partial_snippets/version.rb