[extensions-web] js: Fix the status display when toggling the active status on an extension
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [extensions-web] js: Fix the status display when toggling the active status on an extension
- Date: Thu, 1 Dec 2011 21:08:11 +0000 (UTC)
commit cc8088d1199dae9a7fcf9fd6ad4682008399865a
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Thu Dec 1 16:07:31 2011 -0500
js: Fix the status display when toggling the active status on an extension
.../templates/extensions/detail_edit.html | 4 ++--
.../templates/extensions/multiversion_status.html | 1 +
sweettooth/extensions/views.py | 7 ++++++-
sweettooth/static/js/main.js | 7 ++++---
4 files changed, 13 insertions(+), 6 deletions(-)
---
diff --git a/sweettooth/extensions/templates/extensions/detail_edit.html b/sweettooth/extensions/templates/extensions/detail_edit.html
index c98ee24..a4fb58a 100644
--- a/sweettooth/extensions/templates/extensions/detail_edit.html
+++ b/sweettooth/extensions/templates/extensions/detail_edit.html
@@ -61,8 +61,8 @@
{% for version in all_versions %}
<tr data-pk="{{ version.pk }}">
<td> <a href="{% url extensions-version-detail ext_pk=extension.pk slug=extension.slug pk=version.pk %}"> {{ version.version }} </a> </td>
- <td>
- <span class="{{ version.get_status_class }}">{{ version.get_status_display }}</span>
+ <td class="mvs">
+ {% include "extensions/multiversion_status.html" %}
</td>
<td>
{% for shell_version in version.shell_versions.all %}
diff --git a/sweettooth/extensions/templates/extensions/multiversion_status.html b/sweettooth/extensions/templates/extensions/multiversion_status.html
new file mode 100644
index 0000000..d5b90a3
--- /dev/null
+++ b/sweettooth/extensions/templates/extensions/multiversion_status.html
@@ -0,0 +1 @@
+<span class="{{ version.get_status_class }}">{{ version.get_status_display }}</span>
diff --git a/sweettooth/extensions/views.py b/sweettooth/extensions/views.py
index 4f06ea2..cccd50d 100644
--- a/sweettooth/extensions/views.py
+++ b/sweettooth/extensions/views.py
@@ -4,6 +4,7 @@ from django.contrib.auth.decorators import login_required
from django.contrib import messages
from django.http import HttpResponseForbidden, Http404
from django.shortcuts import get_object_or_404, redirect
+from django.template.loader import render_to_string
from django.utils import simplejson as json
from sorl.thumbnail.shortcuts import get_thumbnail
@@ -283,7 +284,11 @@ def ajax_set_status_view(request, newstatus):
version.status = newstatus
version.save()
- return build_shell_version_map(extension.visible_versions)
+ context = dict(version=version,
+ extension=extension)
+
+ return dict(svm=build_shell_version_map(extension.visible_versions),
+ mvs=render_to_string('extensions/multiversion_status.html', context))
@login_required
def upload_file(request, pk):
diff --git a/sweettooth/static/js/main.js b/sweettooth/static/js/main.js
index 1a81afe..4831fd0 100644
--- a/sweettooth/static/js/main.js
+++ b/sweettooth/static/js/main.js
@@ -105,7 +105,7 @@ require(['jquery', 'messages', 'extensions',
$('.extension_status_toggle a').click(function() {
var $link = $(this);
- var %tr = $link.parents('tr');
+ var $tr = $link.parents('tr');
var href = $link.attr('href');
var pk = $tr.data('pk');
var $ext = $link.parents('.extension');
@@ -117,9 +117,10 @@ require(['jquery', 'messages', 'extensions',
url: href
});
- req.done(function(newShellVersionMap) {
- $ext.data('svm', newShellVersionMap);
+ req.done(function(data) {
+ $ext.data('svm', data.svm);
$('#extension_shell_versions_info').buildShellVersionsInfo();
+ $tr.find('.mvs').html(data.mvs);
$tr.find('.extension_status_toggle').toggleClass('visible');
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]