Browse Source

WIP distribusi descriptions through front matter markdown

main
crunk 6 months ago
parent
commit
94efe6ad83
  1. 22
      verse/distribusikan/forms/uploadform.py
  2. 14
      verse/distribusikan/templates/distribusikan/distribusiworkflow/upload.html
  3. 11
      verse/static/css/style.css

22
verse/distribusikan/forms/uploadform.py

@ -4,6 +4,7 @@ from wtforms import (
SelectField, SelectField,
StringField, StringField,
SubmitField, SubmitField,
TextAreaField,
validators, validators,
) )
from wtforms.validators import ( from wtforms.validators import (
@ -11,6 +12,7 @@ from wtforms.validators import (
Length, Length,
ValidationError, ValidationError,
) )
from wtforms.widgets import TextArea
from app import settings from app import settings
@ -48,6 +50,24 @@ class UploadForm(FlaskForm):
distribusiname, distribusiname,
], ],
) )
description = StringField(
"Description of this distribusi:",
validators=[
Length(10, 4096),
],
widget=TextArea(),
)
mdfile = FileField(
"Alternatively upload a markdown file with a description:",
validators=[
FileAllowed(["md"], "markdown only"),
FileRequired(),
FileSize(
max_size=10485760,
message="markdown file size should be smaller than 10MB",
),
],
)
year = SelectField( year = SelectField(
"Year:", "Year:",
validate_choice=True, validate_choice=True,
@ -77,7 +97,7 @@ class UploadForm(FlaskForm):
FileRequired(), FileRequired(),
FileSize( FileSize(
max_size=1073741824, max_size=1073741824,
message="Zipfile size must be smaller than 100MB", message="Zipfile size must be smaller than 1024MB",
), ),
], ],
) )

14
verse/distribusikan/templates/distribusikan/distribusiworkflow/upload.html

@ -10,6 +10,20 @@
<div class="error">{{ message }}</div> <div class="error">{{ message }}</div>
{% endfor %} {% endfor %}
</fieldset> </fieldset>
<fieldset class="required">
{{ uploadform.description.label }}
{{ uploadform.description }}
{% for message in uploadform.description.errors %}
<div class="error">{{ message }}</div>
{% endfor %}
</fieldset>
<fieldset class="required">
{{ uploadform.mdfile.label }}
{{ uploadform.mdfile }}
{% for message in uploadform.mdfile.errors %}
<div class="error">{{ message }}</div>
{% endfor %}
</fieldset>
<fieldset class="required"> <fieldset class="required">
{{ uploadform.year.label }} {{ uploadform.year.label }}
<div class="selector-style"> <div class="selector-style">

11
verse/static/css/style.css

@ -31,15 +31,10 @@ input[type=text], input[type=password], input[type=file] {
border: 1px solid #E0B0FF; border: 1px solid #E0B0FF;
} }
div#upload form {
padding-right: 15%;
}
.workflow{ .workflow{
margin-top: 1em; margin-top: 1em;
padding: 0.5em; padding: 0.5em;
padding-left: auto;
padding-right: auto;
width: 31em; width: 31em;
background-color:#fdfdfd; background-color:#fdfdfd;
text-decoration: none; text-decoration: none;
@ -69,7 +64,11 @@ div#upload form {
#distribusi-index { #distribusi-index {
padding-left: 1em; padding-left: 1em;
} }
textarea#description {
width: 100%;
height: 15em;
resize: none;
}
div#buttons{ div#buttons{
position: fixed; position: fixed;
top: 0.5em; top: 0.5em;

Loading…
Cancel
Save