nfp_sites/filadelfia_web/app/page_upload.js
TheThing ec7ade938f
Some checks failed
/ deploy (push) Failing after -63h57m0s
More dev
2023-11-15 04:43:05 +00:00

63 lines
1.4 KiB
JavaScript

const m = require('mithril')
const Authentication = require('./authentication')
const api = require('./api')
const Input = require('./input')
const Upload = {
oninit: function(vnode) {
Authentication.requiresLogin()
this.error = ''
let d = new Date()
d.setDate(d.getDate() - d.getDay())
d.setHours(11)
d.setMinutes(0)
d.setSeconds(0)
d.setMilliseconds(0)
this.form = {
title: '',
date: d,
file: null,
}
},
uploadvideo: function(vnode, e) {
console.log(this.form)
return false
},
view: function(vnode) {
return [
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: 'text',
utility: 'datetime',
form: this.form,
formKey: 'date',
}),
m('input.spinner', {
hidden: api.loading,
type: 'submit',
value: 'Begin upload',
}),
api.loading ? m('div.loading-spinner') : null,
]),
]),
]),
]
},
}
module.exports = Upload