summaryrefslogtreecommitdiffstats
path: root/python/fatcat_web/templates
diff options
context:
space:
mode:
Diffstat (limited to 'python/fatcat_web/templates')
-rw-r--r--python/fatcat_web/templates/400.html18
-rw-r--r--python/fatcat_web/templates/api_error.html20
-rw-r--r--python/fatcat_web/templates/container_search.html8
-rw-r--r--python/fatcat_web/templates/entity_macros.html64
-rw-r--r--python/fatcat_web/templates/home.html6
-rw-r--r--python/fatcat_web/templates/release_search.html7
-rw-r--r--python/fatcat_web/templates/search_macros.html68
7 files changed, 126 insertions, 65 deletions
diff --git a/python/fatcat_web/templates/400.html b/python/fatcat_web/templates/400.html
index f2659ca2..21f98aad 100644
--- a/python/fatcat_web/templates/400.html
+++ b/python/fatcat_web/templates/400.html
@@ -4,10 +4,20 @@
<center>
<div style="font-size: 8em;">400</div>
<div style="font-size: 3em;">Bad Request</div>
-
-<p>Wasn't able to handle the request, either due to incorrect or unexpected
-input. Usually more context should be available; if you hit this page it means
-you've discovered a new corner case!
</center>
+<div class="ui icon error message">
+ <i class="ban icon"></i>
+ <div class="content">
+ <div class="header"></div>
+ {% if err and err.description %}
+ <p>{{ err.description }}
+ {% else %}
+ <p>Wasn't able to handle the request, either due to incorrect or unexpected
+ input. Usually more context should be available; if you hit this page it means
+ you've discovered a new corner case!
+ {% endif %}
+ </div>
+</div>
+
{% endblock %}
diff --git a/python/fatcat_web/templates/api_error.html b/python/fatcat_web/templates/api_error.html
new file mode 100644
index 00000000..1a44f610
--- /dev/null
+++ b/python/fatcat_web/templates/api_error.html
@@ -0,0 +1,20 @@
+{% extends "base.html" %}
+{% block body %}
+
+<center>
+<div style="font-size: 8em;">{{ api_error.status or "" }}</div>
+<div style="font-size: 3em;">{{ api_error.reason or "" }}</div>
+</center>
+
+<div class="ui icon error message">
+ <i class="ban icon"></i>
+ <div class="content">
+ <div class="header">
+ API Error: {{ api_error.error_name or "" }}
+ </div>
+ <p>{{ api_error.message or "" }}
+ </div>
+</div>
+
+
+{% endblock %}
diff --git a/python/fatcat_web/templates/container_search.html b/python/fatcat_web/templates/container_search.html
index 2566f542..bd92dc2b 100644
--- a/python/fatcat_web/templates/container_search.html
+++ b/python/fatcat_web/templates/container_search.html
@@ -1,4 +1,4 @@
-{% import "entity_macros.html" as entity_macros %}
+{% import "search_macros.html" as search_macros %}
{% extends "base.html" %}
{% block title %}
@@ -32,7 +32,7 @@
{% if found %}
{% if found.results %}
- {{ entity_macros.top_results(query, found) }}
+ {{ search_macros.top_results(query, found) }}
{% for entity in found.results %}
<div>
@@ -55,7 +55,7 @@
{% if found.results|length > 8 %}
<div class="ui divider"></div>
<div style="text-align: center">
- {{ entity_macros.bottom_results(query, found, endpoint='container_search') }}
+ {{ search_macros.bottom_results(query, found, endpoint='container_search') }}
</div>
{% endif %}
@@ -80,6 +80,8 @@
{% endif %}
+{% elif es_error %}
+ {{ search_macros.es_error_msg(es_error) }}
{% endif %}
</div>
diff --git a/python/fatcat_web/templates/entity_macros.html b/python/fatcat_web/templates/entity_macros.html
index 0e7f135a..8e4c4f6a 100644
--- a/python/fatcat_web/templates/entity_macros.html
+++ b/python/fatcat_web/templates/entity_macros.html
@@ -162,12 +162,10 @@
{# 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>
+ <b style="text-transform: uppercase; color: black;">[unknown]</b>
{% else %}
- <b style="text-transform: uppercase;">[{{ paper.release_type }}]</b>
+ <b style="text-transform: uppercase; color: black;">[{{ paper.release_type }}]</b>
{% endif %}
{# show original_title #}
@@ -212,17 +210,17 @@
{% endif %}
{% if paper.container_is_oa %}<i class="icon unlock orange small"></i>{% endif %}
{% endif %}
- {% 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>
+
+ {% if paper.release_stage == "submitted" %}
+ <b style="color: brown; text-transform: uppercase;">pre-print</b>
{% elif paper.release_stage and paper.release_stage != "published" %}
- <b style="color: magenta;"><code>[{{ paper.release_stage }}]</code></b>
+ <b style="color: brown; text-transform: uppercase;">{{ paper.release_stage }} version</b>
{% elif not paper.release_stage %}
- <b style="color: red;"><code>[unpublished?]</code></b>
+ <b style="color: brown; text-transform: uppercase;">unpublished</b>
+ {% endif %}
+
+ {% if paper.withdrawn_status %}
+ <b style="color: red; text-transform: uppercase;">{{ paper.withdrawn_status }}</b>
{% endif %}
{# ### IDENTIFIERS #}
@@ -262,43 +260,3 @@ yellow
{% endif %}
{%- endmacro %}
-{% macro top_results(query, found) -%}
-
-<i>Showing
- {% if found.offset == 0 %}
- first
- {% else %}
- results {{ found.offset }} &mdash;
- {% endif %}
-
- {{ found.offset + found.count_returned }}
- out of {{ found.count_found }} results
-</i>
-
-{%- endmacro %}
-
-
-{% macro bottom_results(query, found, endpoint='release_search') -%}
-
-{% if found.offset > 0 %}
- {% if found.offset - found.limit < 0 %}
- <a href="{{ url_for(endpoint, q=query.q, offset=0) }}">&#xab; Previous</a>
- {% else %}
- <a href="{{ url_for(endpoint, q=query.q, offset=found.offset - found.limit) }}">&#xab; Previous</a>
- {% endif %}
-{% else %}
- <span style="color:gray">&#xab; Previous</span>
-{% endif %}
-
-&nbsp;&nbsp;<i>Showing results {{ found.offset }} &mdash; {{ found.offset +
-found.count_returned }} out of {{ found.count_found }} results</i>&nbsp;&nbsp;
-
-{% if found.offset + found.limit < found.count_found and found.offset + found.limit < found.deep_page_limit %}
- <a href="{{ url_for(endpoint, q=query.q, offset=found.offset + found.limit) }}">Next &#xbb;</a>
- {% else %}
- <span style="color:gray">Next &#xbb;</span>
-{% endif %}
-
-</div>
-
-{%- endmacro %}
diff --git a/python/fatcat_web/templates/home.html b/python/fatcat_web/templates/home.html
index 698230d3..4557e212 100644
--- a/python/fatcat_web/templates/home.html
+++ b/python/fatcat_web/templates/home.html
@@ -35,17 +35,17 @@
<div class="row">
<div class="four wide mobile three wide center aligned column">
<a href="/stats" style="color: black;">
- <h4>106,283,000<br>Papers</h4>
+ <h4>110,814,532<br>Papers</h4>
</a>
</div>
<div class="four wide mobile three wide center aligned column">
<a href="/stats" style="color: black;">
- <h4>23,036,825<br>Fulltext</h4>
+ <h4>26,173,743<br>Fulltext</h4>
</a>
</div>
<div class="four wide mobile three wide center aligned column">
<a href="/stats" style="color: black;">
- <h4>148,757<br>Journals</h4>
+ <h4>151,707<br>Journals</h4>
</a>
</div>
</div>
diff --git a/python/fatcat_web/templates/release_search.html b/python/fatcat_web/templates/release_search.html
index 58aa35d6..7fb475e3 100644
--- a/python/fatcat_web/templates/release_search.html
+++ b/python/fatcat_web/templates/release_search.html
@@ -1,4 +1,5 @@
{% import "entity_macros.html" as entity_macros %}
+{% import "search_macros.html" as search_macros %}
{% extends "base.html" %}
{% block title %}
@@ -37,7 +38,7 @@
{% if found %}
{% if found.results %}
- {{ entity_macros.top_results(query, found) }}
+ {{ search_macros.top_results(query, found) }}
{% for paper in found.results %}
{{ entity_macros.release_search_result_row(paper) }}
@@ -46,7 +47,7 @@
{% if found.results|length > 8 %}
<div class="ui divider"></div>
<div style="text-align: center">
- {{ entity_macros.bottom_results(query, found, endpoint='release_search') }}
+ {{ search_macros.bottom_results(query, found, endpoint='release_search') }}
</div>
{% endif %}
@@ -73,6 +74,8 @@
{% endif %}
+{% elif es_error %}
+ {{ search_macros.es_error_msg(es_error) }}
{% endif %}
</div>
diff --git a/python/fatcat_web/templates/search_macros.html b/python/fatcat_web/templates/search_macros.html
new file mode 100644
index 00000000..a207bfbc
--- /dev/null
+++ b/python/fatcat_web/templates/search_macros.html
@@ -0,0 +1,68 @@
+
+{% macro top_results(query, found) -%}
+
+<i>Showing
+ {% if found.offset == 0 %}
+ first
+ {% else %}
+ results {{ found.offset }} &mdash;
+ {% endif %}
+
+ {{ found.offset + found.count_returned }}
+ out of {{ found.count_found }} results
+</i>
+
+{%- endmacro %}
+
+
+{% macro bottom_results(query, found, endpoint='release_search') -%}
+
+{% if found.offset > 0 %}
+ {% if found.offset - found.limit < 0 %}
+ <a href="{{ url_for(endpoint, q=query.q, offset=0) }}">&#xab; Previous</a>
+ {% else %}
+ <a href="{{ url_for(endpoint, q=query.q, offset=found.offset - found.limit) }}">&#xab; Previous</a>
+ {% endif %}
+{% else %}
+ <span style="color:gray">&#xab; Previous</span>
+{% endif %}
+
+&nbsp;&nbsp;<i>Showing results {{ found.offset }} &mdash; {{ found.offset +
+found.count_returned }} out of {{ found.count_found }} results</i>&nbsp;&nbsp;
+
+{% if found.offset + found.limit < found.count_found and found.offset + found.limit < found.deep_page_limit %}
+ <a href="{{ url_for(endpoint, q=query.q, offset=found.offset + found.limit) }}">Next &#xbb;</a>
+ {% else %}
+ <span style="color:gray">Next &#xbb;</span>
+{% endif %}
+
+</div>
+
+{%- endmacro %}
+
+
+{% macro es_error_msg(es_error) %}
+ <div class="ui icon error message">
+ <i class="ban icon"></i>
+ <div class="content">
+ <div class="header">
+ {% if es_error.status_code == 400 %}
+ Query Error
+ {% else %}
+ Search Index Error
+ {% if es_error.status_code %}({{ es_error.status_code }}){% endif %}
+ {% endif %}
+ </div>
+ {% if es_error.description %}
+ <p>Computer said: <code>{{ es_error.description }}</code>
+ {% elif es_error.name %}
+ <p><b>{{ es_error.name }}</b>
+ {% endif %}
+ {% if es_error.status_code == 400 %}
+ <p>Query parsing is currently very naive. Sometimes you can fix this
+ problem by adding quotes around terms or entire phrases.
+ {% endif %}
+ </div>
+ </div>
+{% endmacro %}
+