[extensions-web] Make undo work with multiple versions
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [extensions-web] Make undo work with multiple versions
- Date: Fri, 25 Nov 2011 01:11:57 +0000 (UTC)
commit d6e67956d54d1bd1f84c74e6dc9f1f2f3f3c4369
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Thu Nov 24 00:01:37 2011 -0500
Make undo work with multiple versions
We accidentally re-installed the version with the PK of the extension. We
probably haven't noticed this before because the version and extension PKs
have been the same
sweettooth/extensions/views.py | 12 +++++++++---
sweettooth/static/js/extensions.js | 3 ++-
2 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/sweettooth/extensions/views.py b/sweettooth/extensions/views.py
index 6bcda27..a3e70ad 100644
--- a/sweettooth/extensions/views.py
+++ b/sweettooth/extensions/views.py
@@ -204,8 +204,7 @@ def ajax_upload_icon_view(request, obj):
return obj.icon.url
def ajax_details(extension):
- return dict(pk = extension.pk,
- uuid = extension.uuid,
+ return dict(uuid = extension.uuid,
name = extension.name,
creator = extension.creator.username,
link = reverse('extensions-detail', kwargs=dict(pk=extension.pk)),
@@ -214,12 +213,19 @@ def ajax_details(extension):
@ajax_view
def ajax_details_view(request):
uuid = request.GET.get('uuid', None)
+ version_tag = request.GET.get('version_tag', None)
if uuid is None:
raise Http404()
extension = get_object_or_404(models.Extension, uuid=uuid)
- return ajax_details(extension)
+ details = ajax_details(extension)
+
+ if version_tag is not None:
+ version = extension.versions.get(version=version_tag)
+ details['pk'] = version.pk
+
+ return details
@ajax_view
def ajax_query_view(request):
diff --git a/sweettooth/static/js/extensions.js b/sweettooth/static/js/extensions.js
index 836960b..ae14d4e 100644
--- a/sweettooth/static/js/extensions.js
+++ b/sweettooth/static/js/extensions.js
@@ -201,7 +201,8 @@ function($, messages, dbusProxy) {
$.ajax({
url: "/ajax/detail/",
dataType: "json",
- data: { uuid: uuid },
+ data: { uuid: extension.version,
+ version_tag: extension.version_tag },
type: "GET",
}).done(function(result) {
$elem.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]