diff options
Diffstat (limited to 'bh20simplewebuploader')
-rw-r--r-- | bh20simplewebuploader/main.py | 16 | ||||
-rw-r--r-- | bh20simplewebuploader/static/main.css | 27 | ||||
-rw-r--r-- | bh20simplewebuploader/templates/home.html | 27 |
3 files changed, 64 insertions, 6 deletions
diff --git a/bh20simplewebuploader/main.py b/bh20simplewebuploader/main.py index 51048a4..fc145e6 100644 --- a/bh20simplewebuploader/main.py +++ b/bh20simplewebuploader/main.py @@ -7,6 +7,7 @@ import logging import os import sys import re +import redis import string import ruamel.yaml as yaml import pkg_resources @@ -252,8 +253,19 @@ def send_home(): """ Send the front page. """ - - return render_template('home.html', menu='HOME', load_map=True) + redis_client = redis.Redis(host=os.environ.get('HOST', 'localhost'), + port=os.environ.get('PORT', 6379), + db=os.environ.get('REDIS_DB', 0)) + tweets = [] + for tweet_id in redis_client.zrevrange('bh20-tweet-score:', + 0, -1): + tweets.append( + {k.decode("utf-8"): v.decode("utf-8") for k, v in + redis_client.hgetall(tweet_id).items()} + ) + return render_template('home.html', menu='HOME', + tweets=tweets, + load_map=True) @app.route('/upload') diff --git a/bh20simplewebuploader/static/main.css b/bh20simplewebuploader/static/main.css index bc4f705..76a1755 100644 --- a/bh20simplewebuploader/static/main.css +++ b/bh20simplewebuploader/static/main.css @@ -506,3 +506,30 @@ div.status { font-size: 16px; box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2), 0 6px 20px 0 rgba(0,0,0,0.19); } + +.flex-container { + display: flex; + flex-direction: row; + flex-wrap: wrap; + justify-content: space-evenly; +} + +#twitter-feed { + background-color: #f5f8fa; + max-height: 440px; + max-width: 500px; + overflow-y: auto; + padding: 20px; + margin-left: auto; + margin-right: auto; +} + + +#twitter-feed ul { + list-style-type: none; +} + +#twitter-feed ul li { + border-bottom: 2px solid white; + padding-bottom: 20px; +} diff --git a/bh20simplewebuploader/templates/home.html b/bh20simplewebuploader/templates/home.html index 5986d72..be948f6 100644 --- a/bh20simplewebuploader/templates/home.html +++ b/bh20simplewebuploader/templates/home.html @@ -22,9 +22,27 @@ or <a href="/apidoc">REST API</a>. For more information see the <a href="/about">FAQ!</a>. </p> - <section id="map_view" class="map"> - <div id="mapid"></div> - </section> + + <section class="flex-container"> + <div id="map_view" class="map"> + <div id="mapid"></div> + </div> + <div id="twitter-feed"> + <ul> + {% for tweet in tweets|sort(reverse=true, attribute="timeposted")%} + <li> + <p class="tweet"> + {{ tweet.tweet|urlize(40, target="_blank") }} <br/> + by {{ tweet.author }} + </p> + <small class="timeposted"> + {{ tweet.timeposted }} + </small> + </li> + {% endfor %} + </ul> + </div> + </section> <a href="https://projectredcap.org/"><img class="img-right" src="static/image/REDCap.png" /></a> <p> @@ -76,7 +94,8 @@ use, see the <a href="/blog">docs</a>. </p> </div> - </section> + </section> + {% include 'footer.html' %} |