From 5f32f09afd4238465dbd4d9c9ea8c093826ad318 Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Wed, 23 Dec 2020 14:57:49 +0300 Subject: Merge duplicate css rule --- bh20simplewebuploader/static/main.css | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/bh20simplewebuploader/static/main.css b/bh20simplewebuploader/static/main.css index 237b952..b7ba1af 100644 --- a/bh20simplewebuploader/static/main.css +++ b/bh20simplewebuploader/static/main.css @@ -17,11 +17,6 @@ h1 { text-align: center; } -.intro { - color: #505050; - // font-weight: 300; -} - .header { background-color: white; margin: 0 auto; @@ -202,6 +197,7 @@ span.dropt:hover {text-decoration: none; background: #ffffff; z-index: 6; } } .intro { + color: #505050; grid-area: a; } -- cgit v1.2.3 From 6e060269c8eef4bde87291770c3fa26726c4a1a1 Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Wed, 23 Dec 2020 16:08:44 +0300 Subject: Add tabbed content for commits, tweets and pubmed content * bh20simplewebuploader/templates/home.html: Add tab panes for commits, tweets and pubmed content. Use dummy place holder content for commits and tweets. * bh20simplewebuploader/static/main.css: Add basic styling for tabbed content. --- bh20simplewebuploader/static/main.css | 43 ++++++++++++++++++++++++++++--- bh20simplewebuploader/templates/home.html | 17 ++++++++++-- 2 files changed, 55 insertions(+), 5 deletions(-) diff --git a/bh20simplewebuploader/static/main.css b/bh20simplewebuploader/static/main.css index b7ba1af..b6c900c 100644 --- a/bh20simplewebuploader/static/main.css +++ b/bh20simplewebuploader/static/main.css @@ -510,7 +510,7 @@ div.status { justify-content: space-evenly; } -#twitter-feed { +#feed { background-color: #f5f8fa; max-height: 440px; max-width: 500px; @@ -521,11 +521,11 @@ div.status { } -#twitter-feed ul { +#feed ul { list-style-type: none; } -#twitter-feed ul li { +#feed ul li { border-bottom: 2px solid white; padding-bottom: 20px; } @@ -552,3 +552,40 @@ padding-right:10px; { max-width: 80%; } + +/** Tabbed feed **/ +input[name="feed-tabs"] { + display: none; +} + +input[name="feed-tabs"] + label { + display: inline-block; +} + +input[name="feed-tabs"] ~ .tab { + display: none; +} + +#tab-pubmed-articles:checked ~ .tab.content-pubmed-articles, +#tab-tweets:checked ~ .tab.content-tweets, +#tab-commits:checked ~ .tab.content-commits { + display: block; +} + +input[name="feed-tabs"] + label { + border: 1px solid #999; + background: #EEE; + padding: 4px 12px; + border-radius: 4px 4px 0 0; + position: relative; + top: 1px; +} + +input[name="feed-tabs"]:checked + label { + background: #FFF; + border-bottom: 1px solid transparent; +} +input[name="feed-tabs"] ~ .tab { /* grey line between tab and contents */ + border-top: 1px solid #999; + padding: 12px; +} diff --git a/bh20simplewebuploader/templates/home.html b/bh20simplewebuploader/templates/home.html index be948f6..8a9c27b 100644 --- a/bh20simplewebuploader/templates/home.html +++ b/bh20simplewebuploader/templates/home.html @@ -27,8 +27,18 @@
@@ -41,6 +51,9 @@
{{ tweet.tweet|urlize(40, target="_blank") }}
--
cgit v1.2.3
From 6035681197c42966865730462f5532bcb2704c30 Mon Sep 17 00:00:00 2001
From: BonfaceKilz
Date: Wed, 23 Dec 2020 16:49:35 +0300
Subject: Abstract away for fetching feedcontent
* bh20simplewebuploader/main.py:
(get_feed_items): New function.
(send_home): Use get_feed_items() for fetching feed items.
---
bh20simplewebuploader/main.py | 35 ++++++++++++++++++-----------------
1 file changed, 18 insertions(+), 17 deletions(-)
diff --git a/bh20simplewebuploader/main.py b/bh20simplewebuploader/main.py
index 31d1b1f..b70f49a 100644
--- a/bh20simplewebuploader/main.py
+++ b/bh20simplewebuploader/main.py
@@ -248,31 +248,32 @@ def load_schema_generate_form():
FORM_ITEMS = load_schema_generate_form()
-@app.route('/')
-def send_home():
- """
- Send the front page.
- """
+
+def get_feed_items(name, start=0, stop=9):
redis_client = redis.Redis(host=os.environ.get('HOST', 'localhost'),
port=os.environ.get('PORT', 6379),
- db=os.environ.get('REDIS_DB', 0))
- tweets = []
+ db=os.environ.get('REDIS_DB', 0))
+ feed_items = []
try:
- for tweet_id in redis_client.zrevrange('bh20-tweet-score:',
- 0, 9):
- # Ensure the dict always has a value; otherwise a key
- # error will be thrown by jinja
- tweet_dict = redis_client.hgetall(tweet_id)
- if tweet_dict and int(tweet_dict.get(b'score', "0")) > 0:
- tweets.append(
+ for el in redis_client.zrevrange(name, start, stop):
+ feed_dict = redis_client.hgetall(el)
+ if feed_dict and int(feed_dict.get(b"score", "0")) > 0:
+ feed_items.append(
{k.decode("utf-8"): v.decode("utf-8") for k, v in
- tweet_dict.items()})
-
+ feed_dict.items()})
+ return feed_items
except redis.exceptions.ConnectionError as e:
logging.warning(f"redis connect failed {e}")
pass
+
+
+@app.route('/')
+def send_home():
+ """
+ Send the front page.
+ """
return render_template('home.html', menu='HOME',
- tweets=tweets,
+ tweets=get_feed_items("bh20-tweet-score:"),
load_map=True)
--
cgit v1.2.3
From 6a2dbbc003e5adcf885b41674d9ca80fba7fd55b Mon Sep 17 00:00:00 2001
From: BonfaceKilz
Date: Wed, 23 Dec 2020 19:55:46 +0300
Subject: Add commits and pubmed articles to feed
---
bh20simplewebuploader/main.py | 9 ++++---
bh20simplewebuploader/templates/home.html | 42 +++++++++++++++++++++++++++++--
2 files changed, 46 insertions(+), 5 deletions(-)
diff --git a/bh20simplewebuploader/main.py b/bh20simplewebuploader/main.py
index b70f49a..de3ba3f 100644
--- a/bh20simplewebuploader/main.py
+++ b/bh20simplewebuploader/main.py
@@ -272,9 +272,12 @@ def send_home():
"""
Send the front page.
"""
- return render_template('home.html', menu='HOME',
- tweets=get_feed_items("bh20-tweet-score:"),
- load_map=True)
+ return render_template(
+ 'home.html', menu='HOME',
+ tweets=get_feed_items("bh20-tweet-score:"),
+ commits=get_feed_items("bh20-commit-score:"),
+ pubmed_articles=get_feed_items("bh20-pubmed-score:"),
+ load_map=True)
@app.route('/upload')
diff --git a/bh20simplewebuploader/templates/home.html b/bh20simplewebuploader/templates/home.html
index b1e52be..7d5d89f 100644
--- a/bh20simplewebuploader/templates/home.html
+++ b/bh20simplewebuploader/templates/home.html
@@ -36,9 +36,24 @@
Summary: {{ article['summary'] }}
+Full Authors: {{ article['full-authors'] }}
+Short Authors: {{ article['short-authors'] }}
+Citation: {{ article['citation'] }}
+Short Journal Citation: {{ article['short-journal-citation'] }}
+@@ -50,9 +65,32 @@
+ + {{ commit.hash.split(":")[-1][:7] }}:{{ commit.content}} + + +
+ + {{ commit.author }}/{{ commit.repository }} + on {{ commit.timeposted}} + +