Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions base/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
:license: BSD, see LICENSE for more details.
"""

from flask.ext.wtf import Form, TextField, Required, PasswordField
from wtforms.validators import Email
from flask.ext.wtf import Form
from wtforms.fields import TextField,PasswordField
from wtforms.validators import Email, Required


class LoginForm(Form):
Expand Down
3 changes: 2 additions & 1 deletion base/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@
"""

from flask.ext.login import UserMixin
from sqlalchemy.ext.declarative import declared_attr
from werkzeug.security import generate_password_hash, check_password_hash
from ext import db


class CRUDMixin(object):
__table_args__ = {'extend_existing': True}

id = db.Column(db.Integer, primary_key=True)
id = db.Column(db.Integer,db.Sequence('user_id_seq'),primary_key=True)

@classmethod
def get_by_id(cls, id):
Expand Down
8 changes: 4 additions & 4 deletions base/templates/blocks/auth_header.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
<section class="login-header">
<form action="{{ url_for('base.login') }}" method="POST" class="login-form">
{{ login_form.hidden_tag() }}
{{ login_form_field(login_form.email, class_='input login-form__input') }}
{{ login_form_field(login_form.password, class_='input login-form__input') }}
<input type="submit" class="button login-form__submit" value="Log in">
{{ login_form_field(login_form.email, class_='input form-control') }}
{{ login_form_field(login_form.password, class_='input form-control') }}
<input type="submit" class="btn btn-primary" value="Log in">
</form>
</section>
{% else %}
Expand All @@ -17,4 +17,4 @@
<input type="submit" class="button login-form__submit" value="Logout">
</form>
</section>
{% endif %}
{% endif %}
14 changes: 8 additions & 6 deletions base/templates/blocks/login_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@


{% if current_user.is_anonymous() %}
<form action="{{ url_for('base.login') }}" method="POST" class="common-form">
<form action="{{ url_for('base.login') }}" method="POST" class="form">
{{ form.hidden_tag() }}
{{ common_form_field(form.email, class_='input common-form__input') }}
{{ common_form_field(form.password, class_='input common-form__input') }}
<div class="common-form__field-wrapper">
<label class="common-form__label">&nbsp;</label>
<input type="submit" class="button common-form__submit" value="Log in">
{{ common_form_field(form.email, class_='form-control') }}
{{ common_form_field(form.password, class_='form-control') }}
<div class="wrapper">
<label class="label">&nbsp;</label>
<button type="submit" class="btn btn-primary" value="Log in">
Login
</button>
</div>
</form>
{% else %}
Expand Down
8 changes: 4 additions & 4 deletions base/templates/blocks/messages.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{% with messages = get_flashed_messages() %}
{% if messages %}
<div class="l-75-c flash-messages">
<ul class="flash-messages__list">
<div class="info">
<ul class="info">
{% for message in messages %}
<li class="flash-messages__item">{{ message }}</li>
<li class="info">{{ message }}</li>
{% endfor %}
</ul>
</div>
{% endif %}
{% endwith %}
{% endwith %}
16 changes: 9 additions & 7 deletions base/templates/blocks/navigation.html
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
{% from "macros/form_helpers.html" import render_field %}


<nav class="top-navigation l-75-c">
<ul class="top-navigation__list">
<nav class="nav nav-bar" role="navigation">
<ul class="navigation__list">
{% for nav_item in navigation %}
<li class="top-navigation__item{% if nav_item.url in request.path %} top-navigation__item_active{% endif %}">
<li class="nav nav-bar{% if nav_item.url in request.path %} active{% endif %}">
{% if request.path != nav_item.url %}
<a href="{{ nav_item.url }}" class="top-navigation__item-link">
<a href="{{ nav_item.url }}" class="nav">
<span class="nav nav-bar">{{ nav_item.name }}</span>
{% else %}
<span class="nav nav-bar disabled">{{ nav_item.name }}</span>
{% endif %}
<span class="top-navigation__item-link-text">{{ nav_item.name }}</span>
{% if nav_item.counter %}
<sup class="top-navigation__item-counter">{{ nav_item.counter }}</sup>
<sup class="nav nav-bar">{{ nav_item.counter }}</sup>
{% endif %}
{% if request.path != nav_item.url %}
</a>
{% endif %}
</li>
{% endfor %}
</ul>
</nav>
</nav>
15 changes: 10 additions & 5 deletions base/templates/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,18 @@
<meta charset="utf-8" />
<title>{% block page_title %}Flask Kit{% endblock %}</title>
{% block css %}
{% assets "css_base" %}
{#{% assets "css_base" %}
<link rel="stylesheet" href="{{ ASSET_URL }}">
{% endassets %}
{% endassets %}#}
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" />
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap-theme.min.css">

{% endblock %}

{% block js %}
{% block js %}{#
{% assets "js_base" %}
<script src="{{ ASSET_URL }}" type="text/javascript"></script>
{% endassets %}
{% endassets %}#}
{% endblock %}
</head>

Expand Down Expand Up @@ -42,6 +45,8 @@ <h2 class="header__site-remark">for great good</h2>

{% block footer %}
{% include 'blocks/footer.html' %}
<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
{% endblock %}
</body>
</html>
</html>
8 changes: 4 additions & 4 deletions base/templates/macros/form_helpers.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{% macro common_form_field(field) %}
<div class="common-form__field-wrapper">
<div class="">
{% if field.label.text %}
<label class="common-form__label" for="{{ field.id }}">
{{ field.label.text }}: {% if field.flags.required %} *{% endif %}
<label class="info" for="{{ field.id }}">
{{ field.label.text }}: {% if field.flags.required %} <span style="color:red;">*</span>{% endif %}
</label>
{% endif %}
{{ field(**kwargs) }}
{% if field.errors %}
<div class="form-errors">
<div class="error">
<ul>
{% for error in field.errors %}<li>{{ error }}</li>{% endfor %}
</ul>
Expand Down
2 changes: 1 addition & 1 deletion ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"""

from flask.ext.debugtoolbar import DebugToolbarExtension
from flask.ext.gravatar import Gravatar
from gravatar import Gravatar
from flask.ext.login import LoginManager
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.assets import Environment
Expand Down