mirror of https://github.com/CIRCL/AIL-framework
Modified skeleton template name into rawSkeleton + Added possibility to hide modules in the header.
parent
f6e8582d9d
commit
6afbf77af0
|
@ -27,11 +27,33 @@ cfg = Flask_config.cfg
|
|||
Flask_config.app = Flask(__name__, static_url_path='/static/')
|
||||
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
|
||||
# Also, prepare header.html
|
||||
to_add_to_header_dico = {}
|
||||
for root, dirs, files in os.walk('modules/'):
|
||||
sys.path.append(join(root))
|
||||
|
||||
# Ignore the module
|
||||
curr_dir = root.split('/')[1]
|
||||
if curr_dir in toIgnoreModule:
|
||||
continue
|
||||
|
||||
for name in files:
|
||||
module_name = root.split('/')[-2]
|
||||
if name.startswith('Flask_') and name.endswith('.py'):
|
||||
|
|
|
@ -13,7 +13,7 @@ import Flask_config
|
|||
app = Flask_config.app
|
||||
cfg = Flask_config.cfg
|
||||
|
||||
skeleton = Blueprint('skeleton', __name__, template_folder='templates')
|
||||
rawSkeleton = Blueprint('rawSkeleton', __name__, template_folder='templates')
|
||||
|
||||
# ============ FUNCTIONS ============
|
||||
def one():
|
||||
|
@ -21,10 +21,10 @@ def one():
|
|||
|
||||
# ============= ROUTES ==============
|
||||
|
||||
@skeleton.route("/skeleton/", methods=['GET'])
|
||||
@rawSkeleton.route("/rawSkeleton/", methods=['GET'])
|
||||
def skeleton_page():
|
||||
return render_template("skeleton.html")
|
||||
return render_template("rawSkeleton.html")
|
||||
|
||||
|
||||
# ========= 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' %}
|
||||
|
||||
<div id="page-wrapper">
|
||||
<p> Text </p>
|
||||
<p> Raw skeleton webpage </p>
|
||||
</div>
|
||||
<!-- /#page-wrapper -->
|
||||
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
activePage = "page-skeleton"
|
||||
activePage = "page-rawSkeleton"
|
||||
$("#"+activePage).addClass("active");
|
||||
});
|
||||
</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>
|
||||
</li>
|
||||
|
||||
<li id='page-skeleton'><a href="{{ url_for('skeleton.skeleton_page') }}"><i class="glyphicon glyphicon-new-window"></i> Skeleton page</a></li>
|
||||
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
<div class="navbar-header">
|
||||
<ul class="nav navbar-nav">
|
||||
<!--dashboard-->
|
||||
<!--trendingcharts-->
|
||||
<!--trendingmodules-->
|
||||
<!--browsepastes-->
|
||||
<!--sentiment-->
|
||||
<!--terms-->
|
||||
<!--insert here-->
|
||||
</ul>
|
||||
</div>
|
|
@ -0,0 +1 @@
|
|||
rawSkeleton
|
|
@ -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 New Issue