aboutsummaryrefslogtreecommitdiff
path: root/rpkid
diff options
context:
space:
mode:
authorMichael Elkins <melkins@tislabs.com>2012-11-26 22:15:17 +0000
committerMichael Elkins <melkins@tislabs.com>2012-11-26 22:15:17 +0000
commit6aaa8992229d3d2114f098e9a5fafcf85043c00c (patch)
tree9704eb7d086e0ca21cddcb5a91d21893c2591086 /rpkid
parenta304688ecaf6ec681f27e8f82e0c0b1ae1b04d2d (diff)
remove *_list templates since they are no longer used
remove object_detail.html templates, and make all the *_detail.html templates dervice from app_base.html directly. there was no functionality left worth having in the intermediate template remove verbose_name from some models where it wasn't needed add form_title variable to some forms where it was missing svn path=/branches/tk329/; revision=4905
Diffstat (limited to 'rpkid')
-rw-r--r--rpkid/rpki/gui/app/models.py5
-rw-r--r--rpkid/rpki/gui/app/templates/app/child_detail.html13
-rw-r--r--rpkid/rpki/gui/app/templates/app/child_list.html7
-rw-r--r--rpkid/rpki/gui/app/templates/app/client_detail.html11
-rw-r--r--rpkid/rpki/gui/app/templates/app/ghostbusterrequest_detail.html12
-rw-r--r--rpkid/rpki/gui/app/templates/app/ghostbusterrequest_list.html13
-rw-r--r--rpkid/rpki/gui/app/templates/app/object_confirm_delete.html2
-rw-r--r--rpkid/rpki/gui/app/templates/app/object_detail.html17
-rw-r--r--rpkid/rpki/gui/app/templates/app/object_list.html34
-rw-r--r--rpkid/rpki/gui/app/templates/app/object_table.html39
-rw-r--r--rpkid/rpki/gui/app/templates/app/parent_detail.html13
-rw-r--r--rpkid/rpki/gui/app/templates/app/parent_list.html5
-rw-r--r--rpkid/rpki/gui/app/templates/app/repository_detail.html10
-rw-r--r--rpkid/rpki/gui/app/templates/app/repository_list.html7
-rw-r--r--rpkid/rpki/gui/app/templates/app/roa_detail.html10
-rw-r--r--rpkid/rpki/gui/app/templates/app/roa_request_list.html14
-rw-r--r--rpkid/rpki/gui/app/templates/app/route_detail.html46
-rw-r--r--rpkid/rpki/gui/app/templatetags/app_extras.py4
-rw-r--r--rpkid/rpki/gui/app/views.py20
19 files changed, 87 insertions, 195 deletions
diff --git a/rpkid/rpki/gui/app/models.py b/rpkid/rpki/gui/app/models.py
index 2975aa0a..fdb18b73 100644
--- a/rpkid/rpki/gui/app/models.py
+++ b/rpkid/rpki/gui/app/models.py
@@ -46,7 +46,6 @@ class Parent(rpki.irdb.models.Parent):
class Meta:
proxy = True
- verbose_name = 'Parent'
class Child(rpki.irdb.models.Child):
@@ -61,8 +60,7 @@ class Child(rpki.irdb.models.Child):
class Meta:
proxy = True
- verbose_name = 'Child'
- verbose_name_plural = 'Children'
+ verbose_name_plural = 'children'
class ChildASN(rpki.irdb.models.ChildASN):
@@ -228,7 +226,6 @@ class GhostbusterRequest(rpki.irdb.models.GhostbusterRequest):
class Meta:
ordering = ('family_name', 'given_name')
- verbose_name = 'Ghostbuster'
class Timestamp(models.Model):
diff --git a/rpkid/rpki/gui/app/templates/app/child_detail.html b/rpkid/rpki/gui/app/templates/app/child_detail.html
index 3e1feaaa..d2896209 100644
--- a/rpkid/rpki/gui/app/templates/app/child_detail.html
+++ b/rpkid/rpki/gui/app/templates/app/child_detail.html
@@ -1,6 +1,10 @@
-{% extends "app/object_detail.html" %}
+{% extends "app/app_base.html" %}
+
+{% block content %}
+<div class="page-header">
+ <h1>Child: {{ object.handle }}</h1>
+</div>
-{% block object_display %}
<div class='row'>
<div class='span2'>
<p><strong>Child Handle</strong>
@@ -44,7 +48,6 @@
{% endif %}
</div>
</div>
-{% endblock object_display %}
{% block action %}
<a class='btn' href="{% url rpki.gui.app.views.child_edit object.pk %}" title='Edit this child'><i class="icon-edit"></i> Edit</a>
@@ -52,4 +55,6 @@
<a class='btn' href="{% url rpki.gui.app.views.child_add_prefix object.pk %}" title='Delegate a prefix to this child'><i class="icon-plus-sign"></i> Prefix</a>
<a class='btn' href="{% url rpki.gui.app.views.child_response object.pk %}" title='Download XML file to send to child'><i class="icon-download"></i> Export</a>
<a class="btn" href="{% url rpki.gui.app.views.child_delete object.pk %}" title="Delete this child"><i class="icon-trash"></i> Delete</a>
-{% endblock action %}
+{% endblock %}
+
+{% endblock %}
diff --git a/rpkid/rpki/gui/app/templates/app/child_list.html b/rpkid/rpki/gui/app/templates/app/child_list.html
deleted file mode 100644
index 9ba31ffd..00000000
--- a/rpkid/rpki/gui/app/templates/app/child_list.html
+++ /dev/null
@@ -1,7 +0,0 @@
-{% extends "app/object_list.html" %}
-
-{% block object_detail %}
-<li><a href="{{ object.get_absolute_url }}">{{ object.handle }}</a></li>
-{% endblock object_detail %}
-
-<!-- vim: set sw=2: -->
diff --git a/rpkid/rpki/gui/app/templates/app/client_detail.html b/rpkid/rpki/gui/app/templates/app/client_detail.html
index 2e3930e6..2808cf20 100644
--- a/rpkid/rpki/gui/app/templates/app/client_detail.html
+++ b/rpkid/rpki/gui/app/templates/app/client_detail.html
@@ -1,6 +1,10 @@
-{% extends "app/object_detail.html" %}
+{% extends "app/app_base.html" %}
+
+{% block content %}
+<div class="page-header">
+ <h1>Repository Client: {{ object.handle }}</h1>
+</div>
-{% block object_display %}
<div class='row'>
<div class='span3'>
<table class="table">
@@ -15,8 +19,9 @@
</table>
</div>
</div>
-{% endblock object_display %}
{% block action %}
<a class="btn" href="{% url rpki.gui.app.views.client_delete object.pk %}"><i class="icon-trash"></i> Delete</a>
{% endblock %}
+
+{% endblock %}
diff --git a/rpkid/rpki/gui/app/templates/app/ghostbusterrequest_detail.html b/rpkid/rpki/gui/app/templates/app/ghostbusterrequest_detail.html
index fde43a97..5849c11d 100644
--- a/rpkid/rpki/gui/app/templates/app/ghostbusterrequest_detail.html
+++ b/rpkid/rpki/gui/app/templates/app/ghostbusterrequest_detail.html
@@ -1,6 +1,10 @@
-{% extends "app/object_detail.html" %}
+{% extends "app/app_base.html" %}
+
+{% block content %}
+<div class="page-header">
+ <h1>Ghostbuster Request</h1>
+</div>
-{% block object_display %}
<table class='table table-striped table-condensed'>
<tr><td>Full Name</td><td>{{ object.full_name }}</td></tr>
@@ -49,9 +53,11 @@
{% endif %}
</table>
-{% endblock object_display %}
{% block action %}
+{# the roarequest_confirm_delete template will override this section #}
<a class="btn" href="{% url gbr-edit object.pk %}"><i class="icon-edit"></i> Edit</a>
<a class="btn" href="{% url gbr-delete object.pk %}"><i class="icon-trash"></i> Delete</a>
{% endblock %}
+
+{% endblock %}
diff --git a/rpkid/rpki/gui/app/templates/app/ghostbusterrequest_list.html b/rpkid/rpki/gui/app/templates/app/ghostbusterrequest_list.html
deleted file mode 100644
index 327b79b1..00000000
--- a/rpkid/rpki/gui/app/templates/app/ghostbusterrequest_list.html
+++ /dev/null
@@ -1,13 +0,0 @@
-{% extends "app/object_list.html" %}
-
-{% block object_detail %}
-<li><a href="{{ object.get_absolute_url }}">{{ object.full_name }}</a></li>
-{% endblock object_detail %}
-
-{% block actions %}
-<div class='actions'>
- <a class='btn' href='{% url rpki.gui.app.views.ghostbuster_create %}' title='Create a new Ghostbuster Request'>Create</a>
-</div>
-{% endblock actions %}
-
-<!-- vim: set sw=2: -->
diff --git a/rpkid/rpki/gui/app/templates/app/object_confirm_delete.html b/rpkid/rpki/gui/app/templates/app/object_confirm_delete.html
index 821b70b5..26a21ccb 100644
--- a/rpkid/rpki/gui/app/templates/app/object_confirm_delete.html
+++ b/rpkid/rpki/gui/app/templates/app/object_confirm_delete.html
@@ -6,8 +6,6 @@ type. The *DeleteView classes should set a "parent_template" variable which is
string specifying the concrete template to inherit from.
{% endcomment %}
-{% block action_name %}Delete{% endblock %}
-
{% block action %}
<div class="alert alert-warning alert-block">
<h4>Warning!</h4>
diff --git a/rpkid/rpki/gui/app/templates/app/object_detail.html b/rpkid/rpki/gui/app/templates/app/object_detail.html
deleted file mode 100644
index fc1e142e..00000000
--- a/rpkid/rpki/gui/app/templates/app/object_detail.html
+++ /dev/null
@@ -1,17 +0,0 @@
-{% extends "app/app_base.html" %}
-{% load app_extras %}
-
-{% block content %}
-<div class="page-header">
- <h1>{% verbose_name object %} {% block action_name %}Detail{% endblock action_name %}
-</div>
-
-{# this block is reponsible for rendering the object #}
-{% block object_display %}
-{{ object }}
-{% endblock object_display %}
-
-{% block action %}
-{% endblock action %}
-
-{% endblock content %}
diff --git a/rpkid/rpki/gui/app/templates/app/object_list.html b/rpkid/rpki/gui/app/templates/app/object_list.html
deleted file mode 100644
index eee08170..00000000
--- a/rpkid/rpki/gui/app/templates/app/object_list.html
+++ /dev/null
@@ -1,34 +0,0 @@
-{% extends "app/app_base.html" %}
-{% load app_extras %}
-
-{# generic object list #}
-
-{% block content %}
-
-<div class='page-header'>
- <h1>{% verbose_name_plural object_list %}</h1>
-</div>
-
-{% if object_list %}
-<ul>
- {% for object in object_list %}
- {% block object_detail %}
- <li><a href="{{ object.get_absolute_url }}">{{ object }}</a></li>
- {% endblock %}
- {% endfor %}
-</ul>
-{% else %}
-<div class='alert alert-warning'>
- There are <strong>no items</strong> in this list.
-</div>
-{% endif %}
-
-{% block actions %}
-{% if create_url %}
-<div class='actions'>
- <a class='btn' href='{{ create_url }}'>{{ create_label|default:"Create" }}</a>
-</div>
-{% endif %}
-{% endblock %}
-
-{% endblock %}
diff --git a/rpkid/rpki/gui/app/templates/app/object_table.html b/rpkid/rpki/gui/app/templates/app/object_table.html
deleted file mode 100644
index 6a3ade84..00000000
--- a/rpkid/rpki/gui/app/templates/app/object_table.html
+++ /dev/null
@@ -1,39 +0,0 @@
-{% extends "app/app_base.html" %}
-{% load app_extras %}
-
-{# Generic object list displayed as a table. #}
-
-{% block content %}
-
-<div class='page-header'>
- <h1>{% verbose_name_plural object_list %}</h1>
-</div>
-
-{% if object_list %}
-<table style='table table-striped table-condensed'>
- <tr>
- {% block table_header %}{% endblock %}
- </tr>
- {% for object in object_list %}
- <tr>
- {% block object_detail %}
- <td><a href="{{ object.get_absolute_url }}">{{ object }}</a></td>
- {% endblock %}
- </tr>
- {% endfor %}
-</table>
-{% else %}
-<div class='alert alert-warning'>
- There are <strong>no items</strong> in this list.
-</div>
-{% endif %}
-
-{% block actions %}
-{% if create_url %}
-<a class='btn' href='{{ create_url }}'>{{ create_label|default:"Create" }}</a>
-{% endif %}
-{% endblock %}
-
-{% endblock %}
-
-<!-- vim: set sw=2: -->
diff --git a/rpkid/rpki/gui/app/templates/app/parent_detail.html b/rpkid/rpki/gui/app/templates/app/parent_detail.html
index 7b2f85f0..590cedc1 100644
--- a/rpkid/rpki/gui/app/templates/app/parent_detail.html
+++ b/rpkid/rpki/gui/app/templates/app/parent_detail.html
@@ -1,7 +1,9 @@
-{% extends "app/object_detail.html" %}
+{% extends "app/app_base.html" %}
-{% block object_display %}
-<h2>{{ object.handle }}</h2>
+{% block content %}
+<div class="page-header">
+ <h1>Parent: {{ object.handle }}</h1>
+</div>
<table class="table table-striped table-condensed">
<tr>
@@ -55,9 +57,10 @@
</ul>
</div>
</div>
-{% endblock object_display %}
{% block action %}
<a class='btn' href='{% url rpki.gui.app.views.parent_export object.pk %}' title='Download XML to send to repository operator'><i class="icon-download"></i> Export</a>
<a class="btn" href="{% url rpki.gui.app.views.parent_delete object.pk %}" title="Delete this parent"><i class="icon-trash"></i> Delete</a>
-{% endblock action %}
+{% endblock %}
+
+{% endblock %}
diff --git a/rpkid/rpki/gui/app/templates/app/parent_list.html b/rpkid/rpki/gui/app/templates/app/parent_list.html
deleted file mode 100644
index 81744130..00000000
--- a/rpkid/rpki/gui/app/templates/app/parent_list.html
+++ /dev/null
@@ -1,5 +0,0 @@
-{% extends "app/object_list.html" %}
-
-{% block object_detail %}
-<li><a href="{{ object.get_absolute_url }}">{{ object.handle }}</a></li>
-{% endblock object_detail %}
diff --git a/rpkid/rpki/gui/app/templates/app/repository_detail.html b/rpkid/rpki/gui/app/templates/app/repository_detail.html
index 5eec3d02..caae7f53 100644
--- a/rpkid/rpki/gui/app/templates/app/repository_detail.html
+++ b/rpkid/rpki/gui/app/templates/app/repository_detail.html
@@ -1,6 +1,10 @@
-{% extends "app/object_detail.html" %}
+{% extends "app/app_base.html" %}
+
+{% block content %}
+<div class="page-header">
+ <h1>Repository: {{ object.handle }}</h1>
+</div>
-{% block object_display %}
<div class='row'>
<div class='span2'>
<p><strong>Name</strong>
@@ -17,8 +21,8 @@
<p>{{ object.sia_base }}</td>
</div>
</div>
-{% endblock object_display %}
{% block action %}
<a class="btn" href="{% url rpki.gui.app.views.repository_delete object.pk %}" title="Delete this repository"><i class="icon-trash"></i> Delete</a>
{% endblock %}
+{% endblock %}
diff --git a/rpkid/rpki/gui/app/templates/app/repository_list.html b/rpkid/rpki/gui/app/templates/app/repository_list.html
deleted file mode 100644
index 2ccd0223..00000000
--- a/rpkid/rpki/gui/app/templates/app/repository_list.html
+++ /dev/null
@@ -1,7 +0,0 @@
-{% extends "app/object_list.html" %}
-
-{% block object_detail %}
-<li><a href="{{ object.get_absolute_url }}">{{ object.handle }}</a></li>
-{% endblock %}
-
-<!-- vim:set sw=2: -->
diff --git a/rpkid/rpki/gui/app/templates/app/roa_detail.html b/rpkid/rpki/gui/app/templates/app/roa_detail.html
index e9defcc1..f2cd53fc 100644
--- a/rpkid/rpki/gui/app/templates/app/roa_detail.html
+++ b/rpkid/rpki/gui/app/templates/app/roa_detail.html
@@ -1,6 +1,10 @@
-{% extends "app/object_detail.html" %}
+{% extends "app/app_base.html" %}
+
+{% block content %}
+<div class="page-header">
+ <h1>ROA Request</h1>
+</div>
-{% block object_display %}
<div class="row">
<div class="span3 well">
<table class="table">
@@ -22,8 +26,6 @@
</table>
</div>
</div>
-{% endblock %}
-{% block action %}
<a class="btn" href="{% url rpki.gui.app.views.roa_delete object.pk %}"><i class="icon-trash"></i> Delete</a>
{% endblock %}
diff --git a/rpkid/rpki/gui/app/templates/app/roa_request_list.html b/rpkid/rpki/gui/app/templates/app/roa_request_list.html
deleted file mode 100644
index 9ffe4f57..00000000
--- a/rpkid/rpki/gui/app/templates/app/roa_request_list.html
+++ /dev/null
@@ -1,14 +0,0 @@
-{% extends "app/object_table.html" %}
-
-{% block table_header %}
-<th>Prefix</th><th>Max Length</th><th>ASN</th><th>Action</th>
-{% endblock %}
-
-{% block object_detail %}
-<td>{{ object.prefix }}/{{ object.prefixlen }}</a></td>
-<td>{{ object.max_prefixlen }}</td>
-<td>{{ object.roa_request.asn }}</td>
-<td><a class='btn danger' href="{{ object.get_absolute_url }}/delete">Delete</a></td>
-{% endblock %}
-
-<!-- vim: set sw=2: -->
diff --git a/rpkid/rpki/gui/app/templates/app/route_detail.html b/rpkid/rpki/gui/app/templates/app/route_detail.html
index 1d526b42..238d6c2a 100644
--- a/rpkid/rpki/gui/app/templates/app/route_detail.html
+++ b/rpkid/rpki/gui/app/templates/app/route_detail.html
@@ -1,8 +1,11 @@
-{% extends "app/object_detail.html" %}
+{% extends "app/app_base.html" %}
{# template for displaying the list of ROAs covering a specific route #}
-{% block object_display %}
+{% block content %}
+<div class="page-header">
+ <h1>Route View</h1>
+</div>
<div class="row">
<div class="span3 well">
@@ -18,26 +21,25 @@
</div>
<div class="row">
-<p>The table below lists all ROAs which cover the route described above.
+ <p>The table below lists all ROAs which cover the route described above.
-<table class="table table-striped table-condensed">
- <tr>
- <th>Prefix</th>
- <th>Max Length</th>
- <th>ASN</th>
- <th>Expires</th>
- <th>URI</th>
- </tr>
- {% for pfx in roa_prefixes %}
- <tr>
- <td>{{ pfx.as_resource_range }}</td>
- <td>{{ pfx.max_length }}</td>
- <td>{{ pfx.roas.all.0.asid }}</td>
- <td>{{ pfx.roas.all.0.not_after }}</td>
- <td>{{ pfx.roas.all.0.repo.uri }}</td>
- </tr>
- {% endfor %}
-</table>
+ <table class="table table-striped table-condensed">
+ <tr>
+ <th>Prefix</th>
+ <th>Max Length</th>
+ <th>ASN</th>
+ <th>Expires</th>
+ <th>URI</th>
+ </tr>
+ {% for pfx in roa_prefixes %}
+ <tr>
+ <td>{{ pfx.as_resource_range }}</td>
+ <td>{{ pfx.max_length }}</td>
+ <td>{{ pfx.roas.all.0.asid }}</td>
+ <td>{{ pfx.roas.all.0.not_after }}</td>
+ <td>{{ pfx.roas.all.0.repo.uri }}</td>
+ </tr>
+ {% endfor %}
+ </table>
</div>
-
{% endblock %}
diff --git a/rpkid/rpki/gui/app/templatetags/app_extras.py b/rpkid/rpki/gui/app/templatetags/app_extras.py
index acb17e14..25de4467 100644
--- a/rpkid/rpki/gui/app/templatetags/app_extras.py
+++ b/rpkid/rpki/gui/app/templatetags/app_extras.py
@@ -5,9 +5,9 @@ register = template.Library()
@register.simple_tag
def verbose_name(obj):
"Return the model class' verbose name."
- return obj._meta.verbose_name
+ return obj._meta.verbose_name.capitalize()
@register.simple_tag
def verbose_name_plural(qs):
"Return the verbose name for the model class."
- return qs.model._meta.verbose_name_plural
+ return qs.model._meta.verbose_name_plural.capitalize()
diff --git a/rpkid/rpki/gui/app/views.py b/rpkid/rpki/gui/app/views.py
index 558fac1a..25540a81 100644
--- a/rpkid/rpki/gui/app/views.py
+++ b/rpkid/rpki/gui/app/views.py
@@ -142,7 +142,7 @@ def generic_import(request, queryset, configure, form_class=None,
return render(request, 'app/app_form.html', {
'form': form,
- 'form_title': 'Import ' + queryset.model._meta.verbose_name,
+ 'form_title': 'Import ' + queryset.model._meta.verbose_name.capitalize(),
})
@@ -325,7 +325,7 @@ def child_add_prefix(request, pk):
else:
form = forms.AddNetForm(child=child)
return render(request, 'app/app_form.html',
- {'object': child, 'form': form})
+ {'object': child, 'form': form, 'form_title': 'Add Prefix'})
@handle_required
@@ -344,7 +344,7 @@ def child_add_asn(request, pk):
else:
form = forms.AddASNForm(child=child)
return render(request, 'app/app_form.html',
- {'object': child, 'form': form})
+ {'object': child, 'form': form, 'form_title': 'Add ASN'})
@handle_required
@@ -594,7 +594,8 @@ def ghostbuster_create(request):
return http.HttpResponseRedirect(reverse(dashboard))
else:
form = forms.GhostbusterRequestForm(conf=conf)
- return render(request, 'app/app_form.html', {'form': form})
+ return render(request, 'app/app_form.html',
+ {'form': form, 'form_title': 'New Ghostbuster Request'})
@handle_required
@@ -611,7 +612,8 @@ def ghostbuster_edit(request, pk):
return http.HttpResponseRedirect(reverse(dashboard))
else:
form = forms.GhostbusterRequestForm(conf=conf, instance=obj)
- return render(request, 'app/app_form.html', {'form': form})
+ return render(request, 'app/app_form.html',
+ {'form': form, 'form_title': 'Edit Ghostbuster Request'})
@handle_required
@@ -740,8 +742,12 @@ def repository_delete(request, pk):
return http.HttpResponseRedirect(reverse(dashboard))
else:
form = forms.Empty()
- return render(request, 'app/repository_detail.html',
- {'object': obj, 'form': form, 'confirm_delete': True})
+ return render(request, 'app/object_confirm_delete.html', {
+ 'object': obj,
+ 'form': form,
+ 'parent_template':
+ 'app/repository_detail.html',
+ })
@handle_required