diff options
-rw-r--r-- | fatcat/api.py | 14 | ||||
-rw-r--r-- | fatcat/templates/editgroup_view.html | 40 |
2 files changed, 51 insertions, 3 deletions
diff --git a/fatcat/api.py b/fatcat/api.py index eaf45d77..2c91533b 100644 --- a/fatcat/api.py +++ b/fatcat/api.py @@ -231,8 +231,18 @@ def api_editgroup_get(ident): .join(EditGroup.editor)\ .filter(EditGroup.id==ident)\ .first_or_404() - # XXX: fill in all the related edit types... - return editgroup_schema.jsonify(entity) + rv = editgroup_schema.dump(entity).data + rv['work_edits'] = work_edit_schema.dump( + WorkEdit.query.filter(EditGroup.id==ident).all(), many=True).data + rv['release_edits'] = release_edit_schema.dump( + ReleaseEdit.query.filter(EditGroup.id==ident).all(), many=True).data + rv['creator_edits'] = creator_edit_schema.dump( + CreatorEdit.query.filter(EditGroup.id==ident).all(), many=True).data + rv['container_edits'] = container_edit_schema.dump( + ContainerEdit.query.filter(EditGroup.id==ident).all(), many=True).data + rv['file_edits'] = file_edit_schema.dump( + FileEdit.query.filter(EditGroup.id==ident).all(), many=True).data + return jsonify(rv) @app.route('/v0/editgroup', methods=['POST']) def api_editgroup_create(params=None): diff --git a/fatcat/templates/editgroup_view.html b/fatcat/templates/editgroup_view.html index 144c9502..4ed08501 100644 --- a/fatcat/templates/editgroup_view.html +++ b/fatcat/templates/editgroup_view.html @@ -6,6 +6,44 @@ <p>Editor: <a href="/editor/{{ editgroup.editor.username }}">{{ editgroup.editor.username }}</a> <p>Description: {{ editgroup.description }} -<p>TODO: list edits by type...</p> +<h3>Work Edits ({{ editgroup.work_edits|count }})</h3> +<ul> +{% for edit in editgroup.work_edits %} + <li><a href="/work/edit/{{ edit.id }}">Edit #{{ edit.id }}</a>: + <a href="/work/{{ edit.ident }}">{{ edit.ident }}</a> to rev {{ edit.rev }} +{% endfor %} +</ul> + +<h3>Release Edits ({{ editgroup.release_edits|count }})</h3> +<ul> +{% for edit in editgroup.release_edits %} + <li><a href="/release/edit/{{ edit.id }}">Edit #{{ edit.id }}</a> + <a href="/release/{{ edit.ident }}">{{ edit.ident }}</a> to rev {{ edit.rev }} +{% endfor %} +</ul> + +<h3>Container Edits ({{ editgroup.container_edits|count }})</h3> +<ul> +{% for edit in editgroup.container_edits %} + <li><a href="/container/edit/{{ edit.id }}">Edit #{{ edit.id }}</a> + <a href="/container/{{ edit.ident }}">{{ edit.ident }}</a> to rev {{ edit.rev }} +{% endfor %} +</ul> + +<h3>Creator Edits ({{ editgroup.creator_edits|count }})</h3> +<ul> +{% for edit in editgroup.creator_edits %} + <li><a href="/creator/edit/{{ edit.id }}">Edit #{{ edit.id }}</a> + <a href="/creator/{{ edit.ident }}">{{ edit.ident }}</a> to rev {{ edit.rev }} +{% endfor %} +</ul> + +<h3>File Edits ({{ editgroup.file_edits|count }})</h3> +<ul> +{% for edit in editgroup.file_edits %} + <li><a href="/file/edit/{{ edit.id }}">Edit #{{ edit.id }}</a> + <a href="/file/{{ edit.ident }}">{{ edit.ident }}</a> to rev {{ edit.rev }} +{% endfor %} +</ul> {% endblock %} |