summaryrefslogtreecommitdiffstats
path: root/python/fatcat_web
diff options
context:
space:
mode:
Diffstat (limited to 'python/fatcat_web')
-rw-r--r--python/fatcat_web/routes.py4
-rw-r--r--python/fatcat_web/templates/container_search.html89
-rw-r--r--python/fatcat_web/templates/container_view.html2
-rw-r--r--python/fatcat_web/templates/entity_macros.html78
-rw-r--r--python/fatcat_web/templates/release_search.html59
-rw-r--r--python/fatcat_web/templates/release_view.html12
6 files changed, 146 insertions, 98 deletions
diff --git a/python/fatcat_web/routes.py b/python/fatcat_web/routes.py
index 8583d255..58f4b7e0 100644
--- a/python/fatcat_web/routes.py
+++ b/python/fatcat_web/routes.py
@@ -707,6 +707,8 @@ def generic_search():
def release_search():
query = request.args.get('q')
+ if not query:
+ query = '*'
fulltext_only = bool(request.args.get('fulltext_only'))
issnl = request.args.get('container_issnl')
@@ -731,6 +733,8 @@ def release_search():
def container_search():
query = request.args.get('q')
+ if not query:
+ query = '*'
offset = request.args.get('offset', '0')
offset = max(0, int(offset)) if offset.isnumeric() else 0
diff --git a/python/fatcat_web/templates/container_search.html b/python/fatcat_web/templates/container_search.html
index 1a089643..1a804595 100644
--- a/python/fatcat_web/templates/container_search.html
+++ b/python/fatcat_web/templates/container_search.html
@@ -9,6 +9,7 @@
{% endif %}
{% endblock %}
+
{% block fullmain %}
<div class="ui vertical stripe segment" style="background-color: #EEE; padding-top: 4.5em;">
@@ -17,8 +18,7 @@
<form class="" role="search" action="/container/search" method="get">
<div class="ui form">
<div class="ui action input huge fluid">
- <input type="text" placeholder="Query..." name="q" value="{% if query %}{{ query }}{% endif %}" aria-label="search container metadata">
- <button class="ui button">Search</button>
+ <input type="text" placeholder="Query..." name="q" value="{% if query %}{{ query }}{% endif %}" aria-label="search container metadata"> <button class="ui button">Search</button>
</div>
<br>Can also lookup by <b><a href="/container/lookup">identifier</a></b> or search <b><a href="/release/search?q={{ query or "" }}">releases</a></b>.
</div>
@@ -30,49 +30,56 @@
<br>
{% if found %}
-{% if found.results %}
- {{ entity_macros.top_results(found) }}
+ {% if found.results %}
-{% for entity in found.results %}
-<div>
- <h4 style="margin-top: 1em; margin-bottom: 4px; font-size: 1.1em;">
- <a href="/container/{{ entity.ident }}" style="color: #2224c7;">{{ entity['name'] }}</a>
- {% if entity.is_oa %}<i class="icon unlock orange small"></i>{% endif %}
- </h4>
- {% if entity.publisher %}
- <h5 style="margin-top: 4px; margin-bottom: 4px; font-size: 1em;">{{ entity.publisher }}</h5>
- {% endif %}
- {% if entity.issnl %}
- <a href="https://portal.issn.org/resource/ISSN/{{entity.issnl }}" style="color: green;">issn:{{ entity.issnl }}</a>
- {% endif %}
- {% if entity.container_type %}
- &nbsp;{{ entity.container_type }}
- {% endif %}
-</div>
-{% endfor %}
-{% if found.results|length > 8 %}
- <div class="ui divider"></div>
- <div style="text-align: center">
- {{ entity_macros.bottom_results(found, endpoint='container_search')}}
- </div>
-{% endif %}
-{% else %}
+ {{ entity_macros.top_results(found) }}
-Raw query was: <i>{{ found.query.q }}</i>
+ {% for entity in found.results %}
+ <div>
+ <h4 style="margin-top: 1em; margin-bottom: 4px; font-size: 1.1em;">
+ <a href="/container/{{ entity.ident }}" style="color: #2224c7;">{{ entity['name'] }}</a>
+ {% if entity.is_oa %}<i class="icon unlock orange small"></i>{% endif %}
+ </h4>
+ {% if entity.publisher %}
+ <h5 style="margin-top: 4px; margin-bottom: 4px; font-size: 1em;">{{ entity.publisher }}</h5>
+ {% endif %}
+ {% if entity.issnl %}
+ <a href="https://portal.issn.org/resource/ISSN/{{entity.issnl }}" style="color: green;">issn:{{ entity.issnl }}</a>
+ {% endif %}
+ {% if entity.container_type %}
+ &nbsp;{{ entity.container_type }}
+ {% endif %}
+ </div>
+ {% endfor %}
+
+ {% if found.results|length > 8 %}
+ <div class="ui divider"></div>
+ <div style="text-align: center">
+ {{ entity_macros.bottom_results(found, endpoint='container_search') }}
+ </div>
+ {% endif %}
-<div class="ui centered stackable grid" style="padding-top: 15%;">
- <div class="row">
- <div class="four wide column">
- <img src="/static/paper_man_confused.gif" alt="confused paper man">
+ {% else %}
+
+ Raw query was: <i>{{ found.query.q }}</i>
+
+ <div class="ui centered stackable grid" style="padding-top: 15%;">
+ <div class="row">
+ <div class="four wide column">
+ <img src="/static/paper_man_confused.gif" alt="confused paper man">
+ </div>
+ <div class="six wide column">
+ <h2>No results found!</h2>
+ <p>You could try elsewhere:</p>
+ <ul>
+ <li>Search <a href="https://scholar.google.com/scholar?q={{ found.query.q | urlencode }}">Google Scholar</a></li>
+ </ul>
+ </div>
+ </div>
</div>
- <div class="six wide column">
- <h2>No results found!</h2>
- <p>You could try elsewhere:</p>
- <ul>
- <li>Search <a href="https://scholar.google.com/scholar?q={{ found.query.q | urlencode }}">Google Scholar</a></li>
- </ul>
-</div>
-{% endif %}
+
+ {% endif %}
+
{% endif %}
</div>
diff --git a/python/fatcat_web/templates/container_view.html b/python/fatcat_web/templates/container_view.html
index 8d7c4cae..cf444956 100644
--- a/python/fatcat_web/templates/container_view.html
+++ b/python/fatcat_web/templates/container_view.html
@@ -23,6 +23,7 @@
Published by {{ container.publisher }}
{% endif %}
+{% if container.state == "active" %}
<h3>Search Releases from this Container</h3>
<form class="" role="search" action="/release/search" method="get">
<div class="ui form">
@@ -33,6 +34,7 @@
</div>
</div>
</form>
+{% endif %}
{% if container._random_releases %}
<h3>Example Publications</h3>
diff --git a/python/fatcat_web/templates/entity_macros.html b/python/fatcat_web/templates/entity_macros.html
index 7c5436c6..c22eb106 100644
--- a/python/fatcat_web/templates/entity_macros.html
+++ b/python/fatcat_web/templates/entity_macros.html
@@ -54,10 +54,12 @@
</a>
</div>
+{% if entity.ident %}
<div class="two ui buttons bottom attached">
<a href="{% if editgroup %}/editgroup/{{ editgroup.editgroup_id }}{% endif %}/{{ entity_type }}/{{ entity.ident }}/edit" class="ui blue button">Edit Metadata</a>
<a href="/{{ entity_type }}/{{ entity.ident }}/history" class="ui button">View History</a>
</div>
+{% endif %}
{%- endmacro %}
@@ -156,17 +158,35 @@
[blank]
{% endif %}
</a>
+
+ {# release type suffix #}
+ {% if paper.release_type in ("article-journal", "paper-conference") %}
+ {# pass #}
+ {% elif paper.release_type in ("book", "chapter", "dataset") %}
+ <b style="text-transform: uppercase;">[{{ paper.release_type }}]</b>
+ {% elif not paper.release_type %}
+ <b style="text-transform: uppercase; color: black;">[unknown-media]</b>
+ {% else %}
+ <b style="text-transform: uppercase;">[{{ paper.release_type }}]</b>
+ {% endif %}
+
+ {# show original_title #}
+ {% if paper.original_title and paper.title != paper.original_title %}
+ <br>
+ <i style="font-weight: normal;">
+ {{ paper.original_title[:512] }} {% if paper.original_title|length > 512 %}...{% endif %}
+ </i>
+ {% endif %}
+
</h4>
+
{% if paper.best_pdf_url %}
<div style="float: right; padding: 4px;">
&nbsp;&nbsp;<a href="{{ paper.best_pdf_url }}" class="ui violet tag label"><i class="file icon"></i>fulltext</a>
</div>
{% endif %}
- {#
- <h5 style="margin-top: 4px; margin-bottom: 4px; font-size: 1em;">{{ ", ".join(paper.contrib_names[:12]) }}
- {% if paper.contrib_names|length > 12 %}<i>(+{{ paper.contrib_names|length - 12 }} others)</i>{% endif %}
- </h5>
- #}
+
+ {# ### AUTHOR ROW #}
{% if paper.contrib_names %}
<div style="margin-top: 0px; margin-bottom: 0px; font-size: 1em;">
<b>
@@ -175,25 +195,14 @@
</b>
</div>
{% endif %}
+
+
+ {# ### JOURNAL ROW #}
{% if paper.release_year %}
{{ paper.release_year }}
{% endif %}
- {% if paper.release_type %}
- {% if paper.release_type in ("article-journal", "paper-conference") %}
- <span class="ui black basic label small">{{ paper.release_type }}</span>
- {% elif paper.release_type in ("book") %}
- <span class="ui brown basic label small">{{ paper.release_type }}</span>
- {% else %}
- <span class="ui grey basic label small">{{ paper.release_type }}</span>
- {% endif %}
- {% endif %}
- {% if paper.withdrawn_status %}
- <span class="ui red label small">{{ paper.withdrawn_status }}</span>
- {% endif %}
- {% if paper.release_stage and paper.release_stage != "published" %}
- <span class="ui pink basic label small">{{ paper.release_stage }}</span>
- {% elif not paper.release_stage %}
- <span class="ui red basic label small">unknown</span>
+ {% if paper.release_year and paper.container_name %}
+ |
{% endif %}
{% if paper.container_name %}
{% if paper.container_id %}
@@ -203,8 +212,22 @@
{% endif %}
{% if paper.container_is_oa %}<i class="icon unlock orange small"></i>{% endif %}
{% endif %}
- {% if paper.doi or paper.pmid or paper.arxiv_id or paper.jstor_id %}
- <br>
+ {% if paper.withdrawn_status %}
+ <b style="color: red;"><code>[{{ paper.withdrawn_status }}]</code></b>
+ {% endif %}
+ {% if paper.release_stage == "accepted" %}
+ <b style="color: darkmagenta;"><code>[{{ paper.release_stage }} manuscript]</code></b>
+ {% elif paper.release_stage == "submitted" %}
+ <b style="color: magenta;"><code>[pre-print]</code></b>
+ {% elif paper.release_stage and paper.release_stage != "published" %}
+ <b style="color: magenta;"><code>[{{ paper.release_stage }}]</code></b>
+ {% elif not paper.release_stage %}
+ <b style="color: red;"><code>[unpublished?]</code></b>
+ {% endif %}
+
+ {# ### IDENTIFIERS #}
+ {% if paper.doi or paper.pmid or paper.arxiv_id or paper.jstor_id or paper.pmcid %}
+ <br>
{% endif %}
{% if paper.doi %}
<a href="https://doi.org/{{paper.doi }}" style="color: green;">doi:{{ paper.doi }}</a> &nbsp;
@@ -212,13 +235,18 @@
{% if paper.pmid %}
<a href="https://www.ncbi.nlm.nih.gov/pubmed/{{paper.pmid }}" style="color: green;">pmid:{{ paper.pmid }}</a> &nbsp;
{% endif %}
+ {% if paper.pmcid %}
+ <a href="https://pubmed.ncbi.nlm.nih.gov/{{paper.pmcid }}/" style="color: green;">pmcid:{{ paper.pmcid }}</a> &nbsp;
+ {% endif %}
{% if paper.arxiv_id %}
<a href="https://arxiv.org/abs/{{paper.arxiv_id }}" style="color: green;">arXiv:{{ paper.arxiv_id }}</a> &nbsp;
{% endif %}
- {% if False %} {# XXX: elastic release work grouping searches #}
+
+{# WIP: elastic release work grouping searches
<br>
<a href="/work/{{ paper.work_id }}"><i class="sitemap icon"></i> and 5 other versions of the same work!</a>
- {% endif %}
+#}
+
</div>
{% endmacro %}
diff --git a/python/fatcat_web/templates/release_search.html b/python/fatcat_web/templates/release_search.html
index 47f4330a..70c46c0a 100644
--- a/python/fatcat_web/templates/release_search.html
+++ b/python/fatcat_web/templates/release_search.html
@@ -35,37 +35,44 @@
<br>
{% if found %}
-{% if found.results %}
+ {% if found.results %}
+
{{ entity_macros.top_results(found) }}
- {% for paper in found.results %}
- {{ entity_macros.release_search_result_row(paper) }}
-{% endfor %}
-{% if found.results|length > 8 %}
- <div class="ui divider"></div>
- <div style="text-align: center">
- {{ entity_macros.bottom_results(found)}}
- </div>
-{% endif %}
-{% else %}
+ {% for paper in found.results %}
+ {{ entity_macros.release_search_result_row(paper) }}
+ {% endfor %}
+
+ {% if found.results|length > 8 %}
+ <div class="ui divider"></div>
+ <div style="text-align: center">
+ {{ entity_macros.bottom_results(found, endpoint='release_search') }}
+ </div>
+ {% endif %}
+
+ {% else %}
-Raw query was: <i>{{ found.query.q }}</i>
+ Raw query was: <i>{{ found.query.q }}</i>
-<div class="ui centered stackable grid" style="padding-top: 15%;">
- <div class="row">
- <div class="four wide column">
- <img src="/static/paper_man_confused.gif" alt="confused paper man">
+ <div class="ui centered stackable grid" style="padding-top: 15%;">
+ <div class="row">
+ <div class="four wide column">
+ <img src="/static/paper_man_confused.gif" alt="confused paper man">
+ </div>
+ <div class="six wide column">
+ <h2>No results found!</h2>
+ <p>You could try elsewhere:</p>
+ <ul>
+ <li>Search <a href="https://dissem.in/search?q={{ found.query.q | urlencode }}">dissem.in</a></li>
+ <li>Search <a href="https://www.base-search.net/Search/Results?lookfor={{ found.query.q | urlencode }}">BASE</a></li>
+ <li>Search <a href="https://scholar.google.com/scholar?q={{ found.query.q | urlencode }}">Google Scholar</a></li>
+ </ul>
+ </div>
+ </div>
</div>
- <div class="six wide column">
- <h2>No results found!</h2>
- <p>You could try elsewhere:</p>
- <ul>
- <li>Search <a href="https://dissem.in/search?q={{ found.query.q | urlencode }}">dissem.in</a></li>
- <li>Search <a href="https://www.base-search.net/Search/Results?lookfor={{ found.query.q | urlencode }}">BASE</a></li>
- <li>Search <a href="https://scholar.google.com/scholar?q={{ found.query.q | urlencode }}">Google Scholar</a></li>
- </ul>
-</div>
-{% endif %}
+
+ {% endif %}
+
{% endif %}
</div>
diff --git a/python/fatcat_web/templates/release_view.html b/python/fatcat_web/templates/release_view.html
index d7c4e76e..60e4624e 100644
--- a/python/fatcat_web/templates/release_view.html
+++ b/python/fatcat_web/templates/release_view.html
@@ -3,9 +3,9 @@
{% import "entity_macros.html" as entity_macros %}
{% extends "entity_base.html" %}
-{# HTML metadata embeddings #}
-{% if release and release.status == "active" %}
- {% block extra_head %}
+{% block extra_head %}
+ {% if release and release.state == "active" %}
+ {# HTML metadata embeddings #}
<link rel="canonical" href="https://{{ config.FATCAT_DOMAIN }}/release/{{ entity.ident }}">
<meta name="twitter:card" content="summary">
@@ -70,8 +70,8 @@
<meta name="citation_pdf_url" content="{{ url.url }}">
{% endif %}
{% endfor %}{% endfor %}
- {% endblock %}
-{% endif %}
+ {% endif %}
+{% endblock %}
{% block main_extra_attr %}itemscope itemtype="http://schema.org/ScholarlyArticle" itemid="#release"{% endblock %}
@@ -388,7 +388,7 @@ accessible version.
<br>grouping other versions (eg, pre-print) and variants of this release
</div>
-{% if release._can_citeproc %}
+{% if release.state == "active" and release._can_citeproc %}
<div class="ui segment attached accordion">
<div class="title" style="padding: 0px;">
<i class="dropdown icon"></i><b>Cite This Release</b>