thecore_ui_partial_snippets 1.1.11 → 1.1.13
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1011e10a8d6b312aa1db5003bdff3a50d04b5247ce672b56fc665d1155e5fed6
|
4
|
+
data.tar.gz: 26470cc82deaa78961d33c32fc5096de5c03b7760e6d2467d1696396911e2631
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66d8af454e1d88157c3c2e0fc682f422dd63fef7d336b187e91d29c03d75cac6bcce8859ac08908a9b16ece1ff3ba56750efad902ebae1bef385e1477db1d886
|
7
|
+
data.tar.gz: cbaaed7cfe8ccc1f1294244888870e84229dc213582cf530b74b0f409ccdb885f6b5edf689878350f578f0b0bd4c12b510fb2a628369633419ef355d3c236b44
|
@@ -0,0 +1,103 @@
|
|
1
|
+
<style>
|
2
|
+
/* layout.css Style */
|
3
|
+
.upload-drop-zone {
|
4
|
+
height: 200px;
|
5
|
+
border-width: 2px;
|
6
|
+
margin-bottom: 20px;
|
7
|
+
}
|
8
|
+
|
9
|
+
/* skin.css Style*/
|
10
|
+
.upload-drop-zone {
|
11
|
+
color: #ccc;
|
12
|
+
border-style: dashed;
|
13
|
+
border-color: #ccc;
|
14
|
+
line-height: 200px;
|
15
|
+
text-align: center
|
16
|
+
}
|
17
|
+
|
18
|
+
.upload-drop-zone.drop {
|
19
|
+
color: #222;
|
20
|
+
border-color: #222;
|
21
|
+
}
|
22
|
+
</style>
|
23
|
+
|
24
|
+
<div class="panel panel-default">
|
25
|
+
<div class="panel-heading"><strong><%=I18n.t :file_upload%></strong>
|
26
|
+
<small><%=I18n.t :file_upload_subtitle, extension: Settings.ns(:xls_item_codes_importer).extension%></small>
|
27
|
+
</div>
|
28
|
+
<div class="panel-body">
|
29
|
+
|
30
|
+
<!-- Drop Zone -->
|
31
|
+
<div class="upload-drop-zone" id="drop-zone">
|
32
|
+
<%=I18n.t :please_drag_and_drop_here%>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="upload-status">
|
36
|
+
</div>
|
37
|
+
</div>
|
38
|
+
</div>
|
39
|
+
|
40
|
+
<script>
|
41
|
+
var fileUploadUrl;
|
42
|
+
var fileupload = {
|
43
|
+
// 'use strict';
|
44
|
+
|
45
|
+
// UPLOAD CLASS DEFINITION
|
46
|
+
// ======================
|
47
|
+
|
48
|
+
dropZone: $('<%=target%>'),
|
49
|
+
// var uploadForm = document.getElementById('js-upload-form');
|
50
|
+
|
51
|
+
// var startUpload = function(files) {
|
52
|
+
// console.log(files)
|
53
|
+
// }
|
54
|
+
|
55
|
+
// uploadForm.addEventListener('submit', function(e) {
|
56
|
+
// var uploadFiles = document.getElementById('js-upload-files').files;
|
57
|
+
// e.preventDefault()
|
58
|
+
|
59
|
+
// startUpload(uploadFiles)
|
60
|
+
// })
|
61
|
+
init: function(){
|
62
|
+
this.dropZone.ondrop = this.ondrop;
|
63
|
+
this.dropZone.ondragover = this.ondragover;
|
64
|
+
this.dropZone.ondragleave = this.ondragleave;
|
65
|
+
|
66
|
+
},
|
67
|
+
|
68
|
+
success: function(response) {console.log('file uploaded');},
|
69
|
+
failure: function(error) {console.log('file not uploaded');},
|
70
|
+
|
71
|
+
ondrop: function (e) {
|
72
|
+
e.preventDefault();
|
73
|
+
this.className = 'upload-drop-zone';
|
74
|
+
|
75
|
+
console.log(e.dataTransfer.files);
|
76
|
+
var fd = new FormData();
|
77
|
+
$.each(e.dataTransfer.files, function (i, file) {
|
78
|
+
fd.append('files[]', file);
|
79
|
+
});
|
80
|
+
|
81
|
+
$.ajax({
|
82
|
+
url: '<%=url%>',
|
83
|
+
type: 'post',
|
84
|
+
data: fd,
|
85
|
+
contentType: false,
|
86
|
+
processData: false
|
87
|
+
}).then(this.success).fail(this.failure);
|
88
|
+
// startUpload(e.dataTransfer.files)
|
89
|
+
},
|
90
|
+
|
91
|
+
ondragover: function () {
|
92
|
+
this.className = 'upload-drop-zone drop';
|
93
|
+
return false;
|
94
|
+
},
|
95
|
+
|
96
|
+
ondragleave: function () {
|
97
|
+
this.className = 'upload-drop-zone';
|
98
|
+
return false;
|
99
|
+
}
|
100
|
+
|
101
|
+
};
|
102
|
+
fileupload.init();
|
103
|
+
</script>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thecore_ui_partial_snippets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gabriele Tassoni
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-09-
|
11
|
+
date: 2019-09-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thecore
|
@@ -34,6 +34,7 @@ files:
|
|
34
34
|
- MIT-LICENSE
|
35
35
|
- README.md
|
36
36
|
- Rakefile
|
37
|
+
- app/views/thecore_utils/_drag_drop_uploader.html.erb
|
37
38
|
- app/views/thecore_utils/_html_helpers.html.erb
|
38
39
|
- lib/thecore_ui_partial_snippets.rb
|
39
40
|
- lib/thecore_ui_partial_snippets/engine.rb
|