diff --git a/humbug/urls.py b/humbug/urls.py index 8e83845e06..733d1140cb 100644 --- a/humbug/urls.py +++ b/humbug/urls.py @@ -9,6 +9,7 @@ import os.path urlpatterns = patterns('', url(r'^$', 'zephyr.views.home', name='home'), url(r'^update$', 'zephyr.views.update', name='update'), + url(r'^get_state$', 'zephyr.views.get_state', name='get_state'), url(r'^get_updates_longpoll$', 'zephyr.views.get_updates_longpoll', name='get_updates_longpoll'), url(r'^zephyr/', 'zephyr.views.zephyr', name='zephyr'), url(r'^personal-zephyr/', 'zephyr.views.personal_zephyr', name='personal_zephyr'), diff --git a/zephyr/static/js/zephyr.js b/zephyr/static/js/zephyr.js index 78632f2973..16669ebe41 100644 --- a/zephyr/static/js/zephyr.js +++ b/zephyr/static/js/zephyr.js @@ -115,6 +115,10 @@ $(document).ready(function() { $("body").delegate("p", "click", function(){ select_zephyr($(this).parent().parent()); }); + + $.get('get_state', function(data) { + select_zephyr($("#" + data.pointer)); + }, dataType="json"); }); var goto_pressed = false; diff --git a/zephyr/views.py b/zephyr/views.py index 1262bacaee..f7637982f7 100644 --- a/zephyr/views.py +++ b/zephyr/views.py @@ -68,6 +68,16 @@ def update(request): user_profile.save() return HttpResponse(simplejson.dumps({}), mimetype='application/json') +@login_required +def get_state(request): + if not request.GET: + # Do something + pass + + user_profile = UserProfile.objects.get(user=request.user) + return HttpResponse(simplejson.dumps({"pointer": user_profile.pointer}), + mimetype='application/json') + @asynchronous def get_updates_longpoll(request, handler): if not request.POST: