Tweak versioning templates to allow ID overrides

Asset specific templates begone. Still need to bring back the ID formatting for the Rigboard.
This commit is contained in:
2020-04-06 14:59:10 +01:00
parent d216dd4c74
commit 176324ed79
11 changed files with 35 additions and 53 deletions

View File

@@ -1,5 +1,5 @@
{% block js %}
{% include 'version_scripts.html' %}
{% include 'partials/version_scripts.html' %}
<script>
$(document).ready(function() {
$(function () {

View File

@@ -1,16 +1,16 @@
{% extends request.is_ajax|yesno:"base_ajax.html,base_rigs.html" %}
{% extends override|default:'base_rigs.html' %}
{% load paginator from filters %}
{% load to_class_name from filters %}
{% block title %}Rigboard Activity Stream{% endblock %}
{% block title %}{{ title }} Activity Stream{% endblock %}
{% block js %}
{% include 'version_scripts.html' %}
{% include 'partials/version_scripts.html' %}
{% endblock %}
{% block content %}
<div class="col-sm-12">
<h3>Rigboard Activity Stream</h3>
<h3>{{ title }} Activity Stream</h3>
{% include 'partials/activity_table_body.html' %}
{% paginator %}
</div>

View File

@@ -1,17 +0,0 @@
{% extends request.is_ajax|yesno:"base_ajax.html,base_assets.html" %}
{% load static %}
{% load paginator from filters %}
{% block title %}Asset Activity Stream{% endblock %}
{% block js %}
{% include 'version_scripts.html' %}
{% endblock %}
{% block content %}
<div class="col-sm-12">
<h3>Asset Activity Stream</h3>
{% include 'partials/activity_table_body.html' %}
<div class="align-center">{% paginator %}</div>
</div>
{% endblock %}

View File

@@ -1,18 +0,0 @@
{% extends request.is_ajax|yesno:"base_ajax.html,base_assets.html" %}
{% load to_class_name from filters %}
{% load paginator from filters %}
{% load static %}
{% block title %}{{object|to_class_name}} {{ object.asset_id }} - Revision History{% endblock %}
{% block js %}
{% include 'version_scripts.html' %}
{% endblock %}
{% block content %}
<div class="col-sm-12">
<h3><a href="{{ object.get_absolute_url }}">{{object|to_class_name}} {{ object.asset_id|default:object.pk }}</a> - Revision History</h3>
{% include 'partials/version_history_table.html' %}
<div>{% paginator %}</div>
</div>
{% endblock %}

View File

@@ -1,5 +1,5 @@
<div class="pt-2">
<a href="{% url target object.pk %}" title="View Revision History">
<a href="{% url target id|default:object.pk %}" title="View Revision History">
Last edited {{ object.last_edited_at|default:'never' }} by {{ object.last_edited_by.name|default:'System' }}
</a>
</div>

View File

@@ -1,5 +0,0 @@
<div class="pt-2">
<a href="{% url target object.asset_id %}" title="View Revision History">
Last edited {{ object.last_edited_at|default:'never' }} by {{ object.last_edited_by.name|default:'System' }}
</a>
</div>

View File

@@ -1,16 +1,16 @@
{% extends request.is_ajax|yesno:"base_ajax.html,base_rigs.html" %}
{% extends override|default:'base_rigs.html' %}
{% load to_class_name from filters %}
{% load paginator from filters %}
{% block title %}{{object|to_class_name}} {{ object.pk|stringformat:"05d" }} - Revision History{% endblock %}
{% block title %}{{object|to_class_name}} {{ id }} - Revision History{% endblock %}
{% block js %}
{% include 'version_scripts.html' %}
{% include 'partials/version_scripts.html' %}
{% endblock %}
{% block content %}
<div class="col-sm-12">
<h3><a href="{{ object.get_absolute_url }}">{{object|to_class_name}} {{ object.pk|stringformat:"05d" }}</a> - Revision History</h3>
<h3><a href="{{ object.get_absolute_url }}">{{object|to_class_name}} {{ id }}</a> - Revision History</h3>
{% include 'partials/version_history_table.html' %}
<div>{% paginator %}</div>
</div>

View File

@@ -209,6 +209,7 @@ class VersionHistory(generic.ListView):
def get_context_data(self, **kwargs):
context = super(VersionHistory, self).get_context_data(**kwargs)
context['object'] = self.get_object()
context['id'] = self.get_object().pk
return context
@@ -222,6 +223,12 @@ class ActivityTable(generic.ListView):
versions = RIGSVersion.objects.get_for_multiple_models([models.Event, models.Venue, models.Person, models.Organisation, models.EventAuthorisation])
return versions.order_by("-revision__date_created")
def get_context_data(self, **kwargs):
context = super(ActivityTable, self).get_context_data(**kwargs)
context['title'] = 'Rigboard'
return context
class ActivityFeed(generic.ListView):
model = RIGSVersion