mirror of https://gitgud.io/fatchan/jschan.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
1.3 KiB
34 lines
1.3 KiB
include ./filelabel.pug
|
|
|
|
mixin fileform(name, max, total, addPath, deletePath, checkName, fileList, nameList, filePath, imageClass)
|
|
- const capitalName = `${name.charAt(0).toUpperCase()}${name.substring(1)}`;
|
|
h4.no-m-p Add #{capitalName}s (Max #{total})
|
|
.form-wrapper.flexleft.mt-10
|
|
form.form-post(action=addPath, enctype='multipart/form-data', method='POST')
|
|
input(type='hidden' name='_csrf' value=csrf)
|
|
.row
|
|
.label
|
|
span #{capitalName}#{max > 1 ? 's' : ''}
|
|
span.required *
|
|
if max > 1
|
|
|
|
|
|
|
|
small (Max #{max})
|
|
span.col
|
|
+filelabel(name, max)
|
|
input(id=name type='file', name='file' multiple required)
|
|
.upload-list(data-spoilers='false' data-strip-filenames='false')
|
|
input(type='submit', value='submit')
|
|
if fileList.length > 0
|
|
hr(size=1)
|
|
h4.no-m-p Delete #{capitalName}s:
|
|
.form-wrapper.flexleft.mt-10
|
|
form.form-post(action=deletePath, enctype='application/x-www-form-urlencoded', method='POST')
|
|
input(type='hidden' name='_csrf' value=csrf)
|
|
.catalog
|
|
each file, index in fileList
|
|
label.banner-check
|
|
input(type='checkbox' name=checkName value=nameList[index])
|
|
img(class=imageClass src=`${filePath}/${file}` loading='lazy')
|
|
small #{file.substring(0, file.lastIndexOf('.'))}
|
|
input(type='submit', value='delete')
|
|
|