diff --git a/sourcing/forms.py b/sourcing/forms.py index 37687db..e8abec2 100644 --- a/sourcing/forms.py +++ b/sourcing/forms.py @@ -1,5 +1,5 @@ from flask_wtf import Form -from wtforms.fields import StringField, PasswordField, BooleanField, HiddenField, TextAreaField, RadioField, FileField, IntegerField +from wtforms.fields import StringField, PasswordField, BooleanField, HiddenField, TextAreaField, FileField, IntegerField from wtforms.validators import InputRequired, Email, Length, ValidationError, Regexp, NoneOf, Optional from .model import User, LoginError, re_username, reserved_name, user_exists @@ -60,6 +60,9 @@ class PasswordForm(Form): class AccountSettingsForm(Form): full_name = StringField('full name', [Length(max=64)]) + email = StringField('e-mail address', + [InputRequired(), Email(), + Length(min=5, max=EMAIL_LEN)]) class ChangePasswordForm(Form): old_password = PasswordField('current password', diff --git a/sourcing/static/css/style.css b/sourcing/static/css/style.css index 2baf1d1..1e8410b 100644 --- a/sourcing/static/css/style.css +++ b/sourcing/static/css/style.css @@ -2,3 +2,7 @@ padding: 2px; background: yellow; } + +div#text { + font-family: Courier; +} diff --git a/sourcing/static/js/sourcedoc.js b/sourcing/static/js/sourcedoc.js index d8a7bab..cf2e711 100644 --- a/sourcing/static/js/sourcedoc.js +++ b/sourcing/static/js/sourcedoc.js @@ -48,13 +48,13 @@ $(function() { $("#show-span-selector").click(function(e) { e.preventDefault(); - $("#span-selector").removeClass("hidden"); + $("#span-selector").removeClass("d-none"); $(this).hide(); }); $("#select-all").click(function(e) { e.preventDefault(); - $("#span-selector").removeClass("hidden"); + $("#span-selector").removeClass("d-none"); $("#show-span-selector").hide(); $("#span").text(doc_url + ",start=0,length=" + doc_length); }); diff --git a/sourcing/templates/base.html b/sourcing/templates/base.html new file mode 100644 index 0000000..3f217b4 --- /dev/null +++ b/sourcing/templates/base.html @@ -0,0 +1,36 @@ + + + + + + +{% block title %}Xanadu{% endblock %} + + + +{% block style %} +{% endblock %} + + + +{% include "navbar.html" %} +{% block dialogs %} +{% endblock %} +
+{% include "flash_msg.html" %} + +{% block content %} +{% endblock %} + +
+ +
+ + + + +{% block scripts %} +{% endblock %} + + + diff --git a/sourcing/templates/flash_msg.html b/sourcing/templates/flash_msg.html index a390a28..76038fa 100644 --- a/sourcing/templates/flash_msg.html +++ b/sourcing/templates/flash_msg.html @@ -1,10 +1,12 @@ {% with messages = get_flashed_messages() %} {% if messages %} {% for message in messages %} - {% endfor %} {% endif %} {% endwith %} diff --git a/sourcing/templates/form/controls.html b/sourcing/templates/form/controls.html index 1c00ff0..fb60ea7 100644 --- a/sourcing/templates/form/controls.html +++ b/sourcing/templates/form/controls.html @@ -3,7 +3,7 @@ {{ field.label() }} {{ field(class="form-control", **kwargs) }} {% if field.description %} - {{ field.description|safe }} + {{ field.description|safe }} {% endif %} {% endmacro %} @@ -15,7 +15,7 @@ {{ field.label.text }} {% if field.description %} - {{ field.description|safe }} + {{ field.description|safe }} {% endif %} {% endmacro %} @@ -27,7 +27,7 @@ {{ field.label.text }} {% if field.description %} - {{ field.description|safe }} + {{ field.description|safe }} {% endif %} {% endmacro %} diff --git a/sourcing/templates/form/main.html b/sourcing/templates/form/main.html index a57b6fa..27b2589 100644 --- a/sourcing/templates/form/main.html +++ b/sourcing/templates/form/main.html @@ -1,10 +1,10 @@ -
+
{% include "form/errors.html" %}
{{ form.hidden_tag() }} {{ fields | safe }}
- +
diff --git a/sourcing/templates/form/simple.html b/sourcing/templates/form/simple.html index 97a9a68..cfa6139 100644 --- a/sourcing/templates/form/simple.html +++ b/sourcing/templates/form/simple.html @@ -1,10 +1,8 @@ -{% include "head.html" %} +{% extends "base.html" %} -
-
-

{{ title }}

- {% include "form/main.html" %} -
-
- -{% include "foot.html" %} +{% block content %} +

{{ self.title() }}

+ {% block form %} + {% include "form/main.html" %} + {% endblock %} +{% endblock %} diff --git a/sourcing/templates/home.html b/sourcing/templates/home.html index 81915ac..1dd66d4 100644 --- a/sourcing/templates/home.html +++ b/sourcing/templates/home.html @@ -1,5 +1,9 @@ -{% include "head.html" %} -

perma.pub

+{% extends "base.html" %} + +{% block title %}perma.pub{% endblock %} + +{% block content %} +

{{ self.title() }}

@@ -23,12 +27,11 @@

-new source document -new xanalink -new xanadoc +new source document +new xanalink +new xanadoc {# upload a source document #}

- -{% include "foot.html" %} +{% endblock %} diff --git a/sourcing/templates/login.html b/sourcing/templates/login.html index 420b442..da1f3d4 100644 --- a/sourcing/templates/login.html +++ b/sourcing/templates/login.html @@ -1,6 +1,7 @@ +{% extends "form/simple.html" %} {% from "form/controls.html" import render_field, checkbox, submit %} -{% set title="Login" %} +{% block title %}Login{% endblock %} {% set action=url_for('.login') %} {% set label="Sign in" %} @@ -14,10 +15,6 @@ {{ form.remember.label.text }} ยท - forgot password? + forgotten your password?
- - {% endset %} - -{% include "form/simple.html" %} diff --git a/sourcing/templates/navbar.html b/sourcing/templates/navbar.html index 53cc5ad..79ac6d2 100644 --- a/sourcing/templates/navbar.html +++ b/sourcing/templates/navbar.html @@ -1,32 +1,39 @@ -