summaryrefslogtreecommitdiffstats
path: root/python/fatcat_web
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2021-02-26 13:58:18 -0800
committerBryan Newbold <bnewbold@robocracy.org>2021-02-26 13:58:18 -0800
commit61e8e3f308c908b526270648a74823cbcb361308 (patch)
treeb45b9bcf894a12ea8dd9b27559cc900ad0cb2166 /python/fatcat_web
parent5c88e4a883bfda83394bd9b6982c2f7bdaaad8c2 (diff)
downloadfatcat-61e8e3f308c908b526270648a74823cbcb361308.tar.gz
fatcat-61e8e3f308c908b526270648a74823cbcb361308.zip
web: improve edit form navigation
Diffstat (limited to 'python/fatcat_web')
-rw-r--r--python/fatcat_web/templates/container_edit.html9
-rw-r--r--python/fatcat_web/templates/edit_macros.html15
-rw-r--r--python/fatcat_web/templates/entity_delete.html3
-rw-r--r--python/fatcat_web/templates/entity_edit_toml.html7
-rw-r--r--python/fatcat_web/templates/file_edit.html9
-rw-r--r--python/fatcat_web/templates/release_edit.html2
6 files changed, 26 insertions, 19 deletions
diff --git a/python/fatcat_web/templates/container_edit.html b/python/fatcat_web/templates/container_edit.html
index 99f77d53..1885197c 100644
--- a/python/fatcat_web/templates/container_edit.html
+++ b/python/fatcat_web/templates/container_edit.html
@@ -2,19 +2,14 @@
{% extends "base.html" %}
{% block body %}
+
{% block edit_form_prefix %}
+{{ edit_macros.edit_link_bar('container', existing_ident, 'form') }}
<div class="ui segment">
<h1 class="ui header">Edit Container Entity</h1>
<form class="ui form" id="edit_container_form" method="POST" action="{% if editgroup %}/editgroup/{{ editgroup.editgroup_id }}{% endif %}/container/{{ existing_ident }}/edit">
- <p>Experienced users can also use the <a href="{% if editgroup
- %}/editgroup/{{ editgroup.editgroup_id }}{% endif %}/container/{{
- existing_ident }}/edit/toml">TOML editing form</a> to access all metadata
- fields in a raw format.
- {% if not editgroup %}
- You can also <a href="/container/{{ existing_ident }}/delete">delete this entity</a>.
- {% endif %}
{% endblock %}
<p>See <a href="https://guide.fatcat.wiki/entity_container.html">the catalog
diff --git a/python/fatcat_web/templates/edit_macros.html b/python/fatcat_web/templates/edit_macros.html
index d4839373..a7cf725b 100644
--- a/python/fatcat_web/templates/edit_macros.html
+++ b/python/fatcat_web/templates/edit_macros.html
@@ -1,4 +1,17 @@
+{% macro edit_link_bar(entity_type, existing_ident, view) -%}
+ {% set has_form = entity_type in ['release', 'file', 'container'] %}
+ <div class="ui {% if has_form %}four{% else %}three{% endif %} item menu">
+ <a class="item" href="/{{ entity_type }}/{{ existing_ident }}">View</a>
+ {% if has_form %}
+ <a class="item {% if view == 'form' %}active{% endif %}" href="/{{ entity_type }}/{{ existing_ident }}/edit">Edit Form</a>
+ {% endif %}
+ <a class="item {% if view == 'toml' %}active{% endif %}" href="/{{ entity_type }}/{{ existing_ident }}/edit/toml">Edit TOML</a>
+ <a class="red item {% if view == 'delete' %}active{% endif %}" href="/{{ entity_type }}/{{ existing_ident }}/delete">Delete</a>
+ </div>
+{% endmacro %}
+
+
{% macro form_field_errors(field) -%}
{% if field.errors %}
<div class="ui pointing red label">
@@ -71,7 +84,7 @@
<div class="menu">
{% for peg in potential_editgroups %}
<div class="item" data-value="{{ peg.editgroup_id }}">
- <div class="right floated">{{ peg.created }}</div>
+ <div class="right floated">{{ peg.created.strftime('%Y-%m-%d %X') }}</div>
<code><b>editgroup_{{ peg.editgroup_id }}</b></code>
{% if peg.description %}
<br>{{ peg.description[:200] }}
diff --git a/python/fatcat_web/templates/entity_delete.html b/python/fatcat_web/templates/entity_delete.html
index b2e13af4..5f677992 100644
--- a/python/fatcat_web/templates/entity_delete.html
+++ b/python/fatcat_web/templates/entity_delete.html
@@ -2,6 +2,9 @@
{% extends "base.html" %}
{% block body %}
+
+{{ edit_macros.edit_link_bar(entity_type, existing_ident, 'delete') }}
+
{% block edit_form_prefix %}
<div class="ui segment">
<h1 class="ui header">Delete Entity</h1>
diff --git a/python/fatcat_web/templates/entity_edit_toml.html b/python/fatcat_web/templates/entity_edit_toml.html
index 64768d6e..1ff9010d 100644
--- a/python/fatcat_web/templates/entity_edit_toml.html
+++ b/python/fatcat_web/templates/entity_edit_toml.html
@@ -2,15 +2,14 @@
{% extends "base.html" %}
{% block body %}
+
{% block edit_form_prefix %}
+ {{ edit_macros.edit_link_bar(entity_type, existing_ident, 'toml') }}
<div class="ui segment">
- <h1 class="ui header">Edit Entity (TOML mode)</h1>
+ <h1 class="ui header">Edit Entity</h1>
<form class="ui form" id="edit_toml_form" method="POST" action="{% if editgroup and editgroup.editgroup_id %}/editgroup/{{ editgroup.editgroup_id }}{% endif %}/{{ entity_type }}/{{ existing_ident }}/edit/toml">
- {% if not editgroup %}
- <p>You can also <a href="/{{ entity_type }}/{{ existing_ident }}/delete">delete this entity</a>.
- {% endif %}
{% endblock %}
<p>See <a href="https://guide.fatcat.wiki/entity_release.html">the catalog
diff --git a/python/fatcat_web/templates/file_edit.html b/python/fatcat_web/templates/file_edit.html
index 745b0c41..b7ff1d72 100644
--- a/python/fatcat_web/templates/file_edit.html
+++ b/python/fatcat_web/templates/file_edit.html
@@ -2,19 +2,14 @@
{% extends "base.html" %}
{% block body %}
+
{% block edit_form_prefix %}
+{{ edit_macros.edit_link_bar(entity_type, existing_ident) }}
<div class="ui segment">
<h1 class="ui header">Edit File Entity</h1>
<form class="ui form" id="edit_file_form" method="POST" action="{% if editgroup %}/editgroup/{{ editgroup.editgroup_id }}{% endif %}/file/{{ existing_ident }}/edit">
- <p>Experienced users can also use the <a href="{% if editgroup
- %}/editgroup/{{ editgroup.editgroup_id }}{% endif %}/file/{{
- existing_ident }}/edit/toml">TOML editing form</a> to access all metadata
- fields in a raw format.
- {% if not editgroup %}
- You can also <a href="/file/{{ existing_ident }}/delete">delete this entity</a>.
- {% endif %}
{% endblock %}
<p>See <a href="https://guide.fatcat.wiki/entity_file.html">the catalog
diff --git a/python/fatcat_web/templates/release_edit.html b/python/fatcat_web/templates/release_edit.html
index c26c9850..0ac94be9 100644
--- a/python/fatcat_web/templates/release_edit.html
+++ b/python/fatcat_web/templates/release_edit.html
@@ -2,7 +2,9 @@
{% extends "base.html" %}
{% block body %}
+
{% block edit_form_prefix %}
+{{ edit_macros.edit_link_bar('release', existing_ident, 'form') }}
<div class="ui segment">
<h1 class="ui header">Edit Release Entity</h1>