色々な修正; Fix #4709 (#4714)

* Fix a la carte 1

* use dialog instead of alert() etc
This commit is contained in:
tamaina 2019-04-16 13:05:10 +09:00 committed by syuilo
parent ba3879a95a
commit f966d0b32c
21 changed files with 79 additions and 29 deletions

View File

@ -313,6 +313,7 @@ common:
nav: "ナビゲーション" nav: "ナビゲーション"
tips: "ヒント" tips: "ヒント"
hashtags: "ハッシュタグ" hashtags: "ハッシュタグ"
queue: "キュー"
dev: "アプリの作成に失敗しました。再度お試しください。" dev: "アプリの作成に失敗しました。再度お試しください。"
ai-chan-kawaii: "藍ちゃかわいい" ai-chan-kawaii: "藍ちゃかわいい"
@ -1549,6 +1550,7 @@ desktop/views/widgets/polls.vue:
desktop/views/widgets/post-form.vue: desktop/views/widgets/post-form.vue:
title: "投稿" title: "投稿"
note: "投稿" note: "投稿"
something-happened: "何らかの事情で投稿できませんでした。"
desktop/views/widgets/profile.vue: desktop/views/widgets/profile.vue:
update-banner: "クリックでバナー編集" update-banner: "クリックでバナー編集"
@ -1641,7 +1643,7 @@ mobile/views/components/post-form.vue:
quote-placeholder: "この投稿を引用... (オプション)" quote-placeholder: "この投稿を引用... (オプション)"
reply-placeholder: "この投稿への返信..." reply-placeholder: "この投稿への返信..."
cw-placeholder: "内容への注釈 (オプション)" cw-placeholder: "内容への注釈 (オプション)"
location-alert: "お使いの端末は位置情報に対応していません" geolocation-alert: "お使いの端末は位置情報に対応していません"
error: "エラー" error: "エラー"
username-prompt: "ユーザー名を入力してください" username-prompt: "ユーザー名を入力してください"

View File

@ -85,7 +85,10 @@ export default Vue.extend({
} }
} else { } else {
if (items[0].kind == 'file') { if (items[0].kind == 'file') {
alert(this.$t('only-one-file-attached')); this.$root.dialog({
type: 'error',
text: this.$t('only-one-file-attached')
});
} }
} }
}, },
@ -107,7 +110,10 @@ export default Vue.extend({
return; return;
} else if (e.dataTransfer.files.length > 1) { } else if (e.dataTransfer.files.length > 1) {
e.preventDefault(); e.preventDefault();
alert(this.$t('only-one-file-attached')); this.$root.dialog({
type: 'error',
text: this.$t('only-one-file-attached')
});
return; return;
} }

View File

@ -125,7 +125,10 @@ export default Vue.extend({
this.form.upload(e.dataTransfer.files[0]); this.form.upload(e.dataTransfer.files[0]);
return; return;
} else if (e.dataTransfer.files.length > 1) { } else if (e.dataTransfer.files.length > 1) {
alert(this.$t('only-one-file-attached')); this.$root.dialog({
type: 'error',
text: this.$t('only-one-file-attached')
});
return; return;
} }

View File

@ -1,6 +1,6 @@
<template> <template>
<div class="skeikyzd" v-show="files.length != 0"> <div class="skeikyzd" v-show="files.length != 0">
<x-draggable class="files" :list="files" :options="{ animation: 150 }"> <x-draggable class="files" :list="files" animation="150">
<div v-for="file in files" :key="file.id" @click="showFileMenu(file, $event)" @contextmenu.prevent="showFileMenu(file, $event)"> <div v-for="file in files" :key="file.id" @click="showFileMenu(file, $event)" @contextmenu.prevent="showFileMenu(file, $event)">
<x-file-thumbnail :data-id="file.id" class="thumbnail" :file="file" fit="cover"/> <x-file-thumbnail :data-id="file.id" class="thumbnail" :file="file" fit="cover"/>
<img class="remove" @click.stop="detachMedia(file.id)" src="/assets/desktop/remove.png" :title="$t('attach-cancel')" alt=""/> <img class="remove" @click.stop="detachMedia(file.id)" src="/assets/desktop/remove.png" :title="$t('attach-cancel')" alt=""/>

View File

@ -542,8 +542,8 @@ export default Vue.extend({
this.latestVersion = newer; this.latestVersion = newer;
if (newer == null) { if (newer == null) {
this.$root.dialog({ this.$root.dialog({
title: this.$t('no-updates'), title: this.$t('@._settings.no-updates'),
text: this.$t('no-updates-desc') text: this.$t('@._settings.no-updates-desc')
}); });
} else { } else {
this.$root.dialog({ this.$root.dialog({

View File

@ -79,7 +79,10 @@ export default Vue.extend({
localStorage.setItem('i', res.i); localStorage.setItem('i', res.i);
location.reload(); location.reload();
}).catch(() => { }).catch(() => {
alert(this.$t('login-failed')); this.$root.dialog({
type: 'error',
text: this.$t('login-failed')
});
this.signing = false; this.signing = false;
}); });
} }

View File

@ -153,7 +153,10 @@ export default Vue.extend({
location.href = '/'; location.href = '/';
}); });
}).catch(() => { }).catch(() => {
alert(this.$t('some-error')); this.$root.dialog({
type: 'error',
text: this.$t('some-error')
});
if (this.meta.enableRecaptcha) { if (this.meta.enableRecaptcha) {
(window as any).grecaptcha.reset(); (window as any).grecaptcha.reset();

View File

@ -21,7 +21,7 @@
<option value="users">{{ $t('@.widgets.users') }}</option> <option value="users">{{ $t('@.widgets.users') }}</option>
<option value="polls">{{ $t('@.widgets.polls') }}</option> <option value="polls">{{ $t('@.widgets.polls') }}</option>
<option value="post-form">{{ $t('@.widgets.post-form') }}</option> <option value="post-form">{{ $t('@.widgets.post-form') }}</option>
<option value="messaging">{{ $t('@.widgets.messaging') }}</option> <option value="messaging">{{ $t('@.messaging') }}</option>
<option value="memo">{{ $t('@.widgets.memo') }}</option> <option value="memo">{{ $t('@.widgets.memo') }}</option>
<option value="hashtags">{{ $t('@.widgets.hashtags') }}</option> <option value="hashtags">{{ $t('@.widgets.hashtags') }}</option>
<option value="posts-monitor">{{ $t('@.widgets.posts-monitor') }}</option> <option value="posts-monitor">{{ $t('@.widgets.posts-monitor') }}</option>
@ -33,7 +33,7 @@
</header> </header>
<x-draggable <x-draggable
:list="column.widgets" :list="column.widgets"
:options="{ animation: 150 }" animation="150"
@sort="onWidgetSort" @sort="onWidgetSort"
> >
<div v-for="widget in column.widgets" class="customize-container" :key="widget.id" @contextmenu.stop.prevent="widgetFunc(widget.id)"> <div v-for="widget in column.widgets" class="customize-container" :key="widget.id" @contextmenu.stop.prevent="widgetFunc(widget.id)">

View File

@ -188,7 +188,10 @@ export default define({
}).then(data => { }).then(data => {
this.clear(); this.clear();
}).catch(err => { }).catch(err => {
alert('Something happened'); this.$root.dialog({
type: 'error',
text: this.$t('something-happened')
});
}).then(() => { }).then(() => {
this.posting = false; this.posting = false;
this.$nextTick(() => { this.$nextTick(() => {

View File

@ -161,7 +161,10 @@ export default Vue.extend({
}); });
break; break;
default: default:
alert(this.$t('unhandled-error')); this.$root.dialog({
type: 'error',
text: this.$t('unhandled-error')
});
} }
}); });
} }

View File

@ -320,7 +320,10 @@ export default Vue.extend({
}); });
break; break;
default: default:
alert(this.$t('unhandled-error')); this.$root.dialog({
type: 'error',
text: this.$t('unhandled-error')
});
} }
}); });
} }

View File

@ -364,7 +364,10 @@ export default Vue.extend({
setGeo() { setGeo() {
if (navigator.geolocation == null) { if (navigator.geolocation == null) {
alert(this.$t('geolocation-alert')); this.$root.dialog({
type: 'warning',
text: this.$t('geolocation-alert')
});
return; return;
} }
@ -372,7 +375,11 @@ export default Vue.extend({
this.geo = pos.coords; this.geo = pos.coords;
this.$emit('geo-attached', this.geo); this.$emit('geo-attached', this.geo);
}, err => { }, err => {
alert(`%i18n:@error%: ${err.message}`); this.$root.dialog({
type: 'error',
title: this.$t('error')
text: err.message
});
}, { }, {
enableHighAccuracy: true enableHighAccuracy: true
}); });

View File

@ -34,7 +34,7 @@
<button @click="addWidget">{{ $t('add') }}</button> <button @click="addWidget">{{ $t('add') }}</button>
</div> </div>
<div class="trash"> <div class="trash">
<x-draggable v-model="trash" :options="{ group: 'x' }" @add="onTrash"></x-draggable> <x-draggable v-model="trash" group="x" @add="onTrash"></x-draggable>
<p>{{ $t('@.trash') }}</p> <p>{{ $t('@.trash') }}</p>
</div> </div>
</div> </div>
@ -45,7 +45,8 @@
:list="widgets[place]" :list="widgets[place]"
:class="place" :class="place"
:data-place="place" :data-place="place"
:options="{ group: 'x', animation: 150 }" group="x"
animation="150"
@sort="onWidgetSort" @sort="onWidgetSort"
:key="place" :key="place"
> >

View File

@ -34,7 +34,7 @@ export default Vue.extend({
document.title = title; document.title = title;
}, },
onOpenFolder(folder) { onOpenFolder(folder) {
const title = folder.name + ' | %i18n:@title%'; const title = `${folder.name} | ${this.$t('title')}`;
// Rewrite URL // Rewrite URL
history.pushState(null, title, `/i/drive/folder/${folder.id}`); history.pushState(null, title, `/i/drive/folder/${folder.id}`);

View File

@ -4,7 +4,7 @@ import { EventEmitter } from 'eventemitter3';
import * as uuid from 'uuid'; import * as uuid from 'uuid';
import initStore from './store'; import initStore from './store';
import { apiUrl, version } from './config'; import { apiUrl, version, locale } from './config';
import Progress from './common/scripts/loading'; import Progress from './common/scripts/loading';
import Err from './common/views/components/connect-failed.vue'; import Err from './common/views/components/connect-failed.vue';
@ -281,7 +281,7 @@ export default class MiOS extends EventEmitter {
// トークンが再生成されたとき // トークンが再生成されたとき
// このままではMisskeyが利用できないので強制的にサインアウトさせる // このままではMisskeyが利用できないので強制的にサインアウトさせる
main.on('myTokenRegenerated', () => { main.on('myTokenRegenerated', () => {
alert('%i18n:common.my-token-regenerated%'); alert(locale['common']['my-token-regenerated'])
this.signout(); this.signout();
}); });
} }

View File

@ -136,7 +136,10 @@ export default Vue.extend({
}, },
showCreatedAt() { showCreatedAt() {
alert(new Date(this.file.createdAt).toLocaleString()); this.$root.dialog({
type: 'info',
text: (new Date(this.file.createdAt)).toLocaleString()
});
} }
} }
}); });
@ -150,11 +153,13 @@ export default Vue.extend({
> .preview > .preview
width fit-content width fit-content
width -moz-fit-content
max-width 100% max-width 100%
margin 0 auto margin 0 auto
box-shadow 1px 1px 4px rgba(#000, 0.2) box-shadow 1px 1px 4px rgba(#000, 0.2)
overflow hidden overflow hidden
color var(--driveFileIcon) color var(--driveFileIcon)
justify-content center
> footer > footer
padding 8px 8px 0 8px padding 8px 8px 0 8px

View File

@ -283,14 +283,21 @@ export default Vue.extend({
setGeo() { setGeo() {
if (navigator.geolocation == null) { if (navigator.geolocation == null) {
alert(this.$t('location-alert')); this.$root.dialog({
type: 'warning',
text: this.$t('geolocation-alert')
});
return; return;
} }
navigator.geolocation.getCurrentPosition(pos => { navigator.geolocation.getCurrentPosition(pos => {
this.geo = pos.coords; this.geo = pos.coords;
}, err => { }, err => {
alert(`%i18n:@error%: ${err.message}`); this.$root.dialog({
type: 'error',
title: this.$t('error')
text: err.message
});
}, { }, {
enableHighAccuracy: true enableHighAccuracy: true
}); });

View File

@ -32,7 +32,7 @@ export default Vue.extend({
this.fetch(); this.fetch();
}, },
mounted() { mounted() {
document.title = `${this.$root.instanceName} | %i18n:@notifications%`; document.title = `${this.$root.instanceName} | ${this.$t('@.favorites')}`;
}, },
methods: { methods: {
fetch() { fetch() {

View File

@ -15,7 +15,7 @@ export default Vue.extend({
XReversi: () => import('../../../../common/views/components/games/reversi/reversi.vue').then(m => m.default) XReversi: () => import('../../../../common/views/components/games/reversi/reversi.vue').then(m => m.default)
}, },
mounted() { mounted() {
document.title = `${this.$root.instanceName} %i18n:@reversi%`; document.title = `${this.$root.instanceName} | ${this.$t('reversi')}`;
}, },
methods: { methods: {
nav(game, actualNav) { nav(game, actualNav) {

View File

@ -50,7 +50,7 @@ export default Vue.extend({
} }
}, },
mounted() { mounted() {
document.title = `%i18n:@search%: ${this.q} | ${this.$root.instanceName}`; document.title = `${this.$t('search')}: ${this.q} | ${this.$root.instanceName}`;
}, },
methods: { methods: {
inited() { inited() {

View File

@ -29,7 +29,8 @@
</header> </header>
<x-draggable <x-draggable
:list="widgets" :list="widgets"
:options="{ handle: '.handle', animation: 150 }" handle=".handle"
animation="150"
@sort="onWidgetSort" @sort="onWidgetSort"
> >
<div v-for="widget in widgets" class="customize-container" :key="widget.id"> <div v-for="widget in widgets" class="customize-container" :key="widget.id">
@ -106,7 +107,10 @@ export default Vue.extend({
methods: { methods: {
hint() { hint() {
alert(this.$t('widgets-hints')); this.$root.dialog({
type: 'info',
text: this.$t('widgets-hints')
});
}, },
widgetFunc(id) { widgetFunc(id) {