added navbar and front page

This commit is contained in:
Cristina Cochior 2019-05-20 15:56:54 +02:00
parent 8f40345367
commit c223dd94b8
6 changed files with 42 additions and 14 deletions

View File

@ -49,12 +49,15 @@ session['id'] = []
session['veryfirstnow'] = None
#VARS FOR THE SCORES
wordpath = []
idlist = []
timelist = []
timelistforoperations = []
# preparing the index.json file for the navbar
index_dict = {}
######################################################################################
#SOME JSON AND WALK OS REALTED THINGIES
######################################################################################
@ -77,13 +80,17 @@ for path, subdirs, files in os.walk(path):
fullpath = os.path.join(path, name)
jsonfiles.append(fullpath[7:])
#listing the json paths
for path, subdirs, files in os.walk(path):
#listing the json paths simultaneously generating a new index.json for the navbar
for path, subdirs, files in os.walk('./static/files/'):
for name in files:
if name.endswith(".json"):
fullpath = os.path.join(path, name)
jsonfiles.append(fullpath[7:])
jsonfiles.append(fullpath[8:])
fullpathjsonfiles.append(fullpath)
with open (fullpath) as f:
temp_dict = json.load(f)
index_dict[temp_dict["id"]] = temp_dict["title"]
dict = {} #dict for the form entries
@ -101,7 +108,7 @@ def home():
#add the very first time of connection to the interface
# if veryfirstnow is None :
session['veryfirstnow'] = datetime.now()
return render_template('home.html')
return render_template('home.html', wordlist_dict=wordlist_dict, index_dict=index_dict)
def functionsession():
return(session)

BIN
static/.DS_Store vendored

Binary file not shown.

View File

@ -47,3 +47,7 @@ div{
.diverge{
margin-left: 1em;
}
.index {
display: block;
}

View File

@ -1,7 +1,19 @@
{% extends "layout.html" %}
{% block content %}
<div class="home">
<h1>Start</h1>
<p>This will be the page with all the keywords.</p>
</div>
{% endblock %}
{% block content %}
<div class="home">
<h1>Welcome to the Pushing Scores archive</h1>
{% for word in wordlist_dict %}
{% set address = "/diverge?search=" + word %}
<a href={{address}}>
{{ word }}
</a>
{% endfor %}
</div>
{% endblock content %}
{% block index %}
{% for each in index_dict %}
{% set address = "/description?id=" + each %}
<a href={{address}}>{{index_dict[each]}}</a>
{% endfor %}
{% endblock index %}

View File

@ -3,12 +3,17 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>P.u.s.h.i.n.g.S.c.o.r.e.s</title>
<title><a href="">P.u.s.h.i.n.g.S.c.o.r.e.s</a></title>
<link rel="stylesheet" href="{{ url_for('static', filename='css/main.css') }}">
<!-- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css"> -->
</head>
<body>
<header>
<div class="index">
{% block index %}
{% endblock index %}
</div>
<div class="container">
<h1 class="logo">P.u.s.h.i.n.g.S.c.o.r.e.s</h1>
<strong><nav>
@ -23,7 +28,7 @@
</header>
<div class="container">
{% block content %}
{% endblock %}
{% endblock content %}
</div>
</body>
</html>