appscms-tools-theme 1.1.7 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/assets/js/googledriveinput.js +15 -41
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d214029a66a9d6999fdae7a43813bc7f00afec5a83fed6d0063fb838b084f7b4
|
4
|
+
data.tar.gz: 3fd0c42d5d1603a8ff781183162e4b5a0adae2bf288e78bb2830a28d34d746f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e898e5a76764132f79e1e4f256992ec123bbbb2e4062da4b8c0f273a33b5461438ece6cb310cfc51125bf1bb3b2ae6511c0e8aaeb83a6a81fa8524c61fd08ea
|
7
|
+
data.tar.gz: 4f09aa4b93ad7fdb9e1717dcfc3b1f4d950bc87dadda4b81e4b498ba82910c614a02c027f67fffcff1b8a3351bacd82a20b29fac39148f56a4027560afbeac34
|
@@ -1,7 +1,11 @@
|
|
1
1
|
---
|
2
2
|
---
|
3
3
|
|
4
|
-
|
4
|
+
let mimeTypes
|
5
|
+
let showLoader
|
6
|
+
let closeLoader
|
7
|
+
let getFile
|
8
|
+
export const addScripts=()=>{
|
5
9
|
const scripts=document.getElementsByTagName('script')
|
6
10
|
const check= Array.from(scripts).find(item=>item.src==='https://www.dropbox.com/static/api/2/dropins.js')
|
7
11
|
if(!check){
|
@@ -27,11 +31,18 @@ const scope = [
|
|
27
31
|
]
|
28
32
|
let pickerApiLoaded = false
|
29
33
|
let oauthToken
|
30
|
-
const loadPicker = (
|
34
|
+
export const loadPicker = (mimeType,showLoader,closeLoader,getFile) => {
|
35
|
+
console.log(showLoder)
|
36
|
+
console.log(mimeType)
|
37
|
+
mimeTypes=mimeType
|
38
|
+
showLoader=showLoader
|
39
|
+
closeLoader=closeLoader
|
40
|
+
getFile=getFile
|
31
41
|
gapi.load('auth', { callback: onAuthApiLoad })
|
32
42
|
gapi.load('picker', { callback: onPickerApiLoad })
|
33
43
|
}
|
34
44
|
const onAuthApiLoad = () => {
|
45
|
+
|
35
46
|
window.gapi.auth.authorize(
|
36
47
|
{
|
37
48
|
client_id: clientId,
|
@@ -54,7 +65,7 @@ const handleAuthResult = (authResult) => {
|
|
54
65
|
const createPicker = () => {
|
55
66
|
if (pickerApiLoaded && oauthToken) {
|
56
67
|
const view = new google.picker.View(google.picker.ViewId.DOCS)
|
57
|
-
view.setMimeTypes(
|
68
|
+
view.setMimeTypes(mimeType)
|
58
69
|
const picker = new google.picker.PickerBuilder()
|
59
70
|
.enableFeature(google.picker.Feature.NAV_HIDDEN)
|
60
71
|
.enableFeature(google.picker.Feature.MULTISELECT_ENABLED)
|
@@ -87,7 +98,7 @@ const pickerCallback = async (data) => {
|
|
87
98
|
getFile(file)
|
88
99
|
}
|
89
100
|
}
|
90
|
-
|
101
|
+
export const chooseFromDropbox=(filemimes,showLoader,closeLoader,getDropBoxFile)=> {
|
91
102
|
Dropbox.choose({
|
92
103
|
success: async (files) => {
|
93
104
|
if (files.length < 0) {
|
@@ -112,43 +123,6 @@ function chooseFromDropbox(filemimes) {
|
|
112
123
|
})
|
113
124
|
}
|
114
125
|
|
115
|
-
const fileupload=(file)=>{
|
116
|
-
gapi.load('auth', {'callback': onAuthLoad});
|
117
|
-
}
|
118
|
-
const onAuthLoad=()=> {
|
119
|
-
window.gapi.auth.authorize(
|
120
|
-
{
|
121
|
-
'client_id': clientId,
|
122
|
-
'scope': scope,
|
123
|
-
'immediate': false
|
124
|
-
},
|
125
|
-
handleAuth);
|
126
|
-
}
|
127
|
-
const handleAuth=(authResult)=> {
|
128
|
-
if (authResult && !authResult.error) {
|
129
|
-
showuploadloading()
|
130
|
-
var formData = new FormData();
|
131
|
-
const fileToUpload = file
|
132
|
-
var metadata = {
|
133
|
-
name: fileToUpload.name,
|
134
|
-
mimeType: fileToUpload.type
|
135
|
-
};
|
136
|
-
formData.append( "metadata", new Blob( [JSON.stringify( metadata )], {type: "application/json"} ));
|
137
|
-
formData.append( "file", fileToUpload );
|
138
|
-
fetch( "https://www.googleapis.com/upload/drive/v3/files?uploadType=multipart", {
|
139
|
-
method: "POST",
|
140
|
-
headers: new Headers({ "Authorization": "Bearer " + gapi.auth.getToken().access_token }),
|
141
|
-
body: formData
|
142
|
-
}).then( function( response ){
|
143
|
-
stopuploadloading()
|
144
|
-
return response.json();
|
145
|
-
|
146
|
-
}).then( function( value ){
|
147
|
-
stopuploadloading()
|
148
|
-
showmessage()
|
149
|
-
});
|
150
|
-
}
|
151
|
-
}
|
152
126
|
|
153
127
|
|
154
128
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appscms-tools-theme
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- vivek-appscms
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-07-
|
11
|
+
date: 2021-07-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|