mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-17 13:32:15 +00:00
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:
@@ -30,5 +30,5 @@
|
|||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
{% include 'partials/asset_buttons.html' %}
|
{% include 'partials/asset_buttons.html' %}
|
||||||
</div>
|
</div>
|
||||||
{% include 'partials/last_edited_asset.html' with target="asset_history" %}
|
{% include 'partials/last_edited.html' with target="asset_history" id=object.asset_id %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@@ -233,18 +233,33 @@ class SupplierVersionHistory(versioning.VersionHistory):
|
|||||||
|
|
||||||
|
|
||||||
class AssetVersionHistory(versioning.VersionHistory):
|
class AssetVersionHistory(versioning.VersionHistory):
|
||||||
template_name = "asset_version_history.html"
|
template_name = "version_history.html"
|
||||||
|
|
||||||
def get_object(self, **kwargs):
|
def get_object(self, **kwargs):
|
||||||
return get_object_or_404(models.Asset, asset_id=self.kwargs['pk'])
|
return get_object_or_404(models.Asset, asset_id=self.kwargs['pk'])
|
||||||
|
|
||||||
|
def get_context_data(self, **kwargs):
|
||||||
|
context = super(AssetVersionHistory, self).get_context_data(**kwargs)
|
||||||
|
context['object'] = self.get_object()
|
||||||
|
context['id'] = self.get_object().asset_id
|
||||||
|
context['override'] = 'base_assets.html'
|
||||||
|
|
||||||
|
return context
|
||||||
|
|
||||||
|
|
||||||
class ActivityTable(versioning.ActivityTable):
|
class ActivityTable(versioning.ActivityTable):
|
||||||
model = versioning.RIGSVersion
|
model = versioning.RIGSVersion
|
||||||
template_name = "asset_activity_table.html"
|
template_name = "activity_table.html"
|
||||||
paginate_by = 25
|
paginate_by = 25
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
versions = versioning.RIGSVersion.objects.get_for_multiple_models(
|
versions = versioning.RIGSVersion.objects.get_for_multiple_models(
|
||||||
[models.Asset, models.Supplier])
|
[models.Asset, models.Supplier])
|
||||||
return versions
|
return versions
|
||||||
|
|
||||||
|
def get_context_data(self, **kwargs):
|
||||||
|
context = super(ActivityTable, self).get_context_data(**kwargs)
|
||||||
|
context['override'] = 'base_assets.html'
|
||||||
|
context['title'] = 'Asset Database'
|
||||||
|
|
||||||
|
return context
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{% block js %}
|
{% block js %}
|
||||||
{% include 'version_scripts.html' %}
|
{% include 'partials/version_scripts.html' %}
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$(function () {
|
$(function () {
|
||||||
|
|||||||
@@ -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 paginator from filters %}
|
||||||
{% load to_class_name from filters %}
|
{% load to_class_name from filters %}
|
||||||
|
|
||||||
{% block title %}Rigboard Activity Stream{% endblock %}
|
{% block title %}{{ title }} Activity Stream{% endblock %}
|
||||||
|
|
||||||
{% block js %}
|
{% block js %}
|
||||||
{% include 'version_scripts.html' %}
|
{% include 'partials/version_scripts.html' %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="col-sm-12">
|
<div class="col-sm-12">
|
||||||
<h3>Rigboard Activity Stream</h3>
|
<h3>{{ title }} Activity Stream</h3>
|
||||||
{% include 'partials/activity_table_body.html' %}
|
{% include 'partials/activity_table_body.html' %}
|
||||||
{% paginator %}
|
{% paginator %}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -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 %}
|
|
||||||
@@ -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 %}
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<div class="pt-2">
|
<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' }}
|
Last edited {{ object.last_edited_at|default:'never' }} by {{ object.last_edited_by.name|default:'System' }}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -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>
|
|
||||||
@@ -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 to_class_name from filters %}
|
||||||
{% load paginator 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 %}
|
{% block js %}
|
||||||
{% include 'version_scripts.html' %}
|
{% include 'partials/version_scripts.html' %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="col-sm-12">
|
<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' %}
|
{% include 'partials/version_history_table.html' %}
|
||||||
<div>{% paginator %}</div>
|
<div>{% paginator %}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -209,6 +209,7 @@ class VersionHistory(generic.ListView):
|
|||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
context = super(VersionHistory, self).get_context_data(**kwargs)
|
context = super(VersionHistory, self).get_context_data(**kwargs)
|
||||||
context['object'] = self.get_object()
|
context['object'] = self.get_object()
|
||||||
|
context['id'] = self.get_object().pk
|
||||||
|
|
||||||
return context
|
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])
|
versions = RIGSVersion.objects.get_for_multiple_models([models.Event, models.Venue, models.Person, models.Organisation, models.EventAuthorisation])
|
||||||
return versions.order_by("-revision__date_created")
|
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):
|
class ActivityFeed(generic.ListView):
|
||||||
model = RIGSVersion
|
model = RIGSVersion
|
||||||
|
|||||||
Reference in New Issue
Block a user