summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/patchwork/forms.py5
-rw-r--r--apps/patchwork/urls.py2
-rw-r--r--apps/patchwork/views/bundle.py25
-rw-r--r--htdocs/css/style.css35
-rw-r--r--htdocs/images/16-em-cross.pngbin0 -> 469 bytes
-rw-r--r--htdocs/images/16-em-down.pngbin0 -> 400 bytes
-rw-r--r--htdocs/js/confirm.js5
-rw-r--r--templates/base.html9
-rw-r--r--templates/patchwork/bundles.html62
-rw-r--r--templates/patchwork/profile.html71
10 files changed, 177 insertions, 37 deletions
diff --git a/apps/patchwork/forms.py b/apps/patchwork/forms.py
index bc746bd..dc30299 100644
--- a/apps/patchwork/forms.py
+++ b/apps/patchwork/forms.py
@@ -80,6 +80,11 @@ class CreateBundleForm(forms.ModelForm):
% name)
return name
+class DeleteBundleForm(forms.Form):
+ name = 'deletebundleform'
+ form_name = forms.CharField(initial = name, widget = forms.HiddenInput)
+ bundle_id = forms.IntegerField(widget = forms.HiddenInput)
+
class DelegateField(forms.ModelChoiceField):
def __init__(self, project, *args, **kwargs):
queryset = User.objects.filter(userprofile__in = \
diff --git a/apps/patchwork/urls.py b/apps/patchwork/urls.py
index c969b29..4352db0 100644
--- a/apps/patchwork/urls.py
+++ b/apps/patchwork/urls.py
@@ -36,6 +36,8 @@ urlpatterns = patterns('',
(r'^user/todo/$', 'patchwork.views.user.todo_lists'),
(r'^user/todo/(?P<project_id>[^/]+)/$', 'patchwork.views.user.todo_list'),
+ (r'^user/bundles/$',
+ 'patchwork.views.bundle.bundles'),
(r'^user/bundle/(?P<bundle_id>[^/]+)/$',
'patchwork.views.bundle.bundle'),
(r'^user/bundle/(?P<bundle_id>[^/]+)/mbox/$',
diff --git a/apps/patchwork/views/bundle.py b/apps/patchwork/views/bundle.py
index d8c868e..5f990c4 100644
--- a/apps/patchwork/views/bundle.py
+++ b/apps/patchwork/views/bundle.py
@@ -25,7 +25,7 @@ from django.http import HttpResponse, HttpResponseRedirect
import django.core.urlresolvers
from patchwork.models import Patch, Bundle, Project
from patchwork.utils import get_patch_ids
-from patchwork.forms import BundleForm
+from patchwork.forms import BundleForm, DeleteBundleForm
from patchwork.views import generic_list
from patchwork.filters import DelegateFilter
from patchwork.paginator import Paginator
@@ -101,6 +101,29 @@ def setbundle(request):
)
@login_required
+def bundles(request):
+ context = PatchworkRequestContext(request)
+
+ if request.method == 'POST':
+ form_name = request.POST.get('form_name', '')
+
+ if form_name == DeleteBundleForm.name:
+ form = DeleteBundleForm(request.POST)
+ if form.is_valid():
+ bundle = get_object_or_404(Bundle,
+ id = form.cleaned_data['bundle_id'])
+ bundle.delete()
+
+ bundles = Bundle.objects.filter(owner = request.user)
+ for bundle in bundles:
+ bundle.delete_form = DeleteBundleForm(auto_id = False,
+ initial = {'bundle_id': bundle.id})
+
+ context['bundles'] = bundles
+
+ return render_to_response('patchwork/bundles.html', context)
+
+@login_required
def bundle(request, bundle_id):
bundle = get_object_or_404(Bundle, id = bundle_id)
filter_settings = [(DelegateFilter, DelegateFilter.AnyDelegate)]
diff --git a/htdocs/css/style.css b/htdocs/css/style.css
index bef9605..a05e877 100644
--- a/htdocs/css/style.css
+++ b/htdocs/css/style.css
@@ -267,6 +267,10 @@ span.p_mod { color: #0000ff; }
/* bundles */
table.bundlelist {
+ margin-top: 2em;
+ margin-bottom: 4em;
+ margin-left: auto;
+ margin-right: auto;
border: thin solid black;
}
@@ -400,3 +404,34 @@ table.vertical th, table.vertical td {
td.numberformat {
text-align: right;
}
+
+/* boxes */
+div.box {
+ border: thin solid gray;
+ margin: 1em;
+ padding: 0.5em;
+}
+
+div.box h2 {
+ background: #786fb4;
+ color: white;
+ margin: -0.5em -0.5em 1em; -0.5em;
+ padding: 0em 0.5em;
+ font-size: 100%;
+}
+
+div.box table.vertical {
+ margin-left: auto;
+ margin-right: auto;
+}
+
+/* columns */
+.leftcol {
+ float: left;
+ width: 49%;
+}
+
+.rightcol {
+ float: right;
+ width: 49%;
+}
diff --git a/htdocs/images/16-em-cross.png b/htdocs/images/16-em-cross.png
new file mode 100644
index 0000000..466e3bb
--- /dev/null
+++ b/htdocs/images/16-em-cross.png
Binary files differ
diff --git a/htdocs/images/16-em-down.png b/htdocs/images/16-em-down.png
new file mode 100644
index 0000000..50ac318
--- /dev/null
+++ b/htdocs/images/16-em-down.png
Binary files differ
diff --git a/htdocs/js/confirm.js b/htdocs/js/confirm.js
new file mode 100644
index 0000000..cbc91b3
--- /dev/null
+++ b/htdocs/js/confirm.js
@@ -0,0 +1,5 @@
+function confirm_delete(type, name)
+{
+ return confirm("Are you sure you want to delete the " + type +
+ " '" + name + "'?");
+}
diff --git a/templates/base.html b/templates/base.html
index b9b359f..896b939 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -21,11 +21,12 @@
<a href="{% url patchwork.views.user.profile %}"
><strong>{{ user.username }}</strong></a>
<br/>
- <a href="{% url patchwork.views.user.profile %}">profile</a> ::
<a href="{% url patchwork.views.user.todo_lists %}">todo
- ({{ user.get_profile.n_todo_patches }})</a><br/>
- <a href="{% url auth_logout %}">logout</a> ::
- <a href="{% url patchwork.views.help path="about/" %}">about</a>
+ ({{ user.get_profile.n_todo_patches }})</a> ::
+ <a href="{% url patchwork.views.bundle.bundles %}">bundles</a>
+ <br/>
+ <a href="{% url patchwork.views.user.profile %}">profile</a> ::
+ <a href="{% url auth_logout %}">logout</a>
{% else %}
<a href="{% url auth_login %}">login</a>
<br/>
diff --git a/templates/patchwork/bundles.html b/templates/patchwork/bundles.html
new file mode 100644
index 0000000..7f87f6f
--- /dev/null
+++ b/templates/patchwork/bundles.html
@@ -0,0 +1,62 @@
+{% extends "base.html" %}
+
+{% block title %}Bundles{% endblock %}
+{% block heading %}Bundles{% endblock %}
+
+{% block headers %}
+ <script language="JavaScript" type="text/javascript" src="/js/confirm.js">
+ </script>
+{% endblock %}
+
+{% block body %}
+
+{% if bundles %}
+<table class="bundlelist">
+ <tr>
+ <th>Name</th>
+ <th>Project</th>
+ <th>Public Link</th>
+ <th>Patches</td>
+ <th>Download</th>
+ <th>Delete</th>
+ </tr>
+{% for bundle in bundles %}
+ <tr>
+ <td><a href="{% url patchwork.views.bundle.bundle bundle_id=bundle.id %}"
+ >{{ bundle.name }}</a></td>
+ <td>{{ bundle.project.linkname }}</td>
+ <td>
+ {% if bundle.public %}
+ <a href="{{ bundle.public_url }}">{{ bundle.public_url }}</a>
+ {% endif %}
+ </td>
+ <td style="text-align: right">{{ bundle.n_patches }}</td>
+ <td style="text-align: center;"><a
+ href="{% url patchwork.views.bundle.mbox bundle_id=bundle.id %}"
+ ><img src="/images/16-em-down.png" width="16" height="16" alt="download"
+ title="download"/></a></td>
+ <td style="text-align: center;">
+ <form method="post"
+ onsubmit="return confirm_delete('bundle', '{{bundle.name|escapejs}}');">
+ {{ bundle.delete_form.as_p }}
+ <input type="image"
+ src="/images/16-em-cross.png" width="16" height="16" alt="delete"
+ title="delete" border="0" style="border: none;"/>
+ </form>
+ </td>
+
+ </tr>
+{% endfor %}
+</table>
+{% endif %}
+
+<p>Bundles are groups of related patches. You can create bundles by
+selecting patches from a project, then using the 'create bundle' form
+to give your bundle a name. Each bundle can be public or private; public
+bundles are given a persistent URL, based you your username and the name
+of the bundle. Private bundles are only visible to you.</p>
+
+{% if not bundles %}
+<p>You have no bundles.</p>
+{% endif %}
+{% endblock %}
diff --git a/templates/patchwork/profile.html b/templates/patchwork/profile.html
index 81005a3..c204183 100644
--- a/templates/patchwork/profile.html
+++ b/templates/patchwork/profile.html
@@ -22,42 +22,20 @@ Contributor to
{% endif %}
</p>
-<h2>Todo</h2>
+<div class="leftcol">
+<div class="box">
+ <h2>Todo</h2>
{% if user.get_profile.n_todo_patches %}
-<p>Your <a href="{% url patchwork.views.user.todo_lists %}">todo
-list</a> contains {{ user.get_profile.n_todo_patches }}
-patch{{ user.get_profile.n_todo_patches|pluralize:"es" }}.</p>
+ <p>Your <a href="{% url patchwork.views.user.todo_lists %}">todo
+ list</a> contains {{ user.get_profile.n_todo_patches }}
+ patch{{ user.get_profile.n_todo_patches|pluralize:"es" }}.</p>
{% else %}
-<p>Your todo list contains patches that have been delegated to you. You
-have no items in your todo list at present.</p>
-{% endif %}
-<h2>Bundles</h2>
-
-{% if bundles %}
-<table class="bundlelist">
- <tr>
- <th>Bundle name</th>
- <th>Patches</td>
- <th>Public Link</th>
- </tr>
-{% for bundle in bundles %}
- <tr>
- <td><a href="{% url patchwork.views.bundle.bundle bundle_id=bundle.id %}"
- >{{ bundle.name }}</a></td>
- <td style="text-align: right">{{ bundle.n_patches }}</td>
- <td>
- {% if bundle.public %}
- <a href="{{ bundle.public_url }}">{{ bundle.public_url }}</a>
- {% endif %}
- </td>
- </tr>
-{% endfor %}
-</table>
-{% else %}
-<p>no bundles</p>
+ <p>Your todo list contains patches that have been delegated to you. You
+ have no items in your todo list at present.</p>
{% endif %}
+</div>
-
+<div class="box">
<h2>Linked email addresses</h2>
<p>The following email addresses are associated with this patchwork account.
Adding alternative addresses allows patchwork to group contributions that
@@ -96,7 +74,31 @@ address.</p>
</td>
</tr>
</table>
+</div>
+</div>
+
+<div class="rightcol">
+
+<div class="box">
+<h2>Bundles</h2>
+{% if bundles %}
+<p>You have the following bundle{{ bundle|length|pluralize }}:</p>
+<ul>
+{% for bundle in bundles %}
+ <li><a href="{% url patchwork.views.bundle.bundle bundle_id=bundle.id %}"
+ >{{ bundle.name }}</a></li>
+{% endfor %}
+</ul>
+<p>Visit the <a href="{%url patchwork.views.bundle.bundles %}">bundles
+ page</a> to manage your bundles.</p>
+{% else %}
+<p>You have no bundles.</p>
+{% endif %}
+</div>
+
+
+<div class="box">
<h2>Settings</h2>
<form method="post">
@@ -110,5 +112,10 @@ address.</p>
</tr>
</table>
</form>
+</div>
+
+</div>
+
+<p style="clear: both"></p>
{% endblock %}