This commit is contained in:
syuilo 2017-11-08 20:03:58 +09:00
parent 5a711df958
commit 1c60dfe2d9
9 changed files with 81 additions and 16 deletions

View file

@ -242,6 +242,12 @@ desktop:
mk-drive-browser-nav-folder: mk-drive-browser-nav-folder:
drive: "Drive" drive: "Drive"
mk-selectdrive-page:
title: "Choose a file(s)"
ok: "OK"
cancel: "Cancel"
upload: "Upload a file(s) from you PC"
mk-nav-home-widget: mk-nav-home-widget:
about: "About" about: "About"
stats: "Stats" stats: "Stats"

View file

@ -242,6 +242,12 @@ desktop:
mk-drive-browser-nav-folder: mk-drive-browser-nav-folder:
drive: "ドライブ" drive: "ドライブ"
mk-selectdrive-page:
title: "ファイルを選択してください"
ok: "決定"
cancel: "キャンセル"
upload: "PCからドライブにファイルをアップロード"
mk-nav-home-widget: mk-nav-home-widget:
about: "Misskeyについて" about: "Misskeyについて"
stats: "統計" stats: "統計"

View file

@ -7,15 +7,17 @@ const route = require('page');
let page = null; let page = null;
export default me => { export default me => {
route('/', index); route('/', index);
route('/selectdrive', selectDrive); route('/selectdrive', selectDrive);
route('/i>mentions', mentions); route('/i/drive', drive);
route('/post::post', post); route('/i/drive/folder/:folder', drive);
route('/search::query', search); route('/i/mentions', mentions);
route('/:user', user.bind(null, 'home')); route('/post::post', post);
route('/:user/graphs', user.bind(null, 'graphs')); route('/search::query', search);
route('/:user/:post', post); route('/:user', user.bind(null, 'home'));
route('*', notFound); route('/:user/graphs', user.bind(null, 'graphs'));
route('/:user/:post', post);
route('*', notFound);
function index() { function index() {
me ? home() : entrance(); me ? home() : entrance();
@ -59,6 +61,12 @@ export default me => {
mount(document.createElement('mk-selectdrive-page')); mount(document.createElement('mk-selectdrive-page'));
} }
function drive(ctx) {
const el = document.createElement('mk-drive-page');
if (ctx.params.folder) el.setAttribute('folder', ctx.params.folder);
mount(el);
}
function notFound() { function notFound() {
mount(document.createElement('mk-not-found')); mount(document.createElement('mk-not-found'));
} }

View file

@ -2,7 +2,8 @@
<nav> <nav>
<div class="path" oncontextmenu={ pathOncontextmenu }> <div class="path" oncontextmenu={ pathOncontextmenu }>
<mk-drive-browser-nav-folder class={ current: folder == null } folder={ null }/> <mk-drive-browser-nav-folder class={ current: folder == null } folder={ null }/>
<virtual each={ folder in hierarchyFolders }><span class="separator"><i class="fa fa-angle-right"></i></span> <virtual each={ folder in hierarchyFolders }>
<span class="separator"><i class="fa fa-angle-right"></i></span>
<mk-drive-browser-nav-folder folder={ folder }/> <mk-drive-browser-nav-folder folder={ folder }/>
</virtual> </virtual>
<span class="separator" if={ folder != null }><i class="fa fa-angle-right"></i></span> <span class="separator" if={ folder != null }><i class="fa fa-angle-right"></i></span>
@ -571,6 +572,7 @@
if (folder.parent) dive(folder.parent); if (folder.parent) dive(folder.parent);
this.update(); this.update();
this.trigger('open-folder', folder);
this.fetch(); this.fetch();
}); });
}; };
@ -640,6 +642,7 @@
folder: null, folder: null,
hierarchyFolders: [] hierarchyFolders: []
}); });
this.trigger('move-root');
this.fetch(); this.fetch();
}; };

View file

@ -62,6 +62,7 @@ require('./pages/post.tag');
require('./pages/search.tag'); require('./pages/search.tag');
require('./pages/not-found.tag'); require('./pages/not-found.tag');
require('./pages/selectdrive.tag'); require('./pages/selectdrive.tag');
require('./pages/drive.tag');
require('./autocomplete-suggestion.tag'); require('./autocomplete-suggestion.tag');
require('./progress-dialog.tag'); require('./progress-dialog.tag');
require('./user-preview.tag'); require('./user-preview.tag');

View file

@ -0,0 +1,37 @@
<mk-drive-page>
<mk-drive-browser ref="browser" folder={ opts.folder }/>
<style>
:scope
display block
position fixed
width 100%
height 100%
background #fff
> mk-drive-browser
height 100%
</style>
<script>
this.on('mount', () => {
document.title = 'Misskey Drive';
this.refs.browser.on('move-root', () => {
const title = 'Misskey Drive';
// Rewrite URL
history.pushState(null, title, '/i/drive');
document.title = title;
});
this.refs.browser.on('open-folder', folder => {
const title = folder.name + ' | Misskey Drive';
// Rewrite URL
history.pushState(null, title, '/i/drive/folder/' + folder.id);
document.title = title;
});
});
</script>
</mk-drive-page>

View file

@ -1,15 +1,16 @@
<mk-selectdrive-page> <mk-selectdrive-page>
<mk-drive-browser ref="browser" multiple={ multiple }/> <mk-drive-browser ref="browser" multiple={ multiple }/>
<div> <div>
<button class="upload" title="PCからドライブにファイルをアップロード" onclick={ upload }><i class="fa fa-upload"></i></button> <button class="upload" title="%i18n:desktop.tags.mk-selectdrive-page.upload%" onclick={ upload }><i class="fa fa-upload"></i></button>
<button class="cancel" onclick={ close }>キャンセル</button> <button class="cancel" onclick={ close }>%i18n:desktop.tags.mk-selectdrive-page.cancel%</button>
<button class="ok" onclick={ ok }>決定</button> <button class="ok" onclick={ ok }>%i18n:desktop.tags.mk-selectdrive-page.ok%</button>
</div> </div>
<style> <style>
:scope :scope
display block display block
position fixed position fixed
width 100%
height 100% height 100%
background #fff background #fff
@ -130,7 +131,7 @@
this.multiple = q.get('multiple') == 'true' ? true : false; this.multiple = q.get('multiple') == 'true' ? true : false;
this.on('mount', () => { this.on('mount', () => {
document.documentElement.style.background = '#fff'; document.title = '%i18n:desktop.tags.mk-selectdrive-page.title%';
this.refs.browser.on('selected', file => { this.refs.browser.on('selected', file => {
this.files = [file]; this.files = [file];

View file

@ -564,7 +564,7 @@
<p><i class="fa fa-cloud"></i>%i18n:desktop.tags.mk-ui-header-account.drive%<i class="fa fa-angle-right"></i></p> <p><i class="fa fa-cloud"></i>%i18n:desktop.tags.mk-ui-header-account.drive%<i class="fa fa-angle-right"></i></p>
</li> </li>
<li> <li>
<a href="/i>mentions"><i class="fa fa-at"></i>%i18n:desktop.tags.mk-ui-header-account.mentions%<i class="fa fa-angle-right"></i></a> <a href="/i/mentions"><i class="fa fa-at"></i>%i18n:desktop.tags.mk-ui-header-account.mentions%<i class="fa fa-angle-right"></i></a>
</li> </li>
</ul> </ul>
<ul> <ul>

View file

@ -2,7 +2,7 @@
<div class="container"> <div class="container">
<div class="thumbnail" style={ 'background-image: url(' + file.url + '?thumbnail&size=128)' }></div> <div class="thumbnail" style={ 'background-image: url(' + file.url + '?thumbnail&size=128)' }></div>
<div class="body"> <div class="body">
<p class="name">{ file.name }</p> <p class="name"><span>{ file.name.lastIndexOf('.') != -1 ? file.name.substr(0, file.name.lastIndexOf('.')) : file.name }</span><span class="ext" if={ file.name.lastIndexOf('.') != -1 }>{ file.name.substr(file.name.lastIndexOf('.')) }</span></p>
<!-- <!--
if file.tags.length > 0 if file.tags.length > 0
ul.tags ul.tags
@ -64,6 +64,9 @@
text-overflow ellipsis text-overflow ellipsis
overflow-wrap break-word overflow-wrap break-word
> .ext
opacity 0.5
> .tags > .tags
display block display block
margin 4px 0 0 0 margin 4px 0 0 0