diff options
Diffstat (limited to 'python')
-rw-r--r-- | python/fatcat_web/routes.py | 13 | ||||
-rw-r--r-- | python/fatcat_web/templates/container_view.html | 39 |
2 files changed, 47 insertions, 5 deletions
diff --git a/python/fatcat_web/routes.py b/python/fatcat_web/routes.py index 693adf25..acc4b3e2 100644 --- a/python/fatcat_web/routes.py +++ b/python/fatcat_web/routes.py @@ -87,13 +87,24 @@ def container_view(ident): entity = api.get_container(ident) except ApiException as ae: abort(ae.status) + + if entity.issnl: + try: + stats = get_elastic_container_stats(entity.issnl) + except Exception as e: + stats = None + print(e) + else: + stats = None + if entity.state == "redirect": return redirect('/container/{}'.format(entity.redirect)) if entity.state == "deleted": return render_template('deleted_entity.html', entity=entity) if entity.state == "active": entity.es = container_to_elasticsearch(entity, force_bool=False) - return render_template('container_view.html', container=entity) + return render_template('container_view.html', + container=entity, container_stats=stats) @app.route('/creator/<ident>/history', methods=['GET']) def creator_history(ident): diff --git a/python/fatcat_web/templates/container_view.html b/python/fatcat_web/templates/container_view.html index ffe01185..1d237023 100644 --- a/python/fatcat_web/templates/container_view.html +++ b/python/fatcat_web/templates/container_view.html @@ -13,17 +13,37 @@ <div class="one wide column"></div> <div class="ten wide column" style="font-size: 16px;"> -<p><b>Publisher:</b> -{% if container.publisher != None %}{{ container.publisher }}{% else %}<i>Unknown</i>{% endif %} +<p> {% if (container.extra != None) and (container.extra['urls'] != None) and (container.extra['urls']|length > 0) %} -<br><b>Homepage:</b> <a href="{{ container.extra['urls'][0] }}"> <code>{{ container.extra['urls'][0] }}</code></a> + <a href="{{ container.extra['urls'][0] }}"><code>{{ container.extra['urls'][0] }}</code></a><br> +{% endif %} +{% if container.publisher != None %} + Published by {{ container.publisher }} +{% endif %} + +{% if container.issnl %} +<h3>Search Releases from this Container</h3> +<form class="" role="search" action="/release/search" method="get"> + <div class="ui form"> + <div class="ui action input large fluid"> + <input type="text" placeholder="Search Articles..." name="q" aria-label="search release metadata"> + <input type="hidden" name="container_issnl" value="{{ container.issnl }}"> + <button class="ui button">Search</button> + </div> + </div> +</form> {% endif %} {% if container.extra %} <h3>Extra Metadata (raw JSON)</h3> +<table class="ui definition single line fixed compact small unstackable table"> +<tbody> {% for (key, value) in container.extra.items() %} -<code><b>{{ key }}:</b> {{ value }}</code><br> + <tr><td class="three wide"><code>{{ key }}</code></td> + <td class="seven wide"><code>{{ value }}</code> {% endfor %} +</tbody> +</table> {% endif %} <!-- @@ -61,6 +81,17 @@ Raw Object: </div><div class="ui segment attached"> {% endif %} +{% if container_stats %} +<b>Release Counts</b><br> +{{ container_stats.total }} total +<br>{{ container_stats.is_preserved }} +(<b>{{ "%.1f"|format(container_stats.is_preserved/container_stats.total*100) }}%</b>) +preserved or archived +<br>{{ container_stats.in_web }} +(<b>{{ "%.1f"|format(container_stats.in_web/container_stats.total*100) }}%</b>) +fulltext available to read + </div><div class="ui segment attached"> +{% endif %} {% if (container.es and container.es != None) %} <b>Directory Listings</b><br> |