1
1
mirror of https://github.com/kokonect-link/cherrypick synced 2024-11-05 01:25:57 +09:00
Co-authored-by: syuilo <syuilotan@yahoo.co.jp>
This commit is contained in:
Aya Morisawa 2018-12-26 19:39:51 +09:00
parent 09c57e6d03
commit c8b45f4f42
No known key found for this signature in database
GPG Key ID: 3E64865D70D579F2
2 changed files with 16 additions and 16 deletions

View File

@ -1,4 +1,4 @@
import { apiUrl } from '../../config'; import { apiUrl, locale } from '../../config';
import CropWindow from '../views/components/crop-window.vue'; import CropWindow from '../views/components/crop-window.vue';
import ProgressDialog from '../views/components/progress-dialog.vue'; import ProgressDialog from '../views/components/progress-dialog.vue';
@ -9,7 +9,7 @@ export default ($root: any) => {
const regex = RegExp('\.(jpg|jpeg|png|gif|webp|bmp|tiff)$'); const regex = RegExp('\.(jpg|jpeg|png|gif|webp|bmp|tiff)$');
if (!regex.test(file.name) ) { if (!regex.test(file.name) ) {
$root.dialog({ $root.dialog({
title: '%fa:info-circle% %i18n:desktop.invalid-filetype%', title: locale['desktop']['invalid-filetype'],
text: null text: null
}); });
return reject('invalid-filetype'); return reject('invalid-filetype');
@ -17,7 +17,7 @@ export default ($root: any) => {
const w = $root.new(CropWindow, { const w = $root.new(CropWindow, {
image: file, image: file,
title: '%i18n:desktop.avatar-crop-title%', title: locale['desktop']['avatar-crop-title'],
aspectRatio: 1 / 1 aspectRatio: 1 / 1
}); });
@ -27,11 +27,11 @@ export default ($root: any) => {
data.append('file', blob, file.name + '.cropped.png'); data.append('file', blob, file.name + '.cropped.png');
$root.api('drive/folders/find', { $root.api('drive/folders/find', {
name: '%i18n:desktop.avatar%' name: locale['desktop']['avatar']
}).then(avatarFolder => { }).then(avatarFolder => {
if (avatarFolder.length === 0) { if (avatarFolder.length === 0) {
$root.api('drive/folders/create', { $root.api('drive/folders/create', {
name: '%i18n:desktop.avatar%' name: locale['desktop']['avatar']
}).then(iconFolder => { }).then(iconFolder => {
resolve(upload(data, iconFolder)); resolve(upload(data, iconFolder));
}); });
@ -52,7 +52,7 @@ export default ($root: any) => {
const upload = (data, folder) => new Promise((resolve, reject) => { const upload = (data, folder) => new Promise((resolve, reject) => {
const dialog = $root.new(ProgressDialog, { const dialog = $root.new(ProgressDialog, {
title: '%i18n:desktop.uploading-avatar%' title: locale['desktop']['uploading-avatar']
}); });
document.body.appendChild(dialog.$el); document.body.appendChild(dialog.$el);
@ -88,7 +88,7 @@ export default ($root: any) => {
}); });
$root.dialog({ $root.dialog({
title: '%fa:info-circle% %i18n:desktop.avatar-updated%', title: locale['desktop']['avatar-updated'],
text: null text: null
}); });
@ -101,7 +101,7 @@ export default ($root: any) => {
? Promise.resolve(file) ? Promise.resolve(file)
: $root.$chooseDriveFile({ : $root.$chooseDriveFile({
multiple: false, multiple: false,
title: '%fa:image% %i18n:desktop.choose-avatar%' title: locale['desktop']['choose-avatar']
}); });
return selectedFile return selectedFile

View File

@ -1,4 +1,4 @@
import { apiUrl } from '../../config'; import { apiUrl, locale } from '../../config';
import CropWindow from '../views/components/crop-window.vue'; import CropWindow from '../views/components/crop-window.vue';
import ProgressDialog from '../views/components/progress-dialog.vue'; import ProgressDialog from '../views/components/progress-dialog.vue';
@ -9,7 +9,7 @@ export default ($root: any) => {
const regex = RegExp('\.(jpg|jpeg|png|gif|webp|bmp|tiff)$'); const regex = RegExp('\.(jpg|jpeg|png|gif|webp|bmp|tiff)$');
if (!regex.test(file.name) ) { if (!regex.test(file.name) ) {
$root.dialog({ $root.dialog({
title: '%fa:info-circle% %i18n:desktop.invalid-filetype%', title: locale['desktop']['invalid-filetype'],
text: null text: null
}); });
return reject('invalid-filetype'); return reject('invalid-filetype');
@ -17,7 +17,7 @@ export default ($root: any) => {
const w = $root.new(CropWindow, { const w = $root.new(CropWindow, {
image: file, image: file,
title: '%i18n:desktop.banner-crop-title%', title: locale['desktop']['banner-crop-title'],
aspectRatio: 16 / 9 aspectRatio: 16 / 9
}); });
@ -27,11 +27,11 @@ export default ($root: any) => {
data.append('file', blob, file.name + '.cropped.png'); data.append('file', blob, file.name + '.cropped.png');
$root.api('drive/folders/find', { $root.api('drive/folders/find', {
name: '%i18n:desktop.banner%' name: locale['desktop']['banner']
}).then(bannerFolder => { }).then(bannerFolder => {
if (bannerFolder.length === 0) { if (bannerFolder.length === 0) {
$root.api('drive/folders/create', { $root.api('drive/folders/create', {
name: '%i18n:desktop.banner%' name: locale['desktop']['banner']
}).then(iconFolder => { }).then(iconFolder => {
resolve(upload(data, iconFolder)); resolve(upload(data, iconFolder));
}); });
@ -52,7 +52,7 @@ export default ($root: any) => {
const upload = (data, folder) => new Promise((resolve, reject) => { const upload = (data, folder) => new Promise((resolve, reject) => {
const dialog = $root.new(ProgressDialog, { const dialog = $root.new(ProgressDialog, {
title: '%i18n:desktop.uploading-banner%' title: locale['desktop']['uploading-banner']
}); });
document.body.appendChild(dialog.$el); document.body.appendChild(dialog.$el);
@ -88,7 +88,7 @@ export default ($root: any) => {
}); });
$root.dialog({ $root.dialog({
title: '%fa:info-circle% %i18n:desktop.banner-updated%', title: locale['desktop']['banner-updated'],
text: null text: null
}); });
@ -101,7 +101,7 @@ export default ($root: any) => {
? Promise.resolve(file) ? Promise.resolve(file)
: $root.$chooseDriveFile({ : $root.$chooseDriveFile({
multiple: false, multiple: false,
title: '%fa:image% %i18n:desktop.choose-banner%' title: locale['desktop']['choose-banner']
}); });
return selectedFile return selectedFile