From 4db5ee438f278ec7a20fb2bf9c3555251fb3ee80 Mon Sep 17 00:00:00 2001 From: crunk Date: Fri, 4 Mar 2022 22:15:08 +0100 Subject: [PATCH] small fixes --- verse/forms/uploadform.py | 15 +++- verse/static/css/tags.css | 74 +++++++++++++++++++ verse/static/js/script.js | 1 + verse/templates/base.html | 1 + .../distribusiworkflow/selector.html | 4 - 5 files changed, 88 insertions(+), 7 deletions(-) create mode 100644 verse/static/css/tags.css diff --git a/verse/forms/uploadform.py b/verse/forms/uploadform.py index 360c154..1bc89a6 100644 --- a/verse/forms/uploadform.py +++ b/verse/forms/uploadform.py @@ -1,7 +1,12 @@ from flask_wtf import FlaskForm from flask_wtf.file import FileField, FileAllowed, FileRequired, FileSize from wtforms import validators -from wtforms.validators import Length, NumberRange, DataRequired +from wtforms.validators import ( + Length, + NumberRange, + DataRequired, + ValidationError, +) from wtforms import ( SubmitField, StringField, @@ -13,9 +18,13 @@ from wtforms import ( class UploadForm(FlaskForm): """File upload class for a new site in distribusi-verse""" + def distribusiname(form, field): + if field.data.lower() == "new": + raise ValidationError("Name has to be unique and not just new.") + sitename = StringField( "Name of your website:", - validators=[validators.InputRequired(), Length(2, 100)], + validators=[validators.InputRequired(), Length(2, 100), distribusiname], ) academicyear = StringField( "Academic year:", @@ -36,7 +45,7 @@ class UploadForm(FlaskForm): validators=[DataRequired()] ) tags = StringField( - "Add search tags, comma-separated:", + "Add tags, press enter or add a comma after each tag:", validators=[validators.InputRequired(), Length(2, 500)], ) diff --git a/verse/static/css/tags.css b/verse/static/css/tags.css new file mode 100644 index 0000000..aad0e32 --- /dev/null +++ b/verse/static/css/tags.css @@ -0,0 +1,74 @@ +::selection{ + color: #fff; + background: #5372F0; +} +.wrapper{ + width: 496px; + background: #fff; + padding: 18px 25px 20px; + box-shadow: 0 0 30px rgba(0,0,0,0.06); +} +.wrapper :where(.title, li, li i, .details){ + display: flex; + align-items: center; +} +.title img{ + max-width: 21px; +} +.title h2{ + font-size: 21px; + font-weight: 600; + margin-left: 8px; +} +.wrapper .content{ + margin: 10px 0; +} +.tags p{ + font-size: 15px; +} +.tags ul{ + display: flex; + flex-wrap: wrap; + padding: 7px; + margin: 12px 0; + border-radius: 5px; + border: 1px solid #a6a6a6; +} +.tags ul li{ + color: #333; + margin: 4px 3px; + list-style: none; + background: #F2F2F2; + padding: 5px 8px 5px 10px; + border: 1px solid #e3e1e1; +} +.tags ul li i{ + height: 20px; + width: 20px; + color: #808080; + margin-left: 8px; + font-size: 12px; + cursor: pointer; + border-radius: 50%; + background: #dfdfdf; + justify-content: center; +} +.tags ul input{ + flex: 1; + padding: 5px; + border: none; + outline: none; + font-size: 16px; +} +.wrapper .details{ + justify-content: space-between; +} +.details button{ + border: none; + background: #E0B0FF; + text-decoration: none; + margin: 1px; +} +.details button:hover{ + background: #2c52ed; +} diff --git a/verse/static/js/script.js b/verse/static/js/script.js index d14dd2d..2bd662b 100644 --- a/verse/static/js/script.js +++ b/verse/static/js/script.js @@ -16,6 +16,7 @@ function scrollToLaunch() { } } + document.addEventListener("DOMContentLoaded", scrollToTheme); document.addEventListener("DOMContentLoaded", scrollToLaunch); diff --git a/verse/templates/base.html b/verse/templates/base.html index 2379f17..84333b8 100644 --- a/verse/templates/base.html +++ b/verse/templates/base.html @@ -6,6 +6,7 @@ Autonomous Practices X Distribusi-Verse + diff --git a/verse/templates/distribusiworkflow/selector.html b/verse/templates/distribusiworkflow/selector.html index 969ca8b..26187b3 100644 --- a/verse/templates/distribusiworkflow/selector.html +++ b/verse/templates/distribusiworkflow/selector.html @@ -13,17 +13,13 @@
- {{ selectorform.update.label }} {{ selectorform.update }}
- {{ selectorform.delete.label }} {{ selectorform.delete }}
-

Alternatively you can make a new site

- {{ selectorform.new.label }} {{ selectorform.new }}