Permalink
Browse files

added feedback during package update

eventually I imagine this should use the celery
backend, but for now this was a fun and easy
side trip
  • Loading branch information...
1 parent 8d2ec71 commit 9a29fb4318519313b0a2475e09568a21eba94dbc @ptone ptone committed Mar 16, 2011
Showing with 16 additions and 4 deletions.
  1. +4 −2 apps/package/views.py
  2. BIN media/img/progress.gif
  3. +12 −2 templates/package/package.html
View
@@ -2,10 +2,11 @@
import simplejson
import urllib
+from django.conf import settings
+from django.contrib import messages
from django.contrib.auth.decorators import login_required
-from django.core.urlresolvers import reverse
from django.core.cache import cache
-from django.conf import settings
+from django.core.urlresolvers import reverse
from django.db.models import Q, Count
from django.http import HttpResponseRedirect, HttpResponse
from django.shortcuts import render_to_response, get_object_or_404
@@ -71,6 +72,7 @@ def update_package(request, slug):
package = get_object_or_404(Package, slug=slug)
package.fetch_metadata()
+ messages.add_message(request, messages.INFO, 'Package updated successfully')
return HttpResponseRedirect(reverse("package", kwargs={"slug": package.slug}))
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -45,7 +45,7 @@
{% usage_button %}
{% endwith %}
</td>
- <td><a class="awesome forestgreen" href="{% url fetch_package_data object.slug %}">Fetch latest data</a></td>
+ <td id="fetch-cell"><a class="awesome forestgreen" href="{% url fetch_package_data object.slug %}">Fetch latest data</a></td>
</tr>
</tbody>
</table>
@@ -157,7 +157,17 @@ <h2 class="rtd" style="display: none;">Read the Docs</h2>
{% block extra_body %}
<script type="text/javascript">
- $(function() {
+ $(function() {
+
+ $('#fetch-cell > a').click(function(){
+ $('#fetch-cell').html('Updating <img src="{{ STATIC_URL }}img/progress.gif">');
+ }
+ )
+ });
+</script>
+
+<script type="text/javascript">
+ $(function() { '
$('#find-a-grid').click(function() {
$('#find-a-grid').hide();

0 comments on commit 9a29fb4

Please sign in to comment.