2023-11-09 09:44:04 +00:00
|
|
|
const m = require('mithril')
|
|
|
|
const Authentication = require('./authentication')
|
|
|
|
const api = require('./api')
|
2023-11-14 07:27:04 +00:00
|
|
|
const Input = require('./input')
|
2023-11-09 09:44:04 +00:00
|
|
|
|
2023-11-14 07:27:04 +00:00
|
|
|
const Upload = {
|
2023-11-09 09:44:04 +00:00
|
|
|
oninit: function(vnode) {
|
2023-11-14 07:27:04 +00:00
|
|
|
Authentication.requiresLogin()
|
2023-11-09 09:44:04 +00:00
|
|
|
this.error = ''
|
2023-11-14 07:27:04 +00:00
|
|
|
this.form = {
|
2023-11-09 09:44:04 +00:00
|
|
|
title: '',
|
2023-11-14 07:27:04 +00:00
|
|
|
date: new Date(),
|
2023-11-09 09:44:04 +00:00
|
|
|
file: null,
|
|
|
|
}
|
|
|
|
},
|
2023-11-14 07:27:04 +00:00
|
|
|
|
|
|
|
uploadvideo: function(vnode, e) {
|
2023-11-09 09:44:04 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
view: function(vnode) {
|
|
|
|
return [
|
2023-11-14 07:27:04 +00:00
|
|
|
m('div.page.page-upload', [
|
|
|
|
m('div.modal', [
|
|
|
|
m('form', {
|
|
|
|
onsubmit: this.uploadvideo.bind(this, vnode),
|
|
|
|
}, [
|
|
|
|
m('h3', 'Upload new video'),
|
|
|
|
this.error ? m('p.error', this.error) : null,
|
|
|
|
m(Input, {
|
|
|
|
label: 'Title',
|
|
|
|
form: this.form,
|
|
|
|
formKey: 'title',
|
|
|
|
}),
|
|
|
|
m(Input, {
|
|
|
|
label: 'Date',
|
|
|
|
type: 'datetime',
|
|
|
|
form: this.form,
|
|
|
|
formKey: 'date',
|
|
|
|
}),
|
|
|
|
m('input.spinner', {
|
|
|
|
hidden: api.loading,
|
|
|
|
type: 'submit',
|
|
|
|
value: 'Log in',
|
|
|
|
}),
|
|
|
|
api.loading ? m('div.loading-spinner') : null,
|
|
|
|
]),
|
|
|
|
m('div.login--asuna.spritesheet'),
|
2023-11-09 09:44:04 +00:00
|
|
|
]),
|
|
|
|
]),
|
|
|
|
]
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2023-11-14 07:27:04 +00:00
|
|
|
module.exports = Upload
|