appscms-tools-theme 0.9.2 → 0.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/_includes/share/socialshare.html +4 -3
- data/assets/js/googledrive.js +53 -9
- 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: 33c221c34fd9946100b5a6e912f8030fb955c2a7fe97d205b5cb6060cfb6c804
|
|
4
|
+
data.tar.gz: c85f15b2649fefe0e1645484b889bd1d2c804c398d6c00504ca5aafd27b84a9e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 305a03e907b6ad3d1362c341dc3d1c6ade6c74947d922f5768e62bca624b1528a34e0055937f6a44f73d8bc1b62fd85140fac8bd9da488a0eda26698e6962a62
|
|
7
|
+
data.tar.gz: 592f0a11a2aec4624bd4b4c7c2cd4c62031418a5737189e4455c1dde7ba8dab0b36095b3dc2a30e7fe3121a18b13b13ae717b91a9c294071c90e3666e9236c4e
|
data/assets/js/googledrive.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
1
|
+
---
|
|
2
|
+
---
|
|
3
|
+
const developerKey = '{{site.developerKey}}'
|
|
4
|
+
const clientId ='{{site.clientId}}'
|
|
5
|
+
const appId = '{{site.appId}}'
|
|
5
6
|
const scope = [
|
|
6
7
|
'https://www.googleapis.com/auth/drive.file',
|
|
7
8
|
'https://www.googleapis.com/auth/drive.appdata',
|
|
@@ -35,7 +36,7 @@ const handleAuthResult = (authResult) => {
|
|
|
35
36
|
const createPicker = () => {
|
|
36
37
|
if (pickerApiLoaded && oauthToken) {
|
|
37
38
|
const view = new google.picker.View(google.picker.ViewId.DOCS)
|
|
38
|
-
view.setMimeTypes(
|
|
39
|
+
view.setMimeTypes(mimeTypes)
|
|
39
40
|
const picker = new google.picker.PickerBuilder()
|
|
40
41
|
.enableFeature(google.picker.Feature.NAV_HIDDEN)
|
|
41
42
|
.enableFeature(google.picker.Feature.MULTISELECT_ENABLED)
|
|
@@ -51,6 +52,7 @@ const createPicker = () => {
|
|
|
51
52
|
}
|
|
52
53
|
const pickerCallback = async (data) => {
|
|
53
54
|
if (data.action == google.picker.Action.PICKED) {
|
|
55
|
+
showLoader()
|
|
54
56
|
const res = await fetch(
|
|
55
57
|
`https://www.googleapis.com/drive/v3/files/${data.docs[0].id}?alt=media`,
|
|
56
58
|
{
|
|
@@ -63,6 +65,7 @@ const pickerCallback = async (data) => {
|
|
|
63
65
|
type: data.docs[0].mimeType,
|
|
64
66
|
}
|
|
65
67
|
let file = new File([res], data.docs[0].name, metadata)
|
|
68
|
+
closeLoader()
|
|
66
69
|
getFile(file)
|
|
67
70
|
}
|
|
68
71
|
}
|
|
@@ -82,9 +85,50 @@ function chooseFromDropbox() {
|
|
|
82
85
|
getDropBoxFile(newFile)
|
|
83
86
|
},
|
|
84
87
|
cancel: function () {},
|
|
85
|
-
linkType: 'direct',
|
|
86
|
-
multiselect: false,
|
|
87
|
-
extensions: ['.jpg'],
|
|
88
|
-
folderselect: false,
|
|
88
|
+
linkType: 'direct',
|
|
89
|
+
multiselect: false,
|
|
90
|
+
extensions: ['.jpg'],
|
|
91
|
+
folderselect: false,
|
|
89
92
|
})
|
|
90
93
|
}
|
|
94
|
+
|
|
95
|
+
const fileupload=(file)=>{
|
|
96
|
+
gapi.load('auth', {'callback': onAuthLoad});
|
|
97
|
+
}
|
|
98
|
+
const onAuthLoad=()=> {
|
|
99
|
+
window.gapi.auth.authorize(
|
|
100
|
+
{
|
|
101
|
+
'client_id': clientId,
|
|
102
|
+
'scope': scope,
|
|
103
|
+
'immediate': false
|
|
104
|
+
},
|
|
105
|
+
handleAuth);
|
|
106
|
+
}
|
|
107
|
+
const handleAuth=(authResult)=> {
|
|
108
|
+
if (authResult && !authResult.error) {
|
|
109
|
+
showuploadloading()
|
|
110
|
+
var formData = new FormData();
|
|
111
|
+
const fileToUpload = file
|
|
112
|
+
var metadata = {
|
|
113
|
+
name: fileToUpload.name,
|
|
114
|
+
mimeType: fileToUpload.type
|
|
115
|
+
};
|
|
116
|
+
formData.append( "metadata", new Blob( [JSON.stringify( metadata )], {type: "application/json"} ));
|
|
117
|
+
formData.append( "file", fileToUpload );
|
|
118
|
+
fetch( "https://www.googleapis.com/upload/drive/v3/files?uploadType=multipart", {
|
|
119
|
+
method: "POST",
|
|
120
|
+
headers: new Headers({ "Authorization": "Bearer " + gapi.auth.getToken().access_token }),
|
|
121
|
+
body: formData
|
|
122
|
+
}).then( function( response ){
|
|
123
|
+
stopuploadloading()
|
|
124
|
+
return response.json();
|
|
125
|
+
|
|
126
|
+
}).then( function( value ){
|
|
127
|
+
stopuploadloading()
|
|
128
|
+
showmessage()
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
|
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: 0.9.
|
|
4
|
+
version: 0.9.3
|
|
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-06-
|
|
11
|
+
date: 2021-06-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: jekyll
|