This commit is contained in:
syuilo 2018-10-15 18:02:57 +09:00
parent a2206b2d52
commit 88fbc53e37
No known key found for this signature in database
GPG Key ID: BDC4C49D06AB9D69
2 changed files with 22 additions and 0 deletions

View File

@ -1239,6 +1239,8 @@ mobile/views/components/drive.file-detail.vue:
hash: "ハッシュ (md5)" hash: "ハッシュ (md5)"
exif: "EXIF" exif: "EXIF"
nsfw: "閲覧注意" nsfw: "閲覧注意"
mark-as-sensitive: "閲覧注意に設定"
unmark-as-sensitive: "閲覧注意を解除"
mobile/views/components/media-image.vue: mobile/views/components/media-image.vue:
sensitive: "閲覧注意" sensitive: "閲覧注意"

View File

@ -41,6 +41,8 @@
<ui-button link :href="`${file.url}?download`" :download="file.name">%fa:download% %i18n:@download%</ui-button> <ui-button link :href="`${file.url}?download`" :download="file.name">%fa:download% %i18n:@download%</ui-button>
<ui-button @click="rename">%fa:pencil-alt% %i18n:@rename%</ui-button> <ui-button @click="rename">%fa:pencil-alt% %i18n:@rename%</ui-button>
<ui-button @click="move">%fa:R folder-open% %i18n:@move%</ui-button> <ui-button @click="move">%fa:R folder-open% %i18n:@move%</ui-button>
<ui-button @click="toggleSensitive" v-if="file.isSensitive">%fa:R eye% %i18n:@unmark-as-sensitive%</ui-button>
<ui-button @click="toggleSensitive" v-else>%fa:R eye-slash% %i18n:@mark-as-sensitive%</ui-button>
<ui-button @click="del">%fa:trash-alt R% %i18n:@delete%</ui-button> <ui-button @click="del">%fa:trash-alt R% %i18n:@delete%</ui-button>
</div> </div>
</div> </div>
@ -71,25 +73,30 @@ import { gcd } from '../../../../../prelude/math';
export default Vue.extend({ export default Vue.extend({
props: ['file'], props: ['file'],
data() { data() {
return { return {
gcd, gcd,
exif: null exif: null
}; };
}, },
computed: { computed: {
browser(): any { browser(): any {
return this.$parent; return this.$parent;
}, },
kind(): string { kind(): string {
return this.file.type.split('/')[0]; return this.file.type.split('/')[0];
}, },
style(): any { style(): any {
return this.file.properties.avgColor && this.file.properties.avgColor.length == 3 ? { return this.file.properties.avgColor && this.file.properties.avgColor.length == 3 ? {
'background-color': `rgb(${ this.file.properties.avgColor.join(',') })` 'background-color': `rgb(${ this.file.properties.avgColor.join(',') })`
} : {}; } : {};
} }
}, },
methods: { methods: {
rename() { rename() {
const name = window.prompt('%i18n:@rename%', this.file.name); const name = window.prompt('%i18n:@rename%', this.file.name);
@ -101,6 +108,7 @@ export default Vue.extend({
this.browser.cf(this.file, true); this.browser.cf(this.file, true);
}); });
}, },
move() { move() {
(this as any).apis.chooseDriveFolder().then(folder => { (this as any).apis.chooseDriveFolder().then(folder => {
(this as any).api('drive/files/update', { (this as any).api('drive/files/update', {
@ -111,6 +119,7 @@ export default Vue.extend({
}); });
}); });
}, },
del() { del() {
(this as any).api('drive/files/delete', { (this as any).api('drive/files/delete', {
fileId: this.file.id fileId: this.file.id
@ -118,9 +127,20 @@ export default Vue.extend({
this.browser.cd(this.file.folderId, true); this.browser.cd(this.file.folderId, true);
}); });
}, },
toggleSensitive() {
(this as any).api('drive/files/update', {
fileId: this.file.id,
isSensitive: !this.file.isSensitive
});
this.file.isSensitive = !this.file.isSensitive;
},
showCreatedAt() { showCreatedAt() {
alert(new Date(this.file.createdAt).toLocaleString()); alert(new Date(this.file.createdAt).toLocaleString());
}, },
onImageLoaded() { onImageLoaded() {
const self = this; const self = this;
EXIF.getData(this.$refs.img, function(this: any) { EXIF.getData(this.$refs.img, function(this: any) {