From 464048c7cdfa861fe8b4c78000526413a7e2e145 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Sat, 2 Mar 2019 17:48:51 -0800 Subject: improve/fix deleted entity view --- python/fatcat_web/routes.py | 14 +++++++------- python/fatcat_web/templates/deleted_entity.html | 15 +++------------ python/fatcat_web/templates/entity_macros.html | 7 +++++-- 3 files changed, 15 insertions(+), 21 deletions(-) (limited to 'python/fatcat_web') diff --git a/python/fatcat_web/routes.py b/python/fatcat_web/routes.py index 59f7d1db..2a8e8fa3 100644 --- a/python/fatcat_web/routes.py +++ b/python/fatcat_web/routes.py @@ -100,7 +100,7 @@ def container_view(ident): if entity.state == "redirect": return redirect('/container/{}'.format(entity.redirect)) if entity.state == "deleted": - return render_template('deleted_entity.html', entity=entity) + return render_template('deleted_entity.html', entity=entity, entity_type="container") if entity.state == "active": entity.es = container_to_elasticsearch(entity, force_bool=False) return render_template('container_view.html', @@ -161,7 +161,7 @@ def creator_view(ident): if entity.state == "redirect": return redirect('/creator/{}'.format(entity.redirect)) if entity.state == "deleted": - return render_template('deleted_entity.html', entity=entity) + return render_template('deleted_entity.html', entity=entity, entity_type="creator") return render_template('creator_view.html', creator=entity, releases=releases) @app.route('/file//history', methods=['GET']) @@ -208,7 +208,7 @@ def file_view(ident): if entity.state == "redirect": return redirect('/file/{}'.format(entity.redirect)) elif entity.state == "deleted": - return render_template('deleted_entity.html', entity=entity) + return render_template('deleted_entity.html', entity=entity, entity_type="file") else: try: entity.releases = [] @@ -252,7 +252,7 @@ def fileset_view(ident): if entity.state == "redirect": return redirect('/fileset/{}'.format(entity.redirect)) elif entity.state == "deleted": - return render_template('deleted_entity.html', entity=entity) + return render_template('deleted_entity.html', entity=entity, entity_type="fileset") else: try: entity.releases = [] @@ -297,7 +297,7 @@ def webcapture_view(ident): if entity.state == "redirect": return redirect('/webcapture/{}'.format(entity.redirect)) elif entity.state == "deleted": - return render_template('deleted_entity.html', entity=entity) + return render_template('deleted_entity.html', entity=entity, entity_type="webcapture") else: try: entity.releases = [] @@ -370,7 +370,7 @@ def release_view(ident): if entity.state == "redirect": return redirect('/release/{}'.format(entity.redirect)) if entity.state == "deleted": - return render_template('deleted_entity.html', entity=entity) + return render_template('deleted_entity.html', entity=entity, entity_type="release") if entity.container and entity.container.state == "active": entity.container.es = container_to_elasticsearch(entity.container, force_bool=False) if entity.state == "active": @@ -418,7 +418,7 @@ def work_view(ident): if entity.state == "redirect": return redirect('/work/{}'.format(entity.redirect)) if entity.state == "deleted": - return render_template('deleted_entity.html', entity=entity) + return render_template('deleted_entity.html', entity=entity, entity_type="work") return render_template('work_view.html', work=entity, releases=releases) @app.route('/editgroup/', methods=['GET']) diff --git a/python/fatcat_web/templates/deleted_entity.html b/python/fatcat_web/templates/deleted_entity.html index af25da54..a19910e7 100644 --- a/python/fatcat_web/templates/deleted_entity.html +++ b/python/fatcat_web/templates/deleted_entity.html @@ -23,20 +23,11 @@
-Entity Type: {{ entity_type }} -
- -Fatcat Bits -

State is "{{ entity.state }}". Revision: -
{{ entity.revision }} -
As JSON object via API - -

-
- Edit Metadata - View History +Entity Type: {{ entity_type }}
+{{ entity_macros.fatcat_bits(entity, entity_type, "") }} +
diff --git a/python/fatcat_web/templates/entity_macros.html b/python/fatcat_web/templates/entity_macros.html index 2a4752f2..0fa93679 100644 --- a/python/fatcat_web/templates/entity_macros.html +++ b/python/fatcat_web/templates/entity_macros.html @@ -2,8 +2,11 @@ {% macro fatcat_bits(entity, entity_type, expand="") -%}
Fatcat Bits -

State is "{{ entity.state }}". Revision: -
{{ entity.revision }} +

State is "{{ entity.state }}". + {% if entity.state != "deleted" %} + Revision: +
{{ entity.revision }} + {% endif %}
As JSON object via API

-- cgit v1.2.3