From 5f5dd6f0582197c1773326b55ee22c7bd7f9bb98 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Thu, 31 Mar 2022 12:35:31 -0700 Subject: web: refactor fileset manifest display --- python/fatcat_web/templates/fileset_view.html | 79 ++++++++++++++++++++++----- 1 file changed, 65 insertions(+), 14 deletions(-) (limited to 'python/fatcat_web') diff --git a/python/fatcat_web/templates/fileset_view.html b/python/fatcat_web/templates/fileset_view.html index 4e8bfbad..e4d7b687 100644 --- a/python/fatcat_web/templates/fileset_view.html +++ b/python/fatcat_web/templates/fileset_view.html @@ -3,6 +3,21 @@ {% import "entity_macros.html" as entity_macros %} {% extends "entity_base.html" %} +{% macro file_mimetype_icon(mimetype) -%} + {%- if not mimetype -%}file outline + {%- elif mimetype in ["application/pdf"] -%}file pdf outline + {%- elif mimetype in ["application/x-hdf"] -%}database + {%- elif mimetype in ["text/csv", "text/tab-separated-values"] -%}table + {%- elif mimetype in ["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"] -%}table + {%- elif mimetype in ["application/vnd.openxmlformats-officedocument.wordprocessingml.document"] -%}file alternate outline + {%- elif mimetype in ["application/zip", "application/gzip", "application/x-tar", "application/x-rar", "application/x-bzip2"] -%}file archive outline + {%- elif mimetype in ["application/octet-stream"] -%}save outline + {%- elif mimetype.startswith("text/") -%}file alternate outline + {%- elif mimetype.startswith("image/") -%}file image outline + {%- elif mimetype.startswith("video/") -%}film + {%- else -%}file outline{% endif %} +{%- endmacro %} + {% block entity_main %}
@@ -23,26 +38,62 @@ No known public URL, mirror, or archive for this File Set. {% endif %} +{% set fileset_vars = namespace(archiveorg_base=None, webarchiveorg_base=None) %} +{% for u in (entity.urls or []) %} + {% if u.rel in ["archive-base"] %} + {% set fileset_vars.archiveorg_base = u.url %} + {% elif u.rel in ["webarchive-base"] %} + {% set fileset_vars.webarchiveorg_base = u.url %} + {% endif %} +{% endfor %} +

File Manifest ({{ fileset.manifest|count }})

{% if fileset.manifest %} -
+ + + + + + + + + + + {% for file in fileset.manifest %} -
-
-
- {{ file.path }} ({{ file.size|filesizeformat }}{% if file.extra.mimetype %}, {{ file.extra.mimetype }}{% endif %}) -
-
- {% if file.md5 %} md5:{{ file.md5 }}
{% endif %} - {% if file.sha1 %} sha1:{{ file.sha1 }}
{% endif %} - {% if file.sha256 %}sha256:{{ file.sha256 }}
{% endif %} +
+ + + + + + {% endfor %} - + +
PathTypeSize
+ {{ file.path }} +
+ {% if file.sha1 %} sha1:{{ file.sha1 }}
+ {% elif file.sha256 %}sha256:{{ file.sha256 }}
+ {% elif file.md5 %} md5:{{ file.md5 }}
+ {% endif %}
- - +
{% if file.mimetype %}{{ file.mimetype }}{% endif %}{{ file.size|filesizeformat }} + {% if fileset_vars.archiveorg_base %} + [archive.org]
+ {% endif %} + {% if fileset_vars.webarchiveorg_base %} + [web.archive.org]
+ {% endif %} + {% if file.extra and file.extra.original_url %} + [platform]
+ {% endif %} + {% if file.extra and file.extra.webarchive_url%} + [web.archive.org]
+ {% endif %} +
{% else %} -This File Set is empty (contains no files). +

This File Set is empty (contains no files). {% endif %} -- cgit v1.2.3