Changeset - d3db3c085912
[Not reviewed]
default
0 12 0
Branko Majic (branko) - 10 years ago 2013-11-10 14:22:44
branko@majic.rs
CONNT-24: Fix the ampersands in HTML (& instead of &). Fix the headers to be XHTML5-comliant. Make sure that all tags are closed (like input, hr etc). Use non-empty actions for forms. Replace invalid use of width attribute for img with CSS styling. Don't use readonly attribute for select fields. Set an empty label instead (one option in drop-box).
12 files changed with 38 insertions and 34 deletions:
0 comments (0 inline, 0 general)
conntrackt/static/custom.css
Show inline comments
 
@@ -33,12 +33,16 @@ parent div instead). */
 
}
 

	
 
/* Cut off long links/strings, using three periods at the end to mark it. */
 
#search-suggestions .dropdown-menu li a {
 
    text-overflow:ellipsis;
 
    overflow: hidden;
 
}
 

	
 
/**
 
 * END (search suggestions)
 
 */
 

	
 
/* Project diagram should have maximum width */
 
#project_diagram {
 
    width: 100%;
 
}
 
\ No newline at end of file
conntrackt/templates/admin/conntrackt/communication/change_list.html
Show inline comments
 
{% extends "admin/change_list.html" %}
 
{% load i18n admin_static admin_list %}
 
{% load url from future %}
 
{% load admin_urls %}
 

	
 
{% block object-tools-items %}
 
            <li>
 
              {# Add the GET parameters from the admin's filter to 'Add entity' button #}
 
              {# so we can perform some filtering on source/destination interfaces. #}
 
              <a href="{% url cl.opts|admin_urlname:'add' %}?{% if is_popup %}_popup=1{% endif %}{% if 'location' in cl.params %}&location={{ cl.params.location }}{% endif %}{% if 'project' in cl.params %}&project={{ cl.params.project }}{% endif %}" class="addlink">
 
              <a href="{% url cl.opts|admin_urlname:'add' %}?{% if is_popup %}_popup=1{% endif %}{% if 'location' in cl.params %}&amp;location={{ cl.params.location }}{% endif %}{% if 'project' in cl.params %}&amp;project={{ cl.params.project }}{% endif %}" class="addlink">
 
                {% blocktrans with cl.opts.verbose_name as name %}Add {{ name }}{% endblocktrans %}
 
              </a>
 
            </li>
 
{% endblock %}
 

	
conntrackt/templates/conntrackt/base.html
Show inline comments
 
{% load conntrackt_tags %}
 

	
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 
<!DOCTYPE html>
 
<html xmlns="http://www.w3.org/1999/xhtml">
 
  <head>
 
    <title>{% block title %}Conntrackt{% endblock %}</title>
 
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
 
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
 
    <meta charset="utf-8" />
 
    <link rel="stylesheet" type="text/css" href="/static/bootstrap/css/bootstrap.css" />
 
    <style>
 
    body {
 
      padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
 
    }
 
    </style>
 
    <link href="/static/bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
 
    <link href="/static/custom.css" rel="stylesheet">
 
    <link href="/static/bootstrap/css/bootstrap-responsive.css" rel="stylesheet" />
 
    <link href="/static/custom.css" rel="stylesheet" />
 
    <script>
 
    /* Set-up the base URL for sending out AJAX API calls. */
 
    var conntrackt_api_url = location.protocol + "//" + location.hostname + ":" + location.port + {% url "index" %} + "api";
 
    </script>
 
  </head>
 
  <body>
 

	
 
    <div class="navbar navbar-inverse navbar-fixed-top">
 
      <div class="navbar-inner">
 
        <div class="container">
 
          <button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
 
            <span class="icon-bar"></span>
 
@@ -33,25 +33,25 @@
 
          {% block header_title %}{% html_link 'Conntrackt' 'index' class="brand" %}{% endblock %}
 
          <div class="nav-collapse collapse">
 
              {% block header %}
 
            <ul class="nav">
 
              <li class="{% active_link 'index' %}"><a href="{% url "index" %}"><i class="icon-home icon-white"></i> Main Page</a></li>
 
              <li class="{% active_link 'admin' %}"><a href="{% url "admin:app_list" "conntrackt" %}"><i class="icon-wrench icon-white"></i> Administration</a></li>
 
            </ul>
 
            <ul class="nav pull-right">
 
              <li>
 
                <form action="{% url "search" %}" class="navbar-search pull-left" method="GET">
 
                  <div class="input-prepend">
 
                    <button type="submit" class="btn btn-link"><span class="icon-search icon-white"></span></button>
 
                    <input id="search" class="search-query" type="text" autocomplete="off" name="q"  placeholder="Search">
 
                    <input id="search" class="search-query" type="text" autocomplete="off" name="q"  placeholder="Search" />
 
                    <div id="search-suggestions" class="dropdown">
 
                      <ul class="dropdown-menu">
 
                      </ul>
 
                    </div>
 

	
 
                  </div>
 
                </form>
 
              </li>
 
              {% if user.is_anonymous %}
 
              <li>{% html_link '<i class="icon-user icon-white"></i> Log-in' 'login' get="next="|add:request.path %}</li>
 
              {% else %}
 
              <li><a href=""><i class="icon-user icon-white"></i> {{user}}</a></li>
conntrackt/templates/conntrackt/create_form.html
Show inline comments
 
@@ -2,24 +2,24 @@
 

	
 
{# For html_link #}
 
{% load conntrackt_tags %}
 
{# For Bootstrapped forms #}
 
{% load crispy_forms_tags %}
 

	
 
{% block content %}
 
<div class="row">
 
  <h1 class="span12">{{headline}}</h1>
 
</div>
 
<div class="row">
 
  <div class="span6">
 
    <form action="" method="post">
 
    <form action="#" method="post">
 
      <div class="controls controls-row">
 
      {% csrf_token %}
 
      {{ form | crispy }}
 
      </div>
 
      <div class="controls">
 
        <button type="submit" class="btn btn-primary">Add</button>
 
      </div>
 
    </form>
 
  </div>
 
</div>
 
{% endblock content %}
conntrackt/templates/conntrackt/delete_form.html
Show inline comments
 
@@ -2,30 +2,30 @@
 

	
 
{# For html_link #}
 
{% load conntrackt_tags %}
 
{# For Bootstrapped forms #}
 
{% load crispy_forms_tags %}
 

	
 
{% block content %}
 
<div class="row">
 
  <h1 class="span12">{{headline}}</h1>
 
</div>
 
<div class="row">
 
  <div class="span12">
 
    <form action="" method="post">
 
    <form action="#" method="post">
 
      <div class="controls controls-row">
 
        {% csrf_token %}
 
        {{ form }}
 
        The following entries will be removed:
 
        <ul>
 
          {{ related_items|unordered_list }}
 
        </ul>
 
        Are you sure you want to remove them?
 
      </div>
 
      <hr>
 
      <hr />
 
      <div class="controls">
 
        <button type="submit" class="btn btn-primary">Remove</button>
 
      </div>
 
    </form>
 
  </div>
 
</div>
 
{% endblock content %}
conntrackt/templates/conntrackt/entity_detail.html
Show inline comments
 
{% extends "conntrackt/base.html" %}
 

	
 
{# For html_link. #}
 
{% load conntrackt_tags %}
 

	
 
{% block content %}
 

	
 
{% if entity %}
 
<div class="row">
 
  <h1 class="span12">{{entity.name}}</h1>
 
</div>
 
<hr>
 
<hr />
 

	
 
{% if entity.description %}
 
<div class="row">
 
  <div class="span12">
 
    {{entity.description}}
 
  </div>
 
</div>
 
<hr>
 
<hr />
 
{% endif %}
 

	
 
<div class="row">
 
  <div class="span12">
 
    {% html_link "Edit" "entity_update" entity.id class="btn btn-primary" %}
 
    {% html_link "Remove" "entity_delete" entity.id class="btn btn-primary" %}
 
    {% html_link "Get Iptables" 'entity_iptables' entity.id class="btn btn-primary" %}
 
  </div>
 
</div>
 

	
 
<hr>
 
<hr />
 

	
 
<div class="row">
 

	
 
  <div class="span6">
 
    <h2>General information</h2>
 
    <div class="well">
 
      <table class="table table-striped">
 
        <tr>
 
          <th>Project</th><td style="width:99%">{% html_link project.name 'project'  project.id  %}</td>
 
        </tr>
 
        <tr>
 
          <th>Location</th><td>{{location}}</td>
 
@@ -82,50 +82,50 @@
 
          <td style="width:99%">{% html_link comm.source_representation "entity" comm.source.entity.id class="btn btn-link" %}</td>
 
          <td>{% html_link '<i class="icon-edit"></i>' 'communication_update' comm.id class="btn btn-link"  %}</td>
 
          <td>{% html_link '<i class="icon-remove"></i>' 'communication_delete' comm.id class="btn btn-link"  %}</td>
 
        </tr>
 
        {% endfor %}
 
      </table>
 
      {% else %}
 
      <p>No incoming communications towards this entity.</p>
 
      {% endif %}
 
      <div>
 
        {% with entity_id=entity.id|slugify %}
 
        {% url "entity" entity.id as next %}
 
        {% html_link "Add communication" "communication_create" class="btn btn-primary btn-mini" get="to_entity="|add:entity_id|add:"&next="|add:next %}
 
        {% html_link "Add communication" "communication_create" class="btn btn-primary btn-mini" get="to_entity="|add:entity_id|add:"&amp;next="|add:next %}
 
        {% endwith %}
 
      </div>
 
    </div>
 
  </div>
 

	
 
  <div class="span6">
 
    <h2>Outgoing communications</h2>
 
    <div class="well">
 
      {% if outgoing_communications %}
 
      <table class="table table-striped">
 
        {% for comm in outgoing_communications %}
 
        <tr>
 
          <td style="width:99%">{% html_link comm.destination_representation "entity" comm.destination.entity.id class="btn btn-link" %}</td>
 
          <td>{% html_link '<i class="icon-edit"></i>' 'communication_update' comm.id class="btn btn-link"  %}</td>
 
          <td>{% html_link '<i class="icon-remove"></i>' 'communication_delete' comm.id class="btn btn-link"  %}</td>
 
        </tr>
 
        {% endfor %}
 
      </table>
 
      {% else %}
 
      <p>No outgoing communications from this entity.</p>
 
      {% endif %}
 
      <div>
 
        {% with entity_id=entity.id|slugify %}
 
        {% url "entity" entity.id as next %}
 
        {% html_link "Add communication" "communication_create" class="btn btn-primary btn-mini" get="from_entity="|add:entity_id|add:"&next="|add:next %}
 
        {% html_link "Add communication" "communication_create" class="btn btn-primary btn-mini" get="from_entity="|add:entity_id|add:"&amp;next="|add:next %}
 
        {% endwith %}
 
      </div>
 
    </div>
 
  </div>
 

	
 
  <div class="span12">
 
    <h2>Iptables rules</h2>
 
    <div class="well">
 
      <pre>{{ entity_iptables }}</pre>
 
      <div>
 
        {% html_link "Download" 'entity_iptables' entity.id class="btn btn-primary" %}
 
      </div>
conntrackt/templates/conntrackt/index.html
Show inline comments
 
@@ -4,34 +4,34 @@
 
{% load conntrackt_tags %}
 

	
 
{% block content %}
 

	
 
<div class="row">
 
  <h1 class="span12">Welcome to Conntrackt</h1>
 
</div>
 

	
 
<div class="row">
 
    <div class="span12">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. Clicking on an entity inside of a project will take you to the summary page of an entity.</div>
 
</div>
 

	
 
<hr>
 
<hr />
 

	
 
<div class="row">
 
  <div class="span12">
 
    {% html_link "Add project" "project_create" class="btn btn-primary" %}
 
    {% html_link "Add location" "location_create" class="btn btn-primary" %}
 
  </div>
 
</div>
 

	
 
<hr>
 
<hr />
 

	
 
<div class="row">
 

	
 
  <div class="span6">
 
    <h2>Projects</h2>
 
    <div class="well">
 
      {% if projects %}
 
        <table class="table table-striped">
 
          {% for project in projects %}
 
            <tr>
 
              <td style="width:99%">{% html_link project.name "project" project.id class="btn btn-link" %}</td>
 
              <td>{% html_link '<i class="icon-book"></i>' "project_iptables" project.id class="btn btn-link" %}</td>
conntrackt/templates/conntrackt/location_widget.html
Show inline comments
 
@@ -7,20 +7,20 @@
 
      <td></td>
 
    </tr>
 
{% for entity in entities %}
 
    <tr>
 
      <td>{% html_link entity.name 'entity' entity.id class="btn btn-link" %}</td>
 
      <td>{% html_link '<i class="icon-list"></i>' 'entity_iptables' entity.id class="btn btn-link" %}</td>
 
      <td>{% html_link '<i class="icon-edit"></i>' 'entity_update' entity.id class="btn btn-link" get="next="|add:request.path %}</td>
 
      <td>{% html_link '<i class="icon-remove"></i>' 'entity_delete' entity.id class="btn btn-link" get="next="|add:request.path %}</td>
 
    </tr>
 
{% endfor %}
 
    {% with project_id=project.id|slugify location_id=location.id|slugify %}
 
    <tr>
 
      <td>{% html_link "Add entity" "entity_create" class="btn btn-primary btn-mini" get="project="|add:project_id|add:"&location="|add:location_id|add:"&next="|add:request.path %}</td>
 
      <td>{% html_link "Add entity" "entity_create" class="btn btn-primary btn-mini" get="project="|add:project_id|add:"&amp;location="|add:location_id|add:"&amp;next="|add:request.path %}</td>
 
      <td></td>
 
      <td></td>
 
      <td></td>
 
    </tr>
 
    {% endwith %}
 
  </table>
 

	
conntrackt/templates/conntrackt/project_detail.html
Show inline comments
 
{% extends "conntrackt/base.html" %}
 

	
 
{# For html_link #}
 
{% load conntrackt_tags %}
 

	
 
{% block content %}
 
<div class="row">
 
  <h1 class="span12">{{project.name}}</h1>
 
</div>
 
<hr>
 
<hr />
 

	
 
{% if project.description %}
 
<div class="row">
 
  <div class="span12">
 
    {{project.description}}
 
  </div>
 
</div>
 
<hr>
 
<hr />
 
{% endif %}
 

	
 
<div class="row">
 
  <div class="span12">
 
    {% html_link "Edit" "project_update" project.id class="btn btn-primary" %}
 
    {% html_link "Remove" "project_delete" project.id class="btn btn-primary" %}
 
    {% with project_id=project.id|slugify %}
 
    {% html_link "Add entity" "entity_create" class="btn btn-primary" get="project="|add:project_id|add:"&next="|add:request.path %}
 
    {% html_link "Add communication" "communication_create" class="btn btn-primary" get="project="|add:project_id|add:"&next="|add:request.path %}
 
    {% html_link "Add entity" "entity_create" class="btn btn-primary" get="project="|add:project_id|add:"&amp;next="|add:request.path %}
 
    {% html_link "Add communication" "communication_create" class="btn btn-primary" get="project="|add:project_id|add:"&amp;next="|add:request.path %}
 
    {% endwith %}
 
    {% html_link "Get Iptables" 'project_iptables' project.id class="btn btn-primary" %}
 
  </div>
 
</div>
 
<hr>
 
<hr />
 
{% if location_entities %}
 
<div class="row">
 
  {% for location, entities in location_entities %}
 
  <div class="span4">
 
    <div class="well">{% include "conntrackt/location_widget.html" with location=location entities=entities %}</div>
 
  </div>
 
  {% endfor %}
 
</div>
 

	
 
{% if communications %}
 
<div class="row">
 
  <div class="span12">
 
@@ -56,18 +56,18 @@
 
          <td>{{ communication.port }}</td>
 
        </tr>
 
      {% endfor %}
 
      </tbody>
 
    </table>
 
  </div>
 
</div>
 
{% endif %}
 

	
 
<div class="row">
 
  <div class="span12">
 
    <h2>Communications diagram</h2>
 
    <img src="{% url "project_diagram" project.id %}" width="100%">
 
    <img id="project_diagram" src="{% url "project_diagram" project.id %}" alt="communications diagram" />
 
  </div>
 
</div>
 
{% endif %}
 
{% endblock %}
 

	
conntrackt/templates/conntrackt/search.html
Show inline comments
 
@@ -3,48 +3,48 @@
 
{% block content %}
 

	
 
<div class="row">
 
  <div class="span12">
 
    {% if search_term %}
 
      <h1>Search results for: <strong>{{ search_term }}</strong></h1>
 
    {% else %}
 
      <h1>Search</h1>
 
    {% endif %}
 
  </div>
 

	
 
  <div class="span12">
 
    <hr>
 
    <hr />
 
    <form action="{% url "search" %}" class="form-search" method="GET">
 
      <input class="search-query" type="text" name="q"  placeholder="Search" value="{{ search_term }}"/>
 
      <button type="submit" class="btn"><span class="icon-search"></span> Search</button>
 
    </form>
 
    <hr>
 
    <hr />
 

	
 
    {% if projects %}
 
      <h2><small>Matched projects</small></h2>
 
      <ul class="unstyled">
 
        {% for project in projects %}
 
          <li><a href="{{ project.get_absolute_url }}">{{ project.name }}</a></li>
 
        {% endfor %}
 
      </ul>
 
      <hr>
 
      <hr />
 
    {% elif search_term %}
 
      <p>There are no projects matching your query.</p>
 
      <hr>
 
      <hr />
 
    {% endif %}
 

	
 
    {% if entities %}
 
      <h2><small>Matched Entities</small></h2>
 
      <ul class="unstyled">
 
        {% for entity in entities %}
 
          <li><a href="{{ entity.get_absolute_url }}">{{ entity.name }}</a> (from {{ entity.project.name }})</li>
 
        {% endfor %}
 
      </ul>
 
      <hr>
 
      <hr />
 
    {% elif search_term %}
 
      <p>There are no entities matching your query.</p>
 
      <hr>
 
      <hr />
 
    {% endif %}
 

	
 
  </div>
 
</div>
 
{% endblock content %}
conntrackt/templates/conntrackt/update_form.html
Show inline comments
 
@@ -2,24 +2,24 @@
 

	
 
{# For html_link #}
 
{% load conntrackt_tags %}
 
{# For Bootstrapped forms #}
 
{% load crispy_forms_tags %}
 

	
 
{% block content %}
 
<div class="row">
 
  <h1 class="span12">{{headline}}</h1>
 
</div>
 
<div class="row">
 
  <div class="span6">
 
    <form action="" method="post">
 
    <form action="#" method="post">
 
      <div class="controls controls-row">
 
      {% csrf_token %}
 
      {{ form | crispy }}
 
      </div>
 
      <div class="controls">
 
        <button type="submit" class="btn btn-primary">Update</button>
 
      </div>
 
    </form>
 
  </div>
 
</div>
 
{% endblock content %}
conntrackt/views.py
Show inline comments
 
@@ -521,31 +521,31 @@ class EntityCreateView(RedirectToNextMix
 
        Returns an instance of form that can be used by the view.
 

	
 
        The method will limit the project or location select inputs if request
 
        contained this information.
 
        """
 

	
 
        form = super(EntityCreateView, self).get_form(form_class)
 

	
 
        # Limit the project selection if required.
 
        project_id = self.request.GET.get("project", None)
 
        if project_id:
 
            form.fields["project"].queryset = Project.objects.filter(pk=project_id)
 
            form.fields["project"].widget.attrs["readonly"] = True
 
            form.fields["project"].empty_label = None
 

	
 
        # Limit the location selection if required.
 
        location_id = self.request.GET.get("location", None)
 
        if location_id:
 
            form.fields["location"].queryset = Location.objects.filter(pk=location_id)
 
            form.fields["location"].widget.attrs["readonly"] = True
 
            form.fields["location"].empty_label = None
 

	
 
        return form
 

	
 
    def get_initial(self):
 
        """
 
        Returns initial values that should be pre-selected (if they were
 
        specified through a GET parameter).
 
        """
 

	
 
        initial = super(EntityCreateView, self).get_initial()
 

	
 
        initial["project"] = self.request.GET.get("project", None)
 
@@ -648,25 +648,25 @@ class InterfaceCreateView(RedirectToNext
 
        Returns an instance of form that can be used by the view.
 

	
 
        The method will limit the entity select input if request contained this
 
        information.
 
        """
 

	
 
        form = super(InterfaceCreateView, self).get_form(form_class)
 

	
 
        # Limit the entity selection if required.
 
        entity_id = self.request.GET.get("entity", None)
 
        if entity_id:
 
            form.fields["entity"].queryset = Entity.objects.filter(pk=entity_id)
 
            form.fields["entity"].widget.attrs["readonly"] = True
 
            form.fields["entity"].empty_label = False
 

	
 
        return form
 

	
 
    def get_initial(self):
 
        """
 
        Returns initial values that should be pre-selected (if they were
 
        specified through a GET parameter).
 
        """
 

	
 
        initial = super(InterfaceCreateView, self).get_initial()
 

	
 
        initial["entity"] = self.request.GET.get("entity", None)
0 comments (0 inline, 0 general)