diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2019-06-13 17:17:22 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2019-06-13 17:17:22 -0700 |
commit | 16126c5901c435ea6610eff8b7211226c6f125d5 (patch) | |
tree | 429a4772a4990e8158f0dbc9714b02c8b0412f07 /python/fatcat_web/templates | |
parent | f1abe85e8c35a23122f65b47dd55d8135239cf93 (diff) | |
download | fatcat-16126c5901c435ea6610eff8b7211226c6f125d5.tar.gz fatcat-16126c5901c435ea6610eff8b7211226c6f125d5.zip |
refactor all entities to new UI style
Diffstat (limited to 'python/fatcat_web/templates')
-rw-r--r-- | python/fatcat_web/templates/container_view.html | 25 | ||||
-rw-r--r-- | python/fatcat_web/templates/creator_view.html | 23 | ||||
-rw-r--r-- | python/fatcat_web/templates/entity_base.html | 41 | ||||
-rw-r--r-- | python/fatcat_web/templates/entity_history.html | 1 | ||||
-rw-r--r-- | python/fatcat_web/templates/entity_macros.html | 29 | ||||
-rw-r--r-- | python/fatcat_web/templates/entity_view_metadata.html (renamed from python/fatcat_web/templates/entity_metadata.html) | 0 | ||||
-rw-r--r-- | python/fatcat_web/templates/file_view.html | 24 | ||||
-rw-r--r-- | python/fatcat_web/templates/fileset_view.html | 24 | ||||
-rw-r--r-- | python/fatcat_web/templates/release_view.html | 3 | ||||
-rw-r--r-- | python/fatcat_web/templates/release_view_contribs.html (renamed from python/fatcat_web/templates/release_contribs.html) | 0 | ||||
-rw-r--r-- | python/fatcat_web/templates/release_view_references.html (renamed from python/fatcat_web/templates/release_references.html) | 0 | ||||
-rw-r--r-- | python/fatcat_web/templates/webcapture_view.html | 28 | ||||
-rw-r--r-- | python/fatcat_web/templates/work_view.html | 24 |
13 files changed, 86 insertions, 136 deletions
diff --git a/python/fatcat_web/templates/container_view.html b/python/fatcat_web/templates/container_view.html index b86b1aa7..f945a91a 100644 --- a/python/fatcat_web/templates/container_view.html +++ b/python/fatcat_web/templates/container_view.html @@ -1,20 +1,12 @@ {% set container = entity %} +{% set entity_view = "overview" %} {% import "entity_macros.html" as entity_macros %} -{% extends "base.html" %} +{% extends "entity_base.html" %} -{% block fullbody %} +{% block entity_main %} <div class="ui stackable mobile reversed grid centered"> -<div class="one wide column"></div> -<div class="fifteen wide column"> - <h1 class="ui header">{{ container.name }} - <span class="sub header"><code>container {{ container.ident }}</code></span></h1> -</div> -</div> - -<div class="ui stackable mobile reversed grid centered"> -<div class="one wide column"></div> -<div class="ten wide column" style="font-size: 16px;"> +<div class="column" style="font-size: 16px; flex: 1;"> {% if (container.extra != None) and (container.extra['urls'] != None) and (container.extra['urls']|length > 0) %} <div style="text-overflow: ellipsis; overflow: hidden; width: 100%;"> @@ -39,15 +31,8 @@ </form> {% endif %} - -{% if entity.extra %} - <h3>Extra Metadata (raw JSON)</h3> - {{ entity_macros.extra_metadata(entity.extra) }} -{% endif %} - - </div> -<div class="five wide column"> +<div class="column" style="flex: 0 0 24em;"> <div class="ui segment top attached"> {% if container._es and container._es.is_oa == True %} diff --git a/python/fatcat_web/templates/creator_view.html b/python/fatcat_web/templates/creator_view.html index 63f83917..1b550316 100644 --- a/python/fatcat_web/templates/creator_view.html +++ b/python/fatcat_web/templates/creator_view.html @@ -1,20 +1,12 @@ {% set creator = entity %} +{% set entity_view = "overview" %} {% import "entity_macros.html" as entity_macros %} -{% extends "base.html" %} +{% extends "entity_base.html" %} -{% block fullbody %} +{% block entity_main %} <div class="ui stackable mobile reversed grid centered"> -<div class="one wide column"></div> -<div class="fifteen wide column"> - <h1 class="ui header">{{ creator.display_name }} - <span class="sub header"><code>creator {{ creator.ident }}</code></span></h1> -</div> -</div> - -<div class="ui stackable mobile reversed grid centered"> -<div class="one wide column"></div> -<div class="ten wide column" style="font-size: 16px;"> +<div class="column" style="font-size: 16px; flex: 1;"> {% if creator.given_name or creator.surname %} <table class="ui definition single line fixed compact small unstackable table"> @@ -31,11 +23,6 @@ </table> {% endif %} -{% if entity.extra != None %} - <h3>Extra Metadata (raw JSON)</h3> - {{ entity_macros.extra_metadata(entity.extra) }} -{% endif %} - <br> <h3>Releases</h3> {% if creator._releases != [] %} @@ -46,7 +33,7 @@ This creator has not contributed to any releases. {% endif %} </div> -<div class="five wide column"> +<div class="column" style="flex: 0 0 24em;"> <div class="ui segment top attached"> {% if creator.orcid or creator.wikidata_qid %} diff --git a/python/fatcat_web/templates/entity_base.html b/python/fatcat_web/templates/entity_base.html index 0768f5a9..ba25e3f9 100644 --- a/python/fatcat_web/templates/entity_base.html +++ b/python/fatcat_web/templates/entity_base.html @@ -1,7 +1,7 @@ {% extends "base.html" %} {% macro entity_tab(name, text, url_suffix, count=None) %} -<a href ="/{{ entity_type }}/{{ entity.ident }}{{ url_suffix }}" class="{% if entity_view == name %}active{% endif %} item" style="padding: 0em 1.2em;">{{ text }}{% if count != None %} ({{ count }}){% endif %}</a> +<a href ="{% if editgroup %}/editgroup/{{ editgroup.editgroup_id }}{% endif %}/{{ entity_type }}/{% if entity.ident %}{{ entity.ident }}{% elif entity.revision %}rev/{{ entity.revision }}{% endif %}{{ url_suffix }}" class="{% if entity_view == name %}active{% endif %} item" style="padding: 0em 1.2em;">{{ text }}{% if count != None %} ({{ count }}){% endif %}</a> {% endmacro %} {% block fullmain %} @@ -10,14 +10,35 @@ <div class="ui centered grid"> <div class="fifteen wide large screen sixteen wide column" style="padding-bottom: 0px;"> <h1 class="ui header"> - {% if entity_type == "release" %} + {% if entity_type == "container" %} + {{ entity.name }} + {% elif entity_type == "creator" %} + {{ entity.display_name }} + {% elif entity_type == "file" %} + {% elif entity_type == "fileset" %} + {% elif entity_type == "webcapture" %} + {% if entity.original_url %} + <a href="{{ entity.original_url }}" style="color: black;"><code>{{ entity.original_url }}</code></a> + {% endif %} + {% elif entity_type == "release" %} <span itemprop="headline"><span itemprop="name">{{ entity.title }}</span></span> {% if entity.subtitle %} <br><span style="font-size: smaller; font-weight: normal;">{{ entity.subtitle }}</span> {% endif %} {% endif %} <span class="sub header"> - <code>{{ entity_type }}_{{ entity.ident }}</code> + <code> + {% if entity.ident %} + {{ entity_type }}_{{ entity.ident }} + {% elif entity.revision %} + {{ entity_type }}_rev_{{ entity.revision }} + {% endif %} + {% if editgroup %} + <a href="/editgroup/{{ editgroup.editgroup_id }}" style="color: purple;"> + [as of editgroup_{{ editgroup.editgroup_id }}] + </a> + {% endif %} + </code> </span> </h1> {% if entity_type == "release" %} @@ -44,10 +65,16 @@ {% endif %} {{ entity_tab("metadata", "Metadata", "/metadata") }} </div> - <div class="ui small tabular compact menu floated right"> - {{ entity_tab("edit", "Edit", "/edit") }} - {{ entity_tab("history", "History", "/history") }} - </div> + {% if entity.ident %} + <div class="ui small tabular compact menu floated right"> + {% if not editgroup or not (editgroup.changelog_index or editgroup.submitted ) %} + {{ entity_tab("edit", "Edit", "/edit") }} + {% endif %} + {% if not editgroup %} + {{ entity_tab("history", "History", "/history") }} + {% endif %} + </div> + {% endif %} </div> </div> </div> diff --git a/python/fatcat_web/templates/entity_history.html b/python/fatcat_web/templates/entity_history.html index 73a3df92..2079b464 100644 --- a/python/fatcat_web/templates/entity_history.html +++ b/python/fatcat_web/templates/entity_history.html @@ -1,5 +1,4 @@ {% set entity_view = "history" %} -{% set entity_type = "release" %} {% extends "entity_base.html" %} {% block entity_main %} diff --git a/python/fatcat_web/templates/entity_macros.html b/python/fatcat_web/templates/entity_macros.html index 1d798dfb..4b70651f 100644 --- a/python/fatcat_web/templates/entity_macros.html +++ b/python/fatcat_web/templates/entity_macros.html @@ -1,16 +1,24 @@ {% macro fatcat_bits(entity, entity_type, expand="", editgroup=None) -%} -{% if entity.state == None and editgroup.editgroup_id %} -<div class="ui segment pink inverted attached"> - <b>Edit In Progress</b> - <p>You are viewing this entity as of a specific editgroup (which may or may not have been merged yet): - <b><a href="/editgroup/{{ editgroup.editgroup_id }}">{{ editgroup.editgroup_id }}</a></b> -</div> +{% if entity.state == None and editgroup %} + <div class="ui segment pink inverted attached"> + {% if editgroup.changelog_index %} + <b>Accepted Edit Version</b> + <p>This is the version of the entity as of a specific merged editgroup: + {% elif editgroup.submitted %} + <b>Submitted Edit Version</b> + <p>This is a version of the entity that has been submitted for approval as part of an editgroup: + {% else %} + <b>Edit In Progress</b> + <p>This is a version of the entity that has not yet been submitted for approval, part of an editgroup: + {% endif %} + <b><a href="/editgroup/{{ editgroup.editgroup_id }}" style="color: white; font-weight: bold;">{{ editgroup.editgroup_id }}</a></b> + </div> {% elif entity.state == None and entity.ident == None %} <div class="ui segment pink inverted attached"> <b>Revision</b> - <p>You are viewing a specific revision of an entity. + <p>This is a specific, static metadata record, not necessarily linked to any current entity in the catalog. </div> {% elif entity.state == "wip" %} <div class="ui segment pink inverted attached"> @@ -21,10 +29,13 @@ <div class="ui segment attached"> <b>Fatcat Bits</b> - <p>State is "{{ entity.state }}". + <p> + {% if entity.state %} + State is "{{ entity.state }}". + {% endif %} {% if entity.state != "deleted" %} Revision: - <br><small><code>{{ entity.revision }}</code></small> + <br><small><code><a href="/{{ entity_type }}/rev/{{ entity.revision }}">{{ entity.revision }}</a></code></small> {% endif %} <br><a href="{% if config.FATCAT_DOMAIN == 'dev.fatcat.wiki' %}http://localhost:9411{% else %}https://api.{{ config.FATCAT_DOMAIN }}{% endif %}/v0/{{ entity_type }}/{{ entity.ident }}{% if expand %}?expand={{ expand}}{% endif %}">As JSON object via API</a> </div> diff --git a/python/fatcat_web/templates/entity_metadata.html b/python/fatcat_web/templates/entity_view_metadata.html index 5ce97d10..5ce97d10 100644 --- a/python/fatcat_web/templates/entity_metadata.html +++ b/python/fatcat_web/templates/entity_view_metadata.html diff --git a/python/fatcat_web/templates/file_view.html b/python/fatcat_web/templates/file_view.html index 39ffaaa0..d60ea49d 100644 --- a/python/fatcat_web/templates/file_view.html +++ b/python/fatcat_web/templates/file_view.html @@ -1,25 +1,12 @@ {% set file = entity %} +{% set entity_view = "overview" %} {% import "entity_macros.html" as entity_macros %} -{% extends "base.html" %} +{% extends "entity_base.html" %} -{% block fullbody %} +{% block entity_main %} <div class="ui stackable mobile reversed grid centered"> -<div class="one wide column"></div> -<div class="fifteen wide column"> - <h1 class="ui header"> - <span class="sub header"><code>file {{ file.ident }}</code></span></h1> -</div> -</div> - -<div class="ui stackable mobile reversed grid centered"> -<div class="one wide column"></div> -<div class="ten wide column" style="font-size: 16px;"> - -{% if entity.extra %} - <h3>Extra Metadata (raw JSON)</h3> - {{ entity_macros.extra_metadata(entity.extra) }} -{% endif %} +<div class="column" style="font-size: 16px; flex: 1;"> <h3>Releases</h3> {% if entity.releases != [] %} @@ -55,7 +42,7 @@ No known public URL, mirror, or archive for this file. </table> </div> -<div class="five wide column"> +<div class="column" style="flex: 0 0 24em;"> {% if file.urls != None and file.urls != [] %} <a href="{{ file.urls[0].url }}" class="ui top attached fluid huge green button"><i class="file icon"></i>Download File</a> @@ -80,5 +67,4 @@ No known public URL, mirror, or archive for this file. </div> </div> - {% endblock %} diff --git a/python/fatcat_web/templates/fileset_view.html b/python/fatcat_web/templates/fileset_view.html index 7bc46d45..27d5b6da 100644 --- a/python/fatcat_web/templates/fileset_view.html +++ b/python/fatcat_web/templates/fileset_view.html @@ -1,25 +1,12 @@ {% set fileset = entity %} +{% set entity_view = "overview" %} {% import "entity_macros.html" as entity_macros %} -{% extends "base.html" %} +{% extends "entity_base.html" %} -{% block fullbody %} +{% block entity_main %} <div class="ui stackable mobile reversed grid centered"> -<div class="one wide column"></div> -<div class="fifteen wide column"> - <h1 class="ui header"> - <span class="sub header"><code>fileset {{ entity.ident }}</code></span></h1> -</div> -</div> - -<div class="ui stackable mobile reversed grid centered"> -<div class="one wide column"></div> -<div class="ten wide column" style="font-size: 16px;"> - -{% if entity.extra %} - <h3>Extra Metadata (raw JSON)</h3> - {{ entity_macros.extra_metadata(entity.extra) }} -{% endif %} +<div class="column" style="font-size: 16px; flex: 1;"> <h3>Releases</h3> {% if entity.releases != [] %} @@ -62,7 +49,7 @@ No known public URL, mirror, or archive for this File Set. {% endif %} </div> -<div class="five wide column"> +<div class="column" style="flex: 0 0 24em;"> {% if fileset._total_size != None %} <div class="ui segment attached"> @@ -75,5 +62,4 @@ No known public URL, mirror, or archive for this File Set. </div> </div> - {% endblock %} diff --git a/python/fatcat_web/templates/release_view.html b/python/fatcat_web/templates/release_view.html index 2212741a..5b019b3c 100644 --- a/python/fatcat_web/templates/release_view.html +++ b/python/fatcat_web/templates/release_view.html @@ -246,7 +246,7 @@ <a href="{{ entity.files[0].urls[0].url }}" class="ui top attached fluid huge green button"><i class="file pdf outline icon"></i>Download Full Text</a> {% elif entity.state == 'active' and entity.webcaptures != [] and entity.webcaptures[0].archive_urls != [] and entity.webcaptures[0].archive_urls[0].rel == "wayback" %} <a href="{{ entity.webcaptures[0].archive_urls[0].url }}{{ entity.webcaptures[0]._wayback_suffix }}" class="ui top attached fluid huge green button"><i class="file archive outline icon"></i>View Web Archive</a> -{% else %} +{% elif entity.state == 'active' %} <span class="ui top attached fluid huge grey button"><i class="file cross icon"></i>No Full Text Available</span> {% endif %} @@ -390,6 +390,7 @@ </div> </div> + {% endblock %} {% block postscript %} diff --git a/python/fatcat_web/templates/release_contribs.html b/python/fatcat_web/templates/release_view_contribs.html index 55cdf133..55cdf133 100644 --- a/python/fatcat_web/templates/release_contribs.html +++ b/python/fatcat_web/templates/release_view_contribs.html diff --git a/python/fatcat_web/templates/release_references.html b/python/fatcat_web/templates/release_view_references.html index 22ebaddf..22ebaddf 100644 --- a/python/fatcat_web/templates/release_references.html +++ b/python/fatcat_web/templates/release_view_references.html diff --git a/python/fatcat_web/templates/webcapture_view.html b/python/fatcat_web/templates/webcapture_view.html index b5495cee..16e5c03e 100644 --- a/python/fatcat_web/templates/webcapture_view.html +++ b/python/fatcat_web/templates/webcapture_view.html @@ -1,29 +1,12 @@ {% set webcapture = entity %} +{% set entity_view = "overview" %} {% import "entity_macros.html" as entity_macros %} -{% extends "base.html" %} +{% extends "entity_base.html" %} -{% block fullbody %} +{% block entity_main %} <div class="ui stackable mobile reversed grid centered"> -<div class="one wide column"></div> -<div class="fifteen wide column"> - <h1 class="ui header"> - {% if webcapture.original_url %} - <a href="{{ webcapture.original_url }}" style="color: black;"><code>{{ webcapture.original_url }}</code></a> - {% endif %} - <span class="sub header"><code>webcapture {{ webcapture.ident }}</code></span></h1> -</div> -</div> - -<div class="ui stackable mobile reversed grid centered"> -<div class="one wide column"></div> -<div class="ten wide column" style="font-size: 16px;"> - - -{% if entity.extra %} - <h3>Extra Metadata (raw JSON)</h3> - {{ entity_macros.extra_metadata(entity.extra) }} -{% endif %} +<div class="column" style="font-size: 16px; flex: 1;"> <h3>Releases</h3> {% if entity.releases != [] %} @@ -70,7 +53,7 @@ This web capture is empty (contains no resources). {% endif %} </div> -<div class="five wide column"> +<div class="column" style="flex: 0 0 24em;"> {% if webcapture.timestamp != None %} <div class="ui segment attached"> @@ -83,5 +66,4 @@ This web capture is empty (contains no resources). </div> </div> - {% endblock %} diff --git a/python/fatcat_web/templates/work_view.html b/python/fatcat_web/templates/work_view.html index aa32ba39..3e976597 100644 --- a/python/fatcat_web/templates/work_view.html +++ b/python/fatcat_web/templates/work_view.html @@ -1,25 +1,12 @@ {% set work = entity %} +{% set entity_view = "overview" %} {% import "entity_macros.html" as entity_macros %} -{% extends "base.html" %} +{% extends "entity_base.html" %} -{% block fullbody %} +{% block entity_main %} <div class="ui stackable mobile reversed grid centered"> -<div class="one wide column"></div> -<div class="fifteen wide column"> - <h1 class="ui header"> - <span class="sub header"><code>work {{ work.ident }}</code></span></h1> -</div> -</div> - -<div class="ui stackable mobile reversed grid centered"> -<div class="one wide column"></div> -<div class="ten wide column" style="font-size: 16px;"> - -{% if entity.extra != None %} - <h3>Extra Metadata (raw JSON)</h3> - {{ entity_macros.extra_metadata(entity.extra) }} -{% endif %} +<div class="column" style="font-size: 16px; flex: 1;"> <h3>Releases</h3> {% if work._releases != [] and work._releases != None %} @@ -39,8 +26,7 @@ pre-print and a published article may contain small differences, but still reference the same underlying "work". </div> - -<div class="five wide column"> +<div class="column" style="flex: 0 0 24em;"> {{ entity_macros.fatcat_bits(entity, "work", "", editgroup) }} |