Migrate to mithril.js
This commit is contained in:
18
myapp/ns_common/__init__.py
Normal file
18
myapp/ns_common/__init__.py
Normal file
@@ -0,0 +1,18 @@
|
||||
__author__ = 'RemiZOffAlex'
|
||||
__copyright__ = '(c) RemiZOffAlex'
|
||||
__email__ = 'remizoffalex@mail.ru'
|
||||
|
||||
import os
|
||||
import jinja2
|
||||
|
||||
from . import views # noqa F401
|
||||
from .. import app
|
||||
|
||||
|
||||
my_loader = jinja2.ChoiceLoader([
|
||||
app.jinja_loader,
|
||||
jinja2.FileSystemLoader(
|
||||
os.path.dirname(os.path.abspath(__file__)) + "/templates"
|
||||
),
|
||||
])
|
||||
app.jinja_loader = my_loader
|
||||
8
myapp/ns_common/templates/guest/index.html
Normal file
8
myapp/ns_common/templates/guest/index.html
Normal file
@@ -0,0 +1,8 @@
|
||||
{% extends "/public/skeleton.html" %}
|
||||
{% block content %}
|
||||
|
||||
<h1>{{ pagedata['info'] }}</h1>
|
||||
<hr />
|
||||
<p>Самурай без меча подобен самураю с мечом, но только без меча, однако как-будто с мечом, которого у него нет, но и без него он как с ним...</p>
|
||||
|
||||
{% endblock %}
|
||||
8
myapp/ns_common/templates/user/index.html
Normal file
8
myapp/ns_common/templates/user/index.html
Normal file
@@ -0,0 +1,8 @@
|
||||
{% extends "/private/skeleton.html" %}
|
||||
{% block content %}
|
||||
|
||||
<h1>{{ pagedata['info'] }}</h1>
|
||||
<hr />
|
||||
<p>Самурай без меча подобен самураю с мечом, но только без меча, однако как-будто с мечом, которого у него нет, но и без него он как с ним...</p>
|
||||
|
||||
{% endblock %}
|
||||
20
myapp/ns_common/views.py
Normal file
20
myapp/ns_common/views.py
Normal file
@@ -0,0 +1,20 @@
|
||||
__author__ = 'RemiZOffAlex'
|
||||
__copyright__ = '(c) RemiZOffAlex'
|
||||
__email__ = 'remizoffalex@mail.ru'
|
||||
|
||||
from flask import render_template, session, redirect
|
||||
|
||||
from .. import app, lib
|
||||
|
||||
|
||||
@app.route('/')
|
||||
def index():
|
||||
pagedata = {}
|
||||
pagedata['title'] = app.config['TITLE']
|
||||
if lib.get_user():
|
||||
pagedata['info'] = 'Закрытый раздел'
|
||||
body = render_template('user/index.html', pagedata=pagedata)
|
||||
else:
|
||||
pagedata['info'] = 'Открытый раздел'
|
||||
body = render_template('guest/index.html', pagedata=pagedata)
|
||||
return body
|
||||
Reference in New Issue
Block a user