Commit cbba767a authored by Willard's avatar Willard

More styling of landing page, reordering views

parent 8d0a7b22
...@@ -5,8 +5,8 @@ from wtforms.validators import DataRequired, EqualTo, Email ...@@ -5,8 +5,8 @@ from wtforms.validators import DataRequired, EqualTo, Email
from models import Owner, Stall, Dish from models import Owner, Stall, Dish
class OwnerLoginForm(FlaskForm): class OwnerLoginForm(FlaskForm):
username = StringField('Username', [DataRequired()]) username = StringField('Username', [DataRequired()], render_kw={"placeholder": "Username"})
password = PasswordField('Password', [DataRequired()]) password = PasswordField('Password', [DataRequired()], render_kw={"placeholder": "Password"})
def validate(self): def validate(self):
if not FlaskForm.validate(self): if not FlaskForm.validate(self):
...@@ -23,11 +23,11 @@ class OwnerLoginForm(FlaskForm): ...@@ -23,11 +23,11 @@ class OwnerLoginForm(FlaskForm):
return True, owner return True, owner
class OwnerRegisterForm(FlaskForm): class OwnerRegisterForm(FlaskForm):
email = StringField('Email', [DataRequired(), Email()]) email = StringField('Email', [DataRequired(), Email()], render_kw={"placeholder": "E-mail"})
name = StringField('Name', [DataRequired()]) name = StringField('Name', [DataRequired()], render_kw={"placeholder": "Name"})
username = StringField('Username', [DataRequired()]) username = StringField('Username', [DataRequired()], render_kw={"placeholder": "Username"})
password = PasswordField('Password', [DataRequired()]) password = PasswordField('Password', [DataRequired()], render_kw={"placeholder": "Password"})
confirm_password = PasswordField('Confirm Password', [EqualTo('password')]) confirm_password = PasswordField('Confirm Password', [EqualTo('password')], render_kw={"placeholder": "Confirm Password"})
def validate(self): def validate(self):
if not FlaskForm.validate(self): if not FlaskForm.validate(self):
......
This diff is collapsed.
This diff is collapsed.
.btn-lg {
border-radius: 0px;
}
.form-group-lg .form-control {
border-radius: 0px;
}
\ No newline at end of file
...@@ -7,12 +7,26 @@ ...@@ -7,12 +7,26 @@
<title>Canteeneo - {% block title %}{% endblock%}</title> <title>Canteeneo - {% block title %}{% endblock%}</title>
{% endblock %} {% endblock %}
<link rel="stylesheet" href="{{ url_for('static', filename='css/bootstrap.css') }}"> <link rel="stylesheet" href="{{ url_for('static', filename='css/bootstrap.css') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='css/custom.css') }}">
</head> </head>
<body> <body>
<div class="container-fluid"> <div class="container-fluid">
{% with messages = get_flashed_messages() %} {% if messages %} {% for message in messages %} <div class="row">
<span>{{ message }}</span><br> {% endfor %} {% endif %} {% endwith %} {% block content %} {% endblock %} {% with messages = get_flashed_messages() %}
{% if messages %}
{% for message in messages %}
<div class="alert alert-danger alert-dismissible" role="alert">
{{ message }}
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
{% endfor %}
{% endif %}
{% endwith %}
</div>
{% block content %} {% endblock %}
</div> </div>
</body> </body>
<script src="{{ url_for('static', filename='js/jquery-3.1.1.js') }}"></script> <script src="{{ url_for('static', filename='js/jquery-3.1.1.js') }}"></script>
......
...@@ -5,45 +5,44 @@ ...@@ -5,45 +5,44 @@
{% block content %} {% block content %}
<div class="row"> <div class="row">
<div class="col-md-4 col-md-offset-2"> <div class="col-md-4 col-md-offset-2">
<div style="padding: 5%;">
<h1>Login</h1>
<form method="POST" action="/login"> <form method="POST" action="/login">
{{ login_form.csrf_token }} {{ login_form.csrf_token }}
<div class="form-group"> <div class="form-group form-group-lg">
{{ login_form.username.label }}
{{ login_form.username(class_="form-control") }} {{ login_form.username(class_="form-control") }}
</div> </div>
<div class="form-group"> <div class="form-group form-group-lg">
{{ login_form.password.label }}
{{ login_form.password(class_="form-control") }} {{ login_form.password(class_="form-control") }}
</div> </div>
<button class="btn btn-default btn-large" type="submit">Login</button> <button class="btn btn-primary btn-lg" type="submit">Login</button>
</form> </form>
</div> </div>
</div>
<div class="col-md-4"> <div class="col-md-4">
<div style="padding: 5%;">
<h1>Register</h1>
<form method="POST" action="/register"> <form method="POST" action="/register">
{{ register_form.csrf_token }} {{ register_form.csrf_token }}
<div class="form-group"> <div class="form-group form-group-lg">
{{ register_form.email.label}}
{{ register_form.email(class_="form-control") }} {{ register_form.email(class_="form-control") }}
</div> </div>
<div class="form-group"> <div class="form-group form-group-lg">
{{ register_form.name.label}}
{{ register_form.name(class_="form-control") }} {{ register_form.name(class_="form-control") }}
</div> </div>
<div class="form-group"> <div class="form-group form-group-lg">
{{ register_form.username.label}}
{{ register_form.username(class_="form-control") }} {{ register_form.username(class_="form-control") }}
</div> </div>
<div class="form-group"> <div class="form-group form-group-lg">
{{ register_form.password.label}}
{{ register_form.password(class_="form-control") }} {{ register_form.password(class_="form-control") }}
</div> </div>
<div class="form-group"> <div class="form-group form-group-lg">
{{ register_form.confirm_password.label}}
{{ register_form.confirm_password(class_="form-control") }} {{ register_form.confirm_password(class_="form-control") }}
</div> </div>
<button class="btn btn-default btn-large" type="submit">Register</button> <button class="btn btn-primary btn-lg" type="submit">Register</button>
</form> </form>
</div> </div>
</div>
</div> </div>
{% endblock %} {% endblock %}
\ No newline at end of file
{% extends "base.html" %}
{% block title %}Login{% endblock %}
{% block content %}
<form method="POST" action="/login">
{{ form.csrf_token }}
<div id="login-form">
<div class="form-input">
<div class="input-row">
{{ form.username.label(class_="field-label") }}
{{ form.username(class_="text-field") }}
</div>
<div class="input-row">
{{ form.password.label(class_="field-label") }}
{{ form.password(class_="text-field") }}
</div>
</div>
<button type="submit">Login</button>
</div>
</form>
{% endblock %}
\ No newline at end of file
{% extends "base.html" %}
{% block title %}Register{% endblock %}
{% block content %}
<form method="POST" action="/register">
{{ form.csrf_token }}
<div id="register-form">
<div class="form-input">
<div class="input-row">
{{ form.email.label(class_="field-label")}}
{{ form.email(class_="text-field") }}
</div>
<div class="input-row">
{{ form.name.label(class_="field-label")}}
{{ form.name(class_="text-field") }}
</div>
<div class="input-row">
{{ form.username.label(class_="field-label")}}
{{ form.username(class_="text-field") }}
</div>
<div class="input-row">
{{ form.password.label(class_="field-label")}}
{{ form.password(class_="text-field") }}
</div>
<div class="input-row">
{{ form.confirm_password.label(class_="field-label")}}
{{ form.confirm_password(class_="text-field") }}
</div>
</div>
<button type="submit">Register</button>
</div>
</form>
{% endblock %}
\ No newline at end of file
...@@ -37,7 +37,7 @@ class LoginView(FormView): ...@@ -37,7 +37,7 @@ class LoginView(FormView):
login_user(Owner.query.filter_by(username=self.get_form().username.data).first()) login_user(Owner.query.filter_by(username=self.get_form().username.data).first())
return redirect(url_for('stalls')) return redirect(url_for('stalls'))
def render_get(self): def render_get(self):
return render_template('landing.html', login_form=OwnerLoginForm(), register_form=OwnerRegisterForm()) return redirect('/')
def get_form(self): def get_form(self):
return OwnerLoginForm() return OwnerLoginForm()
...@@ -48,9 +48,9 @@ class RegisterView(FormView): ...@@ -48,9 +48,9 @@ class RegisterView(FormView):
owner = Owner(form.name.data, form.username.data, form.email.data, form.password.data) owner = Owner(form.name.data, form.username.data, form.email.data, form.password.data)
db.session.add(owner) db.session.add(owner)
db.session.commit() db.session.commit()
return redirect(url_for('login')) return redirect(url_for('register'))
def render_get(self): def render_get(self):
return render_template('landing.html', login_form=OwnerLoginForm(), register_form=OwnerRegisterForm()) return redirect('/')
def get_form(self): def get_form(self):
return OwnerRegisterForm() return OwnerRegisterForm()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment