diff --git a/conntrackt/models.py b/conntrackt/models.py --- a/conntrackt/models.py +++ b/conntrackt/models.py @@ -1,9 +1,7 @@ -# Basic classes needed for creating models. +# Django-specific imports +from django.core.exceptions import ValidationError from django.db import models -# -from django.core.exceptions import ValidationError - # Create your models here. class Project(models.Model): """ diff --git a/conntrackt/templates/conntrackt/entity_detail.html b/conntrackt/templates/conntrackt/entity_detail.html --- a/conntrackt/templates/conntrackt/entity_detail.html +++ b/conntrackt/templates/conntrackt/entity_detail.html @@ -7,8 +7,8 @@ {% if entity %}

{{entity.name}}

-
Project
{% html_link 'project' project.name project.id %}
-
Location
{% html_link 'location' location.name location.id %}
+
Project
{% html_link project.name 'project' project.id %}
+
Location
{% html_link location.name 'location' location.id %}
Incoming communications
-
iptables rules
{% include "conntrackt/entity_iptables.html" with entity=entity %}
{% html_link 'entity_iptables' 'Download' entity.id "btn btn-primary" %}
+
iptables rules
{% include "conntrackt/entity_iptables.html" with entity=entity %}
{% html_link 'Download' 'entity_iptables' entity.id class="btn btn-primary" %}
{% endif %} {% endwith %} diff --git a/conntrackt/templates/conntrackt/html_link.html b/conntrackt/templates/conntrackt/html_link.html new file mode 100644 --- /dev/null +++ b/conntrackt/templates/conntrackt/html_link.html @@ -0,0 +1,2 @@ +{% load url from future %} +{{text}} diff --git a/conntrackt/templates/conntrackt/index.html b/conntrackt/templates/conntrackt/index.html --- a/conntrackt/templates/conntrackt/index.html +++ b/conntrackt/templates/conntrackt/index.html @@ -5,12 +5,16 @@ {% block content %}

Welcome to Conntrackt

Below you may find the list of projects that are available to you. Clicking on the project will take you to the summary page for that particular project.
+
{% if projects %} +
{% for project in projects %} - +
+
{% include "conntrackt/project_widget.html" %}
+
{% endfor %} +
{% endif %} + {% endblock %} diff --git a/conntrackt/templates/conntrackt/location_widget.html b/conntrackt/templates/conntrackt/location_widget.html new file mode 100644 --- /dev/null +++ b/conntrackt/templates/conntrackt/location_widget.html @@ -0,0 +1,8 @@ +{% load conntrackt %} + + +{% for entity in entities %} + +{% endfor %} +
{{location.name}}{% html_link '' 'project_location_iptables' project.id location.id class="btn btn-link" %}
{% html_link entity.name 'entity' entity.id class="btn btn-link" %}{% html_link '' 'entity_iptables' entity.id class="btn btn-link" %}
+ diff --git a/conntrackt/templates/conntrackt/project_detail.html b/conntrackt/templates/conntrackt/project_detail.html --- a/conntrackt/templates/conntrackt/project_detail.html +++ b/conntrackt/templates/conntrackt/project_detail.html @@ -6,27 +6,18 @@

{{project.name}}

{% if project.description %} -

Description

-{{project.description}} +
{{project.description}}
+
{% endif %} -{% if project.entity_set %} -

Project Entities

- - -{% for entity in project.entity_set.all %} - -{% endfor %} -
{% html_link 'entity' entity.name entity.id "btn btn-link" %}{% html_link 'entity_iptables' '' entity.id "btn btn-link" %}
- -

Project Locations

- - +{% if location_entities %} +
+ {% for location, entities in location_entities %} +
+
{% include "conntrackt/location_widget.html" with location=location entities=entities %}
+
+ {% endfor %} +
{% endif %} - {% endblock %} diff --git a/conntrackt/templates/conntrackt/project_widget.html b/conntrackt/templates/conntrackt/project_widget.html new file mode 100644 --- /dev/null +++ b/conntrackt/templates/conntrackt/project_widget.html @@ -0,0 +1,8 @@ +{% load conntrackt %} + + +{% for entity in project.entity_set.all %} + +{% endfor %} +
{% html_link project.name 'project' project.id class="btn btn-link" title=project.description %}{% html_link '' 'project_iptables' project.id class="btn btn-link" %}
{% html_link entity.name 'entity' entity.id class="btn btn-link" %}{% html_link '' 'entity_iptables' entity.id class="btn btn-link" %}
+ diff --git a/conntrackt/templates/conntrackt/template.html b/conntrackt/templates/conntrackt/template.html --- a/conntrackt/templates/conntrackt/template.html +++ b/conntrackt/templates/conntrackt/template.html @@ -26,7 +26,7 @@ - {% block header_title %}{% html_link 'index' 'Conntrackt' "" "brand" %}{% endblock %} + {% block header_title %}{% html_link 'Conntrackt' 'index' class="brand" %}{% endblock %}