static pages moved to main blueprint

This commit is contained in:
deflax 2017-05-12 22:10:56 +03:00
parent ea3eb21f85
commit c9b2c9dc02
14 changed files with 47 additions and 36 deletions

View file

@ -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()

View file

@ -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/<token>', 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)

3
app/main/__init__.py Normal file
View file

@ -0,0 +1,3 @@
from flask import Blueprint
main = Blueprint('main', __name__)
from . import routes

20
app/main/routes.py Normal file
View file

@ -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')

View file

@ -33,7 +33,7 @@ body {
.one_four {
float: left;
width: 210px;
margin-right: 60px;
margin-right: 84px;
}
.one_four h4 {

View file

@ -42,7 +42,7 @@
</div>
{% block footer %}
{% include "footer.html" %}
{% include "footer_simple.html" %}
{% endblock %}
{% endblock %}

View file

@ -0,0 +1,4 @@
<div class="page_wrap">
<p class="copyright">&copy; Copyright 2015-2017 <a href="https://deflax.net">deflax.net</a>, All Rights Reserved.</p>
<p class="design_by">Design by _sys</p>
</div><!--/page wrap-->

View file

@ -105,5 +105,5 @@
{% block footer %}
{% include "footer_index.html" %}
{% include "footer.html" %}
{% include "footer_colored.html" %}
{% endblock %}

View file

@ -9,7 +9,7 @@
<span class="icon-bar"></span>
</button>
{% if not current_user.is_authenticated %}
<a class="navbar-brand" href="{{ url_for('vmanager.index') }}" rel="home"></a>
<a class="navbar-brand" href="{{ url_for('main.index') }}" rel="home"></a>
{% else %}
<a class="navbar-brand" href="{{ url_for('vmanager.dashboard') }}" rel="home"></a>
{% endif %}
@ -34,7 +34,7 @@
</ul> -->
{% endif %}
<li><a href="{{ url_for('vmanager.chat') }}" target="_blank"><span class="glyphicon glyphicon-question-sign"></span> Live Chat</a></li>
<li><a href="{{ url_for('main.chat') }}" target="_blank"><span class="glyphicon glyphicon-question-sign"></span> Live Chat</a></li>
</ul>

View file

@ -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/<int:group_id>', methods=['GET'])
@login_required