From c9b2c9dc028e8dbe07d1674f8f95875c36a90004 Mon Sep 17 00:00:00 2001 From: deflax Date: Fri, 12 May 2017 22:10:56 +0300 Subject: [PATCH] static pages moved to main blueprint --- app/__init__.py | 8 +++++--- app/auth/routes.py | 20 +++++++++---------- app/main/__init__.py | 3 +++ app/main/routes.py | 20 +++++++++++++++++++ app/static/css/style.css | 2 +- app/templates/base.html | 2 +- .../{footer.html => footer_colored.html} | 0 app/templates/footer_simple.html | 4 ++++ app/templates/{vmanager => main}/aboutus.html | 0 app/templates/{vmanager => main}/index.html | 2 +- .../{vmanager => main}/livechat.html | 0 app/templates/{vmanager => main}/terms.html | 0 app/templates/nav.html | 4 ++-- app/vmanager/routes.py | 18 ----------------- 14 files changed, 47 insertions(+), 36 deletions(-) create mode 100644 app/main/__init__.py create mode 100644 app/main/routes.py rename app/templates/{footer.html => footer_colored.html} (100%) create mode 100644 app/templates/footer_simple.html rename app/templates/{vmanager => main}/aboutus.html (100%) rename app/templates/{vmanager => main}/index.html (99%) rename app/templates/{vmanager => main}/livechat.html (100%) rename app/templates/{vmanager => main}/terms.html (100%) diff --git a/app/__init__.py b/app/__init__.py index 05f68c2..9d7d548 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -31,8 +31,8 @@ csrf = CSRFProtect(app) babel = Babel() babel.init_app(app) -from .vmanager import vmanager as vmanager_blueprint -app.register_blueprint(vmanager_blueprint) +from .main import main as main_blueprint +app.register_blueprint(main_blueprint) from .auth import auth as auth_blueprint app.register_blueprint(auth_blueprint, url_prefix='/auth') @@ -40,6 +40,9 @@ app.register_blueprint(auth_blueprint, url_prefix='/auth') from .settings import settings as settings_blueprint app.register_blueprint(settings_blueprint, url_prefix='/settings') +from .vmanager import vmanager as vmanager_blueprint +app.register_blueprint(vmanager_blueprint, url_prefix='/vmanager') + from .uinvoice import uinvoice as uinvoice_blueprint app.register_blueprint(uinvoice_blueprint, url_prefix='/uinvoice') @@ -131,4 +134,3 @@ if not app.debug and app.config['MAIL_SERVER'] != '': if __name__ == '__main__': app.run() - diff --git a/app/auth/routes.py b/app/auth/routes.py index 118d50b..5ef3da9 100644 --- a/app/auth/routes.py +++ b/app/auth/routes.py @@ -24,7 +24,7 @@ def before_request(): @auth.route('/unconfirmed') def unconfirmed(): if current_user.is_anonymous or current_user.confirmed: - return redirect(url_for('vmanager.index')) + return redirect(url_for('main.index')) return render_template('auth/unconfirmed.html') @@ -117,7 +117,7 @@ def qrcode(): def logout(): logout_user() flash('You have logged out') - return redirect(url_for('vmanager.index')) + return redirect(url_for('main.index')) @auth.route('/register', methods=['GET', 'POST']) @@ -148,12 +148,12 @@ def register(): @login_required def confirm(token): if current_user.confirmed: - return redirect(url_for('vmanager.index')) + return redirect(url_for('main.index')) if current_user.confirm(token): flash('Вашият акаунт е потвърден. Благодаря!') else: flash('Времето за потвърждение на вашият код изтече.') - return redirect(url_for('vmanager.index')) + return redirect(url_for('main.index')) @auth.route('/confirm') @@ -163,7 +163,7 @@ def resend_confirmation(): send_email(current_user.email, 'Потвърдете_вашият_акаунт', 'auth/email/confirm', user=current_user, token=token) flash('Изпратен е нов код за потвърждение..') - return redirect(url_for('vmanager.index')) + return redirect(url_for('main.index')) @auth.route('/change-password', methods=['GET', 'POST']) @@ -176,7 +176,7 @@ def change_password(): db.session.add(current_user) db.session.commit() flash('Вашата парола беше променена.') - return redirect(url_for('vmanager.index')) + return redirect(url_for('main.index')) else: flash('Грешна парола.') return render_template("auth/change_password.html", form=form) @@ -185,7 +185,7 @@ def change_password(): @auth.route('/reset', methods=['GET', 'POST']) def password_reset_request(): if not current_user.is_anonymous: - return redirect(url_for('vmanager.index')) + return redirect(url_for('main.index')) form = PasswordResetRequestForm() if form.validate_on_submit(): user = User.query.filter_by(email=form.email.data).first() @@ -204,17 +204,17 @@ def password_reset_request(): @auth.route('/reset/', methods=['GET', 'POST']) def password_reset(token): if not current_user.is_anonymous: - return redirect(url_for('vmanager.index')) + return redirect(url_for('main.index')) form = PasswordResetForm() if form.validate_on_submit(): user = User.query.filter_by(email=form.email.data).first() if user is None: - return redirect(url_for('vmanager.index')) + return redirect(url_for('main.index')) if user.reset_password(token, form.password.data): flash('Your password has been updated.') return redirect(url_for('auth.login')) else: - return redirect(url_for('vmanager.index')) + return redirect(url_for('main.index')) return render_template('auth/reset_password.html', form=form) diff --git a/app/main/__init__.py b/app/main/__init__.py new file mode 100644 index 0000000..4d15787 --- /dev/null +++ b/app/main/__init__.py @@ -0,0 +1,3 @@ +from flask import Blueprint +main = Blueprint('main', __name__) +from . import routes diff --git a/app/main/routes.py b/app/main/routes.py new file mode 100644 index 0000000..a44e0b7 --- /dev/null +++ b/app/main/routes.py @@ -0,0 +1,20 @@ +from flask import render_template, abort, redirect, url_for, abort, flash, request, current_app, make_response, g + +from . import main + +#STATIC PAGES +@main.route("/", methods=['GET']) +def index(): + return render_template('main/index.html') + +@main.route("/chat", methods=['GET']) +def chat(): + return render_template('main/livechat.html') + +#@main.route("/aboutus", methods=['GET']) +#def about(): +# return render_template('main/aboutus.html') + +@main.route("/terms", methods=['GET']) +def terms(): + return render_template('main/terms.html') diff --git a/app/static/css/style.css b/app/static/css/style.css index 27cc6e0..c8fa599 100644 --- a/app/static/css/style.css +++ b/app/static/css/style.css @@ -33,7 +33,7 @@ body { .one_four { float: left; width: 210px; - margin-right: 60px; + margin-right: 84px; } .one_four h4 { diff --git a/app/templates/base.html b/app/templates/base.html index 30843a2..501df7a 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -42,7 +42,7 @@ {% block footer %} -{% include "footer.html" %} +{% include "footer_simple.html" %} {% endblock %} {% endblock %} diff --git a/app/templates/footer.html b/app/templates/footer_colored.html similarity index 100% rename from app/templates/footer.html rename to app/templates/footer_colored.html diff --git a/app/templates/footer_simple.html b/app/templates/footer_simple.html new file mode 100644 index 0000000..59256aa --- /dev/null +++ b/app/templates/footer_simple.html @@ -0,0 +1,4 @@ +
+ +

Design by _sys

+
diff --git a/app/templates/vmanager/aboutus.html b/app/templates/main/aboutus.html similarity index 100% rename from app/templates/vmanager/aboutus.html rename to app/templates/main/aboutus.html diff --git a/app/templates/vmanager/index.html b/app/templates/main/index.html similarity index 99% rename from app/templates/vmanager/index.html rename to app/templates/main/index.html index 05b7310..182de5b 100644 --- a/app/templates/vmanager/index.html +++ b/app/templates/main/index.html @@ -105,5 +105,5 @@ {% block footer %} {% include "footer_index.html" %} -{% include "footer.html" %} +{% include "footer_colored.html" %} {% endblock %} diff --git a/app/templates/vmanager/livechat.html b/app/templates/main/livechat.html similarity index 100% rename from app/templates/vmanager/livechat.html rename to app/templates/main/livechat.html diff --git a/app/templates/vmanager/terms.html b/app/templates/main/terms.html similarity index 100% rename from app/templates/vmanager/terms.html rename to app/templates/main/terms.html diff --git a/app/templates/nav.html b/app/templates/nav.html index 215ce8a..8619fa4 100644 --- a/app/templates/nav.html +++ b/app/templates/nav.html @@ -9,7 +9,7 @@ {% if not current_user.is_authenticated %} - + {% else %} {% endif %} @@ -34,7 +34,7 @@ --> {% endif %} -
  • Live Chat
  • +
  • Live Chat
  • diff --git a/app/vmanager/routes.py b/app/vmanager/routes.py index d9ac595..a1e6db8 100644 --- a/app/vmanager/routes.py +++ b/app/vmanager/routes.py @@ -29,24 +29,6 @@ def after_request(response): current_app.logger.warning('Slow query: %s\nParameters: %s\nDuration: %fs\nContext: %s\n' % (query.statement, query.parameters, query.duration, query.context)) return response -#STATIC PAGES -@vmanager.route("/", methods=['GET']) -def index(): - return render_template('vmanager/index.html') - -@vmanager.route("/chat", methods=['GET']) -def chat(): - return render_template('vmanager/livechat.html') - -#@vmanager.route("/aboutus", methods=['GET']) -#def about(): -# return render_template('vmanager/aboutus.html') - -@vmanager.route("/terms", methods=['GET']) -def terms(): - return render_template('vmanager/terms.html') - - #APP STORE @vmanager.route('/market/', methods=['GET']) @login_required