mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-10 08:38:28 +00:00
Modified skeleton template name into rawSkeleton + Added possibility to hide modules in the header.
This commit is contained in:
parent
f6e8582d9d
commit
6afbf77af0
9 changed files with 61 additions and 9 deletions
|
@ -27,11 +27,33 @@ cfg = Flask_config.cfg
|
||||||
Flask_config.app = Flask(__name__, static_url_path='/static/')
|
Flask_config.app = Flask(__name__, static_url_path='/static/')
|
||||||
app = Flask_config.app
|
app = Flask_config.app
|
||||||
|
|
||||||
|
# ========= HEADER GENERATION ========
|
||||||
|
|
||||||
|
# Get headers items that should be ignored (not displayed)
|
||||||
|
toIgnoreModule = set()
|
||||||
|
try:
|
||||||
|
with open('templates/ignored_modules.txt', 'r') as f:
|
||||||
|
lines = f.read().splitlines()
|
||||||
|
for line in lines:
|
||||||
|
toIgnoreModule.add(line)
|
||||||
|
|
||||||
|
except IOError:
|
||||||
|
f = open('templates/ignored_modules.txt', 'w')
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
|
||||||
|
print(toIgnoreModule)
|
||||||
# Dynamically import routes and functions from modules
|
# Dynamically import routes and functions from modules
|
||||||
# Also, prepare header.html
|
# Also, prepare header.html
|
||||||
to_add_to_header_dico = {}
|
to_add_to_header_dico = {}
|
||||||
for root, dirs, files in os.walk('modules/'):
|
for root, dirs, files in os.walk('modules/'):
|
||||||
sys.path.append(join(root))
|
sys.path.append(join(root))
|
||||||
|
|
||||||
|
# Ignore the module
|
||||||
|
curr_dir = root.split('/')[1]
|
||||||
|
if curr_dir in toIgnoreModule:
|
||||||
|
continue
|
||||||
|
|
||||||
for name in files:
|
for name in files:
|
||||||
module_name = root.split('/')[-2]
|
module_name = root.split('/')[-2]
|
||||||
if name.startswith('Flask_') and name.endswith('.py'):
|
if name.startswith('Flask_') and name.endswith('.py'):
|
||||||
|
|
|
@ -13,7 +13,7 @@ import Flask_config
|
||||||
app = Flask_config.app
|
app = Flask_config.app
|
||||||
cfg = Flask_config.cfg
|
cfg = Flask_config.cfg
|
||||||
|
|
||||||
skeleton = Blueprint('skeleton', __name__, template_folder='templates')
|
rawSkeleton = Blueprint('rawSkeleton', __name__, template_folder='templates')
|
||||||
|
|
||||||
# ============ FUNCTIONS ============
|
# ============ FUNCTIONS ============
|
||||||
def one():
|
def one():
|
||||||
|
@ -21,10 +21,10 @@ def one():
|
||||||
|
|
||||||
# ============= ROUTES ==============
|
# ============= ROUTES ==============
|
||||||
|
|
||||||
@skeleton.route("/skeleton/", methods=['GET'])
|
@rawSkeleton.route("/rawSkeleton/", methods=['GET'])
|
||||||
def skeleton_page():
|
def skeleton_page():
|
||||||
return render_template("skeleton.html")
|
return render_template("rawSkeleton.html")
|
||||||
|
|
||||||
|
|
||||||
# ========= REGISTRATION =========
|
# ========= REGISTRATION =========
|
||||||
app.register_blueprint(skeleton)
|
app.register_blueprint(rawSkeleton)
|
|
@ -0,0 +1 @@
|
||||||
|
<li id='page-rawSkeleton'><a href="{{ url_for('rawSkeleton.skeleton_page') }}"><i class="glyphicon glyphicon-new-window"></i> rawSkeleton page</a></li>
|
|
@ -25,13 +25,13 @@
|
||||||
{% include 'navbar.html' %}
|
{% include 'navbar.html' %}
|
||||||
|
|
||||||
<div id="page-wrapper">
|
<div id="page-wrapper">
|
||||||
<p> Text </p>
|
<p> Raw skeleton webpage </p>
|
||||||
</div>
|
</div>
|
||||||
<!-- /#page-wrapper -->
|
<!-- /#page-wrapper -->
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
activePage = "page-skeleton"
|
activePage = "page-rawSkeleton"
|
||||||
$("#"+activePage).addClass("active");
|
$("#"+activePage).addClass("active");
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
|
@ -1 +0,0 @@
|
||||||
<li id='page-skeleton'><a href="{{ url_for('skeleton.skeleton_page') }}"><i class="glyphicon glyphicon-new-window"></i> Skeleton page</a></li>
|
|
|
@ -25,7 +25,6 @@
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li id='page-skeleton'><a href="{{ url_for('skeleton.skeleton_page') }}"><i class="glyphicon glyphicon-new-window"></i> Skeleton page</a></li>
|
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
11
var/www/templates/header_base.html
Normal file
11
var/www/templates/header_base.html
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<div class="navbar-header">
|
||||||
|
<ul class="nav navbar-nav">
|
||||||
|
<!--dashboard-->
|
||||||
|
<!--trendingcharts-->
|
||||||
|
<!--trendingmodules-->
|
||||||
|
<!--browsepastes-->
|
||||||
|
<!--sentiment-->
|
||||||
|
<!--terms-->
|
||||||
|
<!--insert here-->
|
||||||
|
</ul>
|
||||||
|
</div>
|
1
var/www/templates/ignored_modules.txt
Normal file
1
var/www/templates/ignored_modules.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
rawSkeleton
|
19
var/www/templates/navbar.html
Normal file
19
var/www/templates/navbar.html
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
<div id="wrapper">
|
||||||
|
<nav class="navbar navbar-default navbar-static-top" role="navigation" style="margin-bottom: 0">
|
||||||
|
{% include 'header.html' %}
|
||||||
|
<!-- /.navbar-top-links -->
|
||||||
|
<div class="navbar-default sidebar" role="navigation">
|
||||||
|
<div class="sidebar-collapse">
|
||||||
|
<ul class="nav" id="side-menu">
|
||||||
|
<li class="sidebar-search">
|
||||||
|
{% include 'searchbox.html' %}
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<!-- /#side-menu -->
|
||||||
|
</div>
|
||||||
|
<!-- /.sidebar-collapse -->
|
||||||
|
<a href="{{ url_for('dashboard.index') }}"><img src="{{ url_for('static', filename='image/AIL.png') }}" /></a>
|
||||||
|
</div>
|
||||||
|
<!-- /.navbar-static-side -->
|
||||||
|
</nav>
|
||||||
|
</div>
|
Loading…
Reference in a new issue