This commit is contained in:
syuilo 2018-02-22 02:00:30 +09:00
parent 3d4fccef45
commit abf1c30ce6
9 changed files with 108 additions and 18 deletions

View file

@ -35,6 +35,7 @@ init(async (launch) => {
// Register components
require('./views/components');
// Launch the app
const [app, os] = launch(os => ({
chooseDriveFolder,
chooseDriveFile,
@ -65,19 +66,15 @@ init(async (launch) => {
}
}
app.$router.addRoutes([{
path: '/', name: 'index', component: MkIndex
}, {
path: '/i/customize-home', component: MkHomeCustomize
}, {
path: '/i/drive', component: MkDrive
}, {
path: '/i/drive/folder/:folder', component: MkDrive
}, {
path: '/selectdrive', component: MkSelectDrive
}, {
path: '/:user', component: MkUser
}]);
// Routing
app.$router.addRoutes([
{ path: '/', name: 'index', component: MkIndex },
{ path: '/i/customize-home', component: MkHomeCustomize },
{ path: '/i/drive', component: MkDrive },
{ path: '/i/drive/folder/:folder', component: MkDrive },
{ path: '/selectdrive', component: MkSelectDrive },
{ path: '/:user', component: MkUser }
]);
}, true);
function registerNotifications(stream: HomeStreamManager) {

View file

@ -0,0 +1,18 @@
import Chooser from '../views/components/drive-file-chooser.vue';
export default function(opts) {
return new Promise((res, rej) => {
const o = opts || {};
const w = new Chooser({
propsData: {
title: o.title,
multiple: o.multiple,
initFolder: o.currentFolder
}
}).$mount();
w.$once('selected', file => {
res(file);
});
document.body.appendChild(w.$el);
});
}

View file

@ -0,0 +1,17 @@
import Chooser from '../views/components/drive-folder-chooser.vue';
export default function(opts) {
return new Promise((res, rej) => {
const o = opts || {};
const w = new Chooser({
propsData: {
title: o.title,
initFolder: o.currentFolder
}
}).$mount();
w.$once('selected', folder => {
res(folder);
});
document.body.appendChild(w.$el);
});
}

View file

@ -0,0 +1,5 @@
export default function(opts) {
return new Promise<string>((res, rej) => {
alert('dialog not implemented yet');
});
}

View file

@ -0,0 +1,5 @@
export default function(opts) {
return new Promise<string>((res, rej) => {
alert('input not implemented yet');
});
}

View file

@ -0,0 +1,14 @@
export default opts => {
const app = document.getElementById('app');
app.style.display = 'none';
function recover() {
app.style.display = 'block';
}
const form = riot.mount(document.body.appendChild(document.createElement('mk-post-form')), opts)[0];
form
.on('cancel', recover)
.on('post', recover);
};

View file

@ -5,9 +5,22 @@
// Style
import './style.styl';
require('./tags');
import init from '../init';
import chooseDriveFolder from './api/choose-drive-folder';
import chooseDriveFile from './api/choose-drive-file';
import dialog from './api/dialog';
import input from './api/input';
import post from './api/post';
import notify from './api/notify';
import updateAvatar from './api/update-avatar';
import updateBanner from './api/update-banner';
import MkIndex from './views/pages/index.vue';
import MkUser from './views/pages/user/user.vue';
import MkSelectDrive from './views/pages/selectdrive.vue';
import MkDrive from './views/pages/drive.vue';
/**
* init
*/
@ -15,9 +28,30 @@ init((launch) => {
// Register directives
require('./views/directives');
// Register components
require('./views/components');
// http://qiita.com/junya/items/3ff380878f26ca447f85
document.body.setAttribute('ontouchstart', '');
// Start routing
//route(mios);
// Launch the app
const [app, os] = launch(os => ({
chooseDriveFolder,
chooseDriveFile,
dialog,
input,
post,
notify,
updateAvatar: updateAvatar(os),
updateBanner: updateBanner(os)
}));
// Routing
app.$router.addRoutes([
{ path: '/', name: 'index', component: MkIndex },
{ path: '/i/drive', component: MkDrive },
{ path: '/i/drive/folder/:folder', component: MkDrive },
{ path: '/selectdrive', component: MkSelectDrive },
{ path: '/:user', component: MkUser }
]);
}, true);

View file

@ -4,7 +4,7 @@
<header>
<h1>%i18n:mobile.tags.mk-drive-folder-selector.select-folder%</h1>
<button class="close" @click="cancel">%fa:times%</button>
<button v-if="opts.multiple" class="ok" @click="ok">%fa:check%</button>
<button class="ok" @click="ok">%fa:check%</button>
</header>
<mk-drive ref="browser"
select-folder

View file

@ -29,7 +29,7 @@ module.exports = Object.keys(langs).map(lang => {
// Entries
const entry = {
desktop: './src/web/app/desktop/script.ts',
//mobile: './src/web/app/mobile/script.ts',
mobile: './src/web/app/mobile/script.ts',
//ch: './src/web/app/ch/script.ts',
//stats: './src/web/app/stats/script.ts',
//status: './src/web/app/status/script.ts',