tahoe: Minor changes to facilitate functional tests

- Change the base URL of the app so that functional tests can guess the URLs.

- Assign classes to generate HTML elements.

- Indentation.

- Normalize URLs to have '/' at the end as per Django convention.

Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Joseph Nuthalapati 2018-10-29 18:54:27 -07:00 committed by James Valleroy
parent 97f69eb3ee
commit 09a3d57bfd
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808
3 changed files with 54 additions and 55 deletions

View File

@ -42,7 +42,7 @@
{% block configuration %}
<h3>{% trans "Configuration" %}</h3>
<form class="form" method="post">
<form class="form form-configuration" method="post">
{% csrf_token %}
{{ form|bootstrap }}
@ -53,58 +53,61 @@
<br/>
<h4>{% trans "Local introducer" %}</h4>
<table class="table table-bordered">
<thead>
<tr>
<th>{% trans "Pet Name" %}</th>
<th> furl </th>
</tr>
</thead>
<table class="table table-bordered local-introducers">
<thead>
<tr>
<td> {{ local_introducer.0 }} </td>
<td> {{ local_introducer.1 }} </td>
<th>{% trans "Pet Name" %}</th>
<th> furl </th>
</tr>
</thead>
<tr>
<td class="introducer-pet-name">{{ local_introducer.0 }}</td>
<td class="introducer-furl">{{ local_introducer.1 }}</td>
</tr>
</table>
<form class="form" method="post" action="{% url 'tahoe:add-introducer' %}">
{% csrf_token %}
<h4>{% trans "Add new introducer" %}</h4>
<form class="form form-add-introducer" method="post"
action="{% url 'tahoe:add-introducer' %}">
{% csrf_token %}
<h4>{% trans "Add new introducer" %}</h4>
<div class="form-group">
<label>{% trans "Pet Name" %}:</label>
<input type="text" class="form-control" name="pet_name">
</div>
<div class="form-group">
<label>furl:</label>
<textarea class="form-control" rows="5" name="furl"></textarea>
</div>
<input type="submit" class="btn btn-primary"
value="{% trans "Add" %}"/>
<div class="form-group">
<label>{% trans "Pet Name" %}:</label>
<input type="text" class="form-control" name="pet_name">
</div>
<div class="form-group">
<label>furl:</label>
<textarea class="form-control" rows="5" name="furl"></textarea>
</div>
<input type="submit" class="btn btn-primary"
value="{% trans "Add" %}"/>
</form>
<br/>
<h4>{% trans "Connected introducers" %}</h4>
<table class="table table-bordered">
<thead>
<tr>
<th>{% trans "Pet Name" %}</th>
<th> furl </th>
</tr>
</thead>
{% for introducer, furl in introducers %}
<h4>{% trans "Connected introducers" %}</h4>
<table class="table table-bordered connected-introducers">
<thead>
<tr>
<td> {{ introducer }} </td>
<td> {{ furl }} </td>
<form class="form" method="post"
action="{% url 'tahoe:remove-introducer' introducer %}" id="introducer_list">
{% csrf_token %}
<td><button type="submit" class="btn btn-danger">
{% trans "Remove" %}
</button></td>
</form>
<th>{% trans "Pet Name" %}</th>
<th> furl </th>
</tr>
{% endfor %}
</thead>
{% for introducer, furl in introducers %}
<tr>
<td class="introducer-pet-name">{{ introducer }}</td>
<td class="introducer-furl">{{ furl }}</td>
<td class="introducer-operations">
<form class="form form-remove" method="post"
action="{% url 'tahoe:remove-introducer' introducer %}">
{% csrf_token %}
<button type="submit" class="btn btn-danger">
{% trans "Remove" %}
</button>
</form>
</td>
</tr>
{% endfor %}
</table>
{% endblock %}

View File

@ -49,7 +49,7 @@
{% block configuration %}
{% if domain_names|length > 0 %}
<h3>{% trans Configuration %}</h3>
<form class="form" method="post">
<form class="form form-configuration" method="post">
{% csrf_token %}
{{ form|bootstrap }}

View File

@ -18,20 +18,16 @@
URLs for the Tahoe-LAFS module.
"""
from . import views
from django.conf.urls import url
from .views import TahoeSetupView, TahoeServiceView
from . import views
from .views import TahoeServiceView, TahoeSetupView
urlpatterns = [
url(r'^apps/tahoe-lafs/setup$', TahoeSetupView.as_view(),
name='setup'),
url(r'^apps/tahoe-lafs/add_introducer$', views.add_introducer,
name="add-introducer"),
url(r'^apps/tahoe-lafs/remove_introducer/(?P<introducer>[0-9a-zA-Z_]+)$',
views.remove_introducer, name="remove-introducer"),
url(r'^apps/tahoe-lafs/$', TahoeServiceView.as_view(),
name='index')
url(r'^apps/tahoe/setup/$', TahoeSetupView.as_view(), name='setup'),
url(r'^apps/tahoe/add_introducer/$', views.add_introducer,
name='add-introducer'),
url(r'^apps/tahoe/remove_introducer/(?P<introducer>[0-9a-zA-Z_]+)/$',
views.remove_introducer, name='remove-introducer'),
url(r'^apps/tahoe/$', TahoeServiceView.as_view(), name='index')
]