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

View File

@ -85,7 +85,10 @@ export default Vue.extend({
}
} else {
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;
} else if (e.dataTransfer.files.length > 1) {
e.preventDefault();
alert(this.$t('only-one-file-attached'));
this.$root.dialog({
type: 'error',
text: this.$t('only-one-file-attached')
});
return;
}

View File

@ -125,7 +125,10 @@ export default Vue.extend({
this.form.upload(e.dataTransfer.files[0]);
return;
} 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;
}

View File

@ -1,6 +1,6 @@
<template>
<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)">
<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=""/>

View File

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

View File

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

View File

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

View File

@ -21,7 +21,7 @@
<option value="users">{{ $t('@.widgets.users') }}</option>
<option value="polls">{{ $t('@.widgets.polls') }}</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="hashtags">{{ $t('@.widgets.hashtags') }}</option>
<option value="posts-monitor">{{ $t('@.widgets.posts-monitor') }}</option>
@ -33,7 +33,7 @@
</header>
<x-draggable
:list="column.widgets"
:options="{ animation: 150 }"
animation="150"
@sort="onWidgetSort"
>
<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 => {
this.clear();
}).catch(err => {
alert('Something happened');
this.$root.dialog({
type: 'error',
text: this.$t('something-happened')
});
}).then(() => {
this.posting = false;
this.$nextTick(() => {

View File

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

View File

@ -34,7 +34,7 @@
<button @click="addWidget">{{ $t('add') }}</button>
</div>
<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>
</div>
</div>
@ -45,7 +45,8 @@
:list="widgets[place]"
:class="place"
:data-place="place"
:options="{ group: 'x', animation: 150 }"
group="x"
animation="150"
@sort="onWidgetSort"
:key="place"
>

View File

@ -34,7 +34,7 @@ export default Vue.extend({
document.title = title;
},
onOpenFolder(folder) {
const title = folder.name + ' | %i18n:@title%';
const title = `${folder.name} | ${this.$t('title')}`;
// Rewrite URL
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 initStore from './store';
import { apiUrl, version } from './config';
import { apiUrl, version, locale } from './config';
import Progress from './common/scripts/loading';
import Err from './common/views/components/connect-failed.vue';
@ -281,7 +281,7 @@ export default class MiOS extends EventEmitter {
// トークンが再生成されたとき
// このままではMisskeyが利用できないので強制的にサインアウトさせる
main.on('myTokenRegenerated', () => {
alert('%i18n:common.my-token-regenerated%');
alert(locale['common']['my-token-regenerated'])
this.signout();
});
}

View File

@ -136,7 +136,10 @@ export default Vue.extend({
},
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
width fit-content
width -moz-fit-content
max-width 100%
margin 0 auto
box-shadow 1px 1px 4px rgba(#000, 0.2)
overflow hidden
color var(--driveFileIcon)
justify-content center
> footer
padding 8px 8px 0 8px

View File

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

View File

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

View File

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

View File

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

View File

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