aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPjotr Prins2021-01-07 10:38:31 +0000
committerGitHub2021-01-07 10:38:31 +0000
commit7e2c0d4514ccfe2641a15881d53d2f31ae8573b9 (patch)
tree72747789f05f4526e579eb1c3c1a85e6f09fbfc2
parent329a1a7e122eda41016185d1b1e8d50d97f8857b (diff)
parentb0a3ce5ae0da2bbbc39ee2ebad57cd22393d1f5c (diff)
downloadbh20-seq-resource-7e2c0d4514ccfe2641a15881d53d2f31ae8573b9.tar.gz
bh20-seq-resource-7e2c0d4514ccfe2641a15881d53d2f31ae8573b9.tar.lz
bh20-seq-resource-7e2c0d4514ccfe2641a15881d53d2f31ae8573b9.zip
Merge pull request #121 from BonfaceKilz/chore/add-extra-tab-for-all-feeds
Chore/add extra tab for all feeds
-rw-r--r--bh20simplewebuploader/main.py19
-rw-r--r--bh20simplewebuploader/static/main.css1
-rw-r--r--bh20simplewebuploader/templates/home.html71
3 files changed, 86 insertions, 5 deletions
diff --git a/bh20simplewebuploader/main.py b/bh20simplewebuploader/main.py
index 0c58712..504f03c 100644
--- a/bh20simplewebuploader/main.py
+++ b/bh20simplewebuploader/main.py
@@ -273,12 +273,23 @@ def send_home():
"""
Send the front page.
"""
+ (tweets,
+ commits,
+ pubmed_articles,
+ arxiv_articles) = [get_feed_items(x) for x in ["bh20-tweet-score:",
+ "bh20-commit-score:",
+ "bh20-pubmed-score:",
+ "bh20-arxiv-score:"]]
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:"),
- arxiv_articles=get_feed_items("bh20-arxiv-score:"),
+ all_items=list(itertools.chain(tweets,
+ commits,
+ pubmed_articles,
+ arxiv_articles)),
+ tweets=tweets,
+ commits=commits,
+ pubmed_articles=pubmed_articles,
+ arxiv_articles=arxiv_articles,
load_map=True)
diff --git a/bh20simplewebuploader/static/main.css b/bh20simplewebuploader/static/main.css
index fbc721e..e2f0c83 100644
--- a/bh20simplewebuploader/static/main.css
+++ b/bh20simplewebuploader/static/main.css
@@ -567,6 +567,7 @@ input[name="feed-tabs"] ~ .tab {
display: none;
}
+#tab-all-items:checked ~ .tab.content-all-items,
#tab-pubmed-articles:checked ~ .tab.content-pubmed-articles,
#tab-arxiv-articles:checked ~ .tab.content-arxiv-articles,
#tab-tweets:checked ~ .tab.content-tweets,
diff --git a/bh20simplewebuploader/templates/home.html b/bh20simplewebuploader/templates/home.html
index a880f81..23f48bf 100644
--- a/bh20simplewebuploader/templates/home.html
+++ b/bh20simplewebuploader/templates/home.html
@@ -29,7 +29,9 @@
</div>
<div id="feed">
- <input name="feed-tabs" type="radio" id="tab-arxiv-articles" checked/>
+ <input name="feed-tabs" type="radio" id="tab-all-items" checked/>
+ <label for="tab-all-items">All Items</label>
+ <input name="feed-tabs" type="radio" id="tab-arxiv-articles"/>
<label for="tab-arxiv-articles">Arxiv</label>
<input name="feed-tabs" type="radio" id="tab-pubmed-articles"/>
<label for="tab-pubmed-articles">Pubmed</label>
@@ -37,6 +39,73 @@
<label for="tab-tweets">Tweets</label>
<input name="feed-tabs" type="radio" id="tab-commits"/>
<label for="tab-commits">Commits</label>
+ <ul class="tab content-all-items">
+ <!-- Begin News -->
+ {% if all_items %}
+ {% for item in all_items|sort(reverse=true, attribute="score")%}
+ <li>
+ {% if item['authors'] %}
+ <!-- Arxiv article -->
+ <p>
+ <b>[arxiv]</b>
+ <a href="{{ item['url'] }}" target="_blank">
+ {{item['title']}}
+ </a>
+ <br/>
+ <b>Authors:</b> {{ item['authors'] }}
+ <br/>
+ <b>Abstract:</b> {{ item['abstract']}}...
+ <br/>
+ <b>Submitted:</b> {{ item['submission']}}
+ </p>
+
+ {% elif item['full-authors'] %}
+ <!-- Pubmed Article -->
+ <p><b>[Pubmed]:</b>
+ <a href="https://pubmed.ncbi.nlm.nih.gov/{{ item['docsum-pmid'] }}" target="_blank"><b>Summary:</b>
+ {{ item['summary'] }}
+ </a> <br/>
+ <b>Full Authors:</b> {{ item['full-authors'] }} <br/>
+ <b>Short Authors:</b> {{ item['short-authors'] }} <br/>
+ <b>Citation:</b> {{ item['citation'] }} <br/>
+ <b>Short Journal Citation:</b> {{ item['short-journal-citation'] }} <br/>
+ </p>
+
+ {% elif item['tweet'] %}
+ <!-- Tweets -->
+ <p>
+ <b>[Tweet]:</b>
+ {{ item['tweet']|urlize(40, target="_blank")}}
+ <small>
+ <a href="{{ item['url'] }}" target="_blank">source</a></small>
+ <br/>
+ by {{ item['author'] }}
+ <br/>
+ <small>{{ item['timeposted'] }}</small>
+ </p>
+
+ {% elif item['repository-url'] %}
+ <!-- Commits -->
+ <p>
+ <b>[Commit]:</b>
+ <a href="{{ item.url }}" target="_blank">
+ {{ item.hash.split(":")[-1][:7] }}: {{ item.content }}
+ </a>
+ <br/>
+ <small>
+ <a href="{{ item['repository-url'] }}" target="_blank"> {{ item.author }}/{{ item.repository }}</a>
+ on {{ item.timeposted }}
+ </small>
+ </p>
+ {% endif %}
+ </li>
+ {%endfor%}
+
+ {% else %}
+ There are no items to display :(
+ {% endif %}
+ <!-- End News -->
+ </ul>
<ul class="tab content-arxiv-articles">
{% if arxiv_articles %}
{% for article in arxiv_articles|sort(reverse=true, attribute="score")%}