summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2021-01-13 18:07:06 -0800
committerBryan Newbold <bnewbold@archive.org>2021-01-14 14:57:24 -0800
commit48e8c61a89781df02727dbd843d7792af6e6c0de (patch)
treebff171c88796a4c6a201a3a5bb2cad11c67279e3
parent6b88ede6b74301afbd12ff616fe806d2c5e7784b (diff)
downloadfatcat-scholar-48e8c61a89781df02727dbd843d7792af6e6c0de.tar.gz
fatcat-scholar-48e8c61a89781df02727dbd843d7792af6e6c0de.zip
serp: expand abstracts using <details>
This isn't very polished, but a start, and uses no javascript.
-rw-r--r--fatcat_scholar/templates/base.html10
-rw-r--r--fatcat_scholar/templates/search_macros.html6
2 files changed, 15 insertions, 1 deletions
diff --git a/fatcat_scholar/templates/base.html b/fatcat_scholar/templates/base.html
index 8ac8096..138940d 100644
--- a/fatcat_scholar/templates/base.html
+++ b/fatcat_scholar/templates/base.html
@@ -74,6 +74,16 @@
line-height: 1.28571429em;
}
+ .serp-hit-box details > summary {
+ list-style-type: none;
+ color: #28629c;
+ text-decoration: underline;
+ margin-left: 0.3em;
+ }
+ .serp-hit-box details > summary::-webkit-details-marker {
+ display: none;
+ }
+
{# fix RTL dividers #}
{% if locale in ['ar'] %}
.ui.divided.grid:not([class*="vertically divided"])>.column:not(.row), .ui.divided.grid:not([class*="vertically divided"])>.row>.column {
diff --git a/fatcat_scholar/templates/search_macros.html b/fatcat_scholar/templates/search_macros.html
index 6346754..3c8509c 100644
--- a/fatcat_scholar/templates/search_macros.html
+++ b/fatcat_scholar/templates/search_macros.html
@@ -121,7 +121,11 @@
{% elif paper.abstracts %}
<div style="padding-top: 0.5em; padding-bottom: 0.5em;">
{% if paper.abstracts[0].body|length > 500 %}
- {{ paper.abstracts[0].body[:500] }}...
+ {{ paper.abstracts[0].body | truncate(500, False, '') }}
+ <details style="display:inline;">
+ <summary>{% trans %}more &raquo;{% endtrans %}</summary>
+ ... {{ paper.abstracts[0].body[480:] }}
+ </details>
{% else %}
{{ paper.abstracts[0].body }}
{% endif %}