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
 
@@ -39,6 +39,10 @@ parent div instead). */
 
}
 

	
 
/**
 
 * 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
 
@@ -4,12 +4,12 @@
 
{% 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>
 
@@ -39,13 +39,13 @@
 
            </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>
conntrackt/templates/conntrackt/create_form.html
Show inline comments
 
@@ -8,13 +8,13 @@
 
{% 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>
conntrackt/templates/conntrackt/delete_form.html
Show inline comments
 
@@ -8,23 +8,23 @@
 
{% 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>
conntrackt/templates/conntrackt/entity_detail.html
Show inline comments
 
@@ -6,32 +6,32 @@
 
{% 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">
 
@@ -88,13 +88,13 @@
 
      {% 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">
 
@@ -113,13 +113,13 @@
 
      {% 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">
conntrackt/templates/conntrackt/index.html
Show inline comments
 
@@ -10,22 +10,22 @@
 
</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">
conntrackt/templates/conntrackt/location_widget.html
Show inline comments
 
@@ -13,13 +13,13 @@
 
      <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
 
@@ -4,35 +4,35 @@
 
{% 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>
 
@@ -62,12 +62,12 @@
 
</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
 
@@ -9,42 +9,42 @@
 
    {% 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
 
@@ -8,13 +8,13 @@
 
{% 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>
conntrackt/views.py
Show inline comments
 
@@ -527,19 +527,19 @@ class EntityCreateView(RedirectToNextMix
 
        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
 
@@ -654,13 +654,13 @@ class InterfaceCreateView(RedirectToNext
 
        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
0 comments (0 inline, 0 general)