mirror of https://github.com/zulip/zulip.git
Get pointer state from the server on page load, and scroll to that zephyr.
(imported from commit a1387d89378494a55f084f56ed9eb33c4f719dcb)
This commit is contained in:
parent
37d02a232a
commit
e51ab0cdfa
|
@ -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'),
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue