update to bootstrap4
This commit is contained in:
parent
5b08b6bee6
commit
7a112ab1d4
|
@ -1,5 +1,5 @@
|
||||||
from flask_wtf import Form
|
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 wtforms.validators import InputRequired, Email, Length, ValidationError, Regexp, NoneOf, Optional
|
||||||
from .model import User, LoginError, re_username, reserved_name, user_exists
|
from .model import User, LoginError, re_username, reserved_name, user_exists
|
||||||
|
|
||||||
|
@ -60,6 +60,9 @@ class PasswordForm(Form):
|
||||||
|
|
||||||
class AccountSettingsForm(Form):
|
class AccountSettingsForm(Form):
|
||||||
full_name = StringField('full name', [Length(max=64)])
|
full_name = StringField('full name', [Length(max=64)])
|
||||||
|
email = StringField('e-mail address',
|
||||||
|
[InputRequired(), Email(),
|
||||||
|
Length(min=5, max=EMAIL_LEN)])
|
||||||
|
|
||||||
class ChangePasswordForm(Form):
|
class ChangePasswordForm(Form):
|
||||||
old_password = PasswordField('current password',
|
old_password = PasswordField('current password',
|
||||||
|
|
|
@ -2,3 +2,7 @@
|
||||||
padding: 2px;
|
padding: 2px;
|
||||||
background: yellow;
|
background: yellow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
div#text {
|
||||||
|
font-family: Courier;
|
||||||
|
}
|
||||||
|
|
|
@ -48,13 +48,13 @@ $(function() {
|
||||||
|
|
||||||
$("#show-span-selector").click(function(e) {
|
$("#show-span-selector").click(function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
$("#span-selector").removeClass("hidden");
|
$("#span-selector").removeClass("d-none");
|
||||||
$(this).hide();
|
$(this).hide();
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#select-all").click(function(e) {
|
$("#select-all").click(function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
$("#span-selector").removeClass("hidden");
|
$("#span-selector").removeClass("d-none");
|
||||||
$("#show-span-selector").hide();
|
$("#show-span-selector").hide();
|
||||||
$("#span").text(doc_url + ",start=0,length=" + doc_length);
|
$("#span").text(doc_url + ",start=0,length=" + doc_length);
|
||||||
});
|
});
|
||||||
|
|
36
sourcing/templates/base.html
Normal file
36
sourcing/templates/base.html
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<title>{% block title %}Xanadu{% endblock %}</title>
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="{{ url_for('static', filename='bootstrap4/css/bootstrap.css') }}">
|
||||||
|
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
|
||||||
|
{% block style %}
|
||||||
|
{% endblock %}
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
{% include "navbar.html" %}
|
||||||
|
{% block dialogs %}
|
||||||
|
{% endblock %}
|
||||||
|
<div class="container mt-3">
|
||||||
|
{% include "flash_msg.html" %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
<hr/>
|
||||||
|
<footer>© 2017 Project Xanadu</footer>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="{{ url_for('static', filename='jquery/jquery.js') }}"></script>
|
||||||
|
<script src="{{ url_for('static', filename='bootstrap4/js/bootstrap.js') }}"></script>
|
||||||
|
|
||||||
|
{% block scripts %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -2,7 +2,9 @@
|
||||||
{% if messages %}
|
{% if messages %}
|
||||||
{% for message in messages %}
|
{% for message in messages %}
|
||||||
<div class="alert alert-success alert-dismissible" role="alert">
|
<div class="alert alert-success alert-dismissible" role="alert">
|
||||||
<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
|
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
{{ message }}
|
{{ message }}
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
{{ field.label() }}
|
{{ field.label() }}
|
||||||
{{ field(class="form-control", **kwargs) }}
|
{{ field(class="form-control", **kwargs) }}
|
||||||
{% if field.description %}
|
{% if field.description %}
|
||||||
<span class="help">{{ field.description|safe }}</span>
|
<span class="form-text text-muted">{{ field.description|safe }}</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
@ -15,7 +15,7 @@
|
||||||
{{ field.label.text }}
|
{{ field.label.text }}
|
||||||
</label>
|
</label>
|
||||||
{% if field.description %}
|
{% if field.description %}
|
||||||
<span class="help">{{ field.description|safe }}</span>
|
<span class="form-text text-muted">{{ field.description|safe }}</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
{{ field.label.text }}
|
{{ field.label.text }}
|
||||||
</label>
|
</label>
|
||||||
{% if field.description %}
|
{% if field.description %}
|
||||||
<span class="help">{{ field.description|safe }}</span>
|
<span class="form-text text-muted">{{ field.description|safe }}</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
<div class="well">
|
<div>
|
||||||
{% include "form/errors.html" %}
|
{% include "form/errors.html" %}
|
||||||
<form action="{{action}}" method="{{method|default('post')}}" role="form">
|
<form action="{{action}}" method="{{method|default('post')}}" role="form">
|
||||||
{{ form.hidden_tag() }}
|
{{ form.hidden_tag() }}
|
||||||
{{ fields | safe }}
|
{{ fields | safe }}
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<button type="submit" class="btn btn-default">{{ label }}</button>
|
<button type="submit" class="btn btn-primary">{{ label }}</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
{% include "head.html" %}
|
{% extends "base.html" %}
|
||||||
|
|
||||||
<div class="row">
|
{% block content %}
|
||||||
<div class="col-md-12">
|
<h1 class="mt-3">{{ self.title() }}</h1>
|
||||||
<h1>{{ title }}</h1>
|
{% block form %}
|
||||||
{% include "form/main.html" %}
|
{% include "form/main.html" %}
|
||||||
</div>
|
{% endblock %}
|
||||||
</div>
|
{% endblock %}
|
||||||
|
|
||||||
{% include "foot.html" %}
|
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
{% include "head.html" %}
|
{% extends "base.html" %}
|
||||||
<h1>perma.pub</h1>
|
|
||||||
|
{% block title %}perma.pub{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<h1>{{ self.title() }}</h1>
|
||||||
|
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<thead>
|
<thead>
|
||||||
|
@ -23,12 +27,11 @@
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<a href="{{ url_for('.new_sourcedoc') }}" class="btn btn-default">new source document</a>
|
<a href="{{ url_for('.new_sourcedoc') }}" class="btn btn-primary">new source document</a>
|
||||||
<a href="{{ url_for('.new_xanalink') }}" class="btn btn-default">new xanalink</a>
|
<a href="{{ url_for('.new_xanalink') }}" class="btn btn-primary">new xanalink</a>
|
||||||
<a href="{{ url_for('.new_xanadoc') }}" class="btn btn-default">new xanadoc</a>
|
<a href="{{ url_for('.new_xanadoc') }}" class="btn btn-primary">new xanadoc</a>
|
||||||
{#
|
{#
|
||||||
<a href="#" class="btn btn-default">upload a source document</a>
|
<a href="#" class="btn btn-default">upload a source document</a>
|
||||||
#}
|
#}
|
||||||
</p>
|
</p>
|
||||||
|
{% endblock %}
|
||||||
{% include "foot.html" %}
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
|
{% extends "form/simple.html" %}
|
||||||
{% from "form/controls.html" import render_field, checkbox, submit %}
|
{% from "form/controls.html" import render_field, checkbox, submit %}
|
||||||
|
|
||||||
{% set title="Login" %}
|
{% block title %}Login{% endblock %}
|
||||||
{% set action=url_for('.login') %}
|
{% set action=url_for('.login') %}
|
||||||
{% set label="Sign in" %}
|
{% set label="Sign in" %}
|
||||||
|
|
||||||
|
@ -14,10 +15,6 @@
|
||||||
{{ form.remember.label.text }}
|
{{ form.remember.label.text }}
|
||||||
</label>
|
</label>
|
||||||
·
|
·
|
||||||
<a href="{{ url_for('.password_reset') }}">forgot password?</a>
|
<a href="{{ url_for('.password_reset') }}">forgotten your password?</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
{% endset %}
|
{% endset %}
|
||||||
|
|
||||||
{% include "form/simple.html" %}
|
|
||||||
|
|
|
@ -1,31 +1,38 @@
|
||||||
<nav class="navbar navbar-default">
|
<nav class="navbar navbar-toggleable-md navbar-light bg-faded">
|
||||||
<div class="container-fluid">
|
<div class="container">
|
||||||
<div class="navbar-header">
|
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
|
||||||
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
|
<span class="navbar-toggler-icon"></span>
|
||||||
<span class="sr-only">Toggle navigation</span>
|
|
||||||
<span class="icon-bar"></span>
|
|
||||||
<span class="icon-bar"></span>
|
|
||||||
<span class="icon-bar"></span>
|
|
||||||
</button>
|
</button>
|
||||||
<a class="navbar-brand" href="{{ url_for('.home') }}">{{ config.SITE_NAME }}</a>
|
<a class="navbar-brand" href="{{ url_for('.home') }}">Xanadu</a>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="navbar" class="navbar-collapse collapse">
|
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||||
<ul class="nav navbar-nav">
|
<ul class="navbar-nav mr-auto">
|
||||||
{% for page in ('home',) %}
|
{% for page in ('home',) %}
|
||||||
<li{% if current_page == page %} class="active"{% endif %}><a href="{{ url_for('.' + page) }}">{{ page | title }}</a></li>
|
<li class="nav-item{{ ' active' if current_page == page }}">
|
||||||
|
<a class="nav-link" href="{{ url_for('.' + page) }}">{{ page | capitalize }}</a>
|
||||||
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
<ul class="nav navbar-nav navbar-right">
|
<ul class="navbar-nav">
|
||||||
{% if current_user.is_authenticated %}
|
{% if current_user.is_authenticated %}
|
||||||
{% if current_user.admin %}
|
{% if current_user.admin %}
|
||||||
<li><a href="{{ url_for('.admin') }}">admin</a></li>
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="{{ url_for('.admin') }}">admin</a>
|
||||||
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<li><a href="{{ url_for('.account_settings') }}">{{ current_user.username }}</a></li>
|
<li class="nav-item">
|
||||||
<li><a href="{{ url_for('.logout') }}">logout</a></li>
|
<a class="nav-link" href="{{ url_for('.account_settings') }}">{{ current_user.username }}</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="{{ url_for('.logout') }}">logout</a>
|
||||||
|
</li>
|
||||||
{% else %}
|
{% else %}
|
||||||
<li><a href="{{ url_for('.signup') }}">signup</a></li>
|
<li class="nav-item">
|
||||||
<li><a href="{{ url_for('.login') }}">login</a></li>
|
<a class="nav-link" href="{{ url_for('.signup') }}">signup</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="{{ url_for('.login') }}">login</a>
|
||||||
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,15 +1,11 @@
|
||||||
|
{% extends "form/simple.html" %}
|
||||||
{% from "form/controls.html" import render_field %}
|
{% from "form/controls.html" import render_field %}
|
||||||
|
|
||||||
|
{% block title %}New{% endblock %}
|
||||||
|
|
||||||
{% set action=url_for(request.endpoint) %}
|
{% set action=url_for(request.endpoint) %}
|
||||||
{% set label="save" %}
|
{% set label="save" %}
|
||||||
|
|
||||||
{% set fields %}
|
{% set fields %}
|
||||||
{#
|
|
||||||
{{ render_field(form.filename) }}
|
|
||||||
{{ render_field(form.db_price_per_character) }}
|
|
||||||
{{ render_field(form.db_document_price) }}
|
|
||||||
#}
|
|
||||||
{{ render_field(form.text, rows=20) }}
|
{{ render_field(form.text, rows=20) }}
|
||||||
{% endset %}
|
{% endset %}
|
||||||
|
|
||||||
{% include "form/simple.html" %}
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
|
{% extends "form/simple.html" %}
|
||||||
{% from "form/controls.html" import render_field %}
|
{% from "form/controls.html" import render_field %}
|
||||||
|
|
||||||
{% set title="Sign up" %}
|
{% block title %}Sign up{% endblock %}
|
||||||
|
|
||||||
{% set action=url_for('.signup') %}
|
{% set action=url_for('.signup') %}
|
||||||
{% set label="Sign up" %}
|
{% set label="Sign up" %}
|
||||||
|
|
||||||
|
@ -9,5 +11,3 @@
|
||||||
{{ render_field(form.password) }}
|
{{ render_field(form.password) }}
|
||||||
{{ render_field(form.email) }}
|
{{ render_field(form.email) }}
|
||||||
{% endset %}
|
{% endset %}
|
||||||
|
|
||||||
{% include "form/simple.html" %}
|
|
||||||
|
|
|
@ -1,17 +1,13 @@
|
||||||
{% set title = doc.filename %}
|
{% extends "base.html" %}
|
||||||
|
|
||||||
|
{% block title %}{{ doc.filename }}{% endblock %}
|
||||||
{% set price = doc.document_price %}
|
{% set price = doc.document_price %}
|
||||||
{% include "head.html" %}
|
|
||||||
|
|
||||||
<style>
|
{% block content %}
|
||||||
div#text { font-family: Courier; }
|
<h1>{{ self.title() }}
|
||||||
</style>
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-xs-12">
|
|
||||||
<h1>{{ title }}
|
|
||||||
{% if doc.user == current_user %}
|
{% if doc.user == current_user %}
|
||||||
<a href="{{ url_for('.edit_source_document',
|
<a href="{{ url_for('.edit_source_document',
|
||||||
filename=doc.filename) }}" class="btn btn-default">edit</a>
|
filename=doc.filename) }}" class="btn btn-primary">edit</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</h1>
|
</h1>
|
||||||
<p><a href="{{ url_for('.home') }}">back to index</a></p>
|
<p><a href="{{ url_for('.home') }}">back to index</a></p>
|
||||||
|
@ -22,12 +18,9 @@ div#text { font-family: Courier; }
|
||||||
<li>price per character: {{ '{:,.2f}'.format(doc.price_per_character) }} nanobucks</li>
|
<li>price per character: {{ '{:,.2f}'.format(doc.price_per_character) }} nanobucks</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</ul>
|
</ul>
|
||||||
<div class="well" id="text">
|
<div id="text">
|
||||||
{%- for start, line in iter_lines(doc.get_text()) if line -%}
|
{%- for start, line in iter_lines(doc.get_text()) if line -%}
|
||||||
<p data-start="{{ start }}">{{ line }}</p>
|
<p data-start="{{ start }}">{{ line }}</p>
|
||||||
{%- endfor -%}
|
{%- endfor -%}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
{% endblock %}
|
||||||
</div>
|
|
||||||
|
|
||||||
{% include "foot.html" %}
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
{% set fields %}
|
{% set fields %}
|
||||||
{{ render_field(form.full_name) }}
|
{{ render_field(form.full_name) }}
|
||||||
|
{{ render_field(form.email) }}
|
||||||
{% endset %}
|
{% endset %}
|
||||||
|
|
||||||
{% include "form/simple.html" %}
|
{% include "form/simple.html" %}
|
||||||
|
|
|
@ -1,24 +1,20 @@
|
||||||
{% set title = doc.title() %}
|
{% extends "base.html" %}
|
||||||
{% include "head.html" %}
|
|
||||||
|
|
||||||
<style>
|
{% block title %}{{ doc.title() }}{% endblock %}
|
||||||
div#text { font-family: Courier; }
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<div class="row">
|
{% block content %}
|
||||||
<div class="col-xs-12">
|
<h1>{{ self.title() }}
|
||||||
<h1>{{ title }}
|
|
||||||
{# {% if doc.user == current_user %} #}
|
{# {% if doc.user == current_user %} #}
|
||||||
<a href="{{ doc.edit_url }}" class="btn btn-default">edit</a>
|
<a href="{{ doc.edit_url }}" class="btn btn-primary">edit</a>
|
||||||
{# {% endif %} #}
|
{# {% endif %} #}
|
||||||
{% if doc.type == 'xanadoc' %}
|
{% if doc.type == 'xanadoc' %}
|
||||||
<a href="{{ doc.url }}" class="btn btn-default">fulfil</a>
|
<a href="{{ doc.url }}" class="btn btn-primary">fulfil</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<a href="{{ request.url }}/raw" class="btn btn-default">raw</a>
|
<a href="{{ request.url }}/raw" class="btn btn-primary">raw</a>
|
||||||
</h1>
|
</h1>
|
||||||
<p><a href="{{ url_for('.home') }}">back to index</a></p>
|
<p><a href="{{ url_for('.home') }}">back to index</a></p>
|
||||||
|
|
||||||
<div class="well" id="text">
|
<div id="text">
|
||||||
{% if span_length %}
|
{% if span_length %}
|
||||||
{%- for start, line in add_highlight(doc.text, span_start, span_length) if line -%}
|
{%- for start, line in add_highlight(doc.text, span_start, span_length) if line -%}
|
||||||
<p data-start="{{ start }}">
|
<p data-start="{{ start }}">
|
||||||
|
@ -43,19 +39,16 @@ div#text { font-family: Courier; }
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if doc.type == 'sourcedoc' and not span_length %}
|
{% if doc.type == 'sourcedoc' and not span_length %}
|
||||||
<button id="show-span-selector" class="btn btn-default">show span selector</button>
|
<button id="show-span-selector" class="btn btn-primary">show span selector</button>
|
||||||
<button id="select-all" class="btn btn-default">get entire document span</button>
|
<button id="select-all" class="btn btn-primary">get entire document span</button>
|
||||||
<p id="span-selector" class="hidden">span: <span id="span"></span></p>
|
<p id="span-selector" class="d-none">span: <span id="span"></span></p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
{% endblock %}
|
||||||
</div>
|
|
||||||
|
|
||||||
{% set scripts %}
|
{% block scripts %}
|
||||||
<script>
|
<script>
|
||||||
var doc_url = '{{ doc.external_url }}';
|
var doc_url = '{{ doc.external_url }}';
|
||||||
var doc_length = {{ doc.text | length }};
|
var doc_length = {{ doc.text | length }};
|
||||||
</script>
|
</script>
|
||||||
<script src="{{ url_for('static', filename='js/sourcedoc.js') }}"></script>
|
<script src="{{ url_for('static', filename='js/sourcedoc.js') }}"></script>
|
||||||
{% endset %}
|
{% endblock %}
|
||||||
|
|
||||||
{% include "foot.html" %}
|
|
||||||
|
|
Loading…
Reference in a new issue