Fix scroll position for esc out of edit."
parent
f8641c17c3
commit
17656e464b
|
@ -270,9 +270,13 @@
|
||||||
if ($('section#main-edit:visible').length) {
|
if ($('section#main-edit:visible').length) {
|
||||||
$('section#main-edit').hide();
|
$('section#main-edit').hide();
|
||||||
$('section#main').show();
|
$('section#main').show();
|
||||||
$('html, body').animate({
|
if (SniptList.$snipts.index($selected) === 0) {
|
||||||
scrollTop: $selected.offset().top - 50
|
window.scrollTo(0, 0);
|
||||||
}, 0);
|
} else {
|
||||||
|
$('html, body').animate({
|
||||||
|
scrollTop: $selected.offset().top - 50
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if ($selected) {
|
if ($selected) {
|
||||||
$selected.trigger('deselect');
|
$selected.trigger('deselect');
|
||||||
|
|
|
@ -75,14 +75,17 @@ def detail(request, username, snipt_slug):
|
||||||
|
|
||||||
if user == request.user:
|
if user == request.user:
|
||||||
tags = tags.filter(snipt__user=user)
|
tags = tags.filter(snipt__user=user)
|
||||||
|
public = False
|
||||||
else:
|
else:
|
||||||
tags = tags.filter(snipt__user=user, snipt__public=True)
|
tags = tags.filter(snipt__user=user, snipt__public=True)
|
||||||
|
public = True
|
||||||
|
|
||||||
tags = tags.annotate(count=Count('taggit_taggeditem_items__id'))
|
tags = tags.annotate(count=Count('taggit_taggeditem_items__id'))
|
||||||
tags = tags.order_by('-count', 'name')
|
tags = tags.order_by('-count', 'name')
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
'public': public,
|
||||||
'snipt': snipt,
|
'snipt': snipt,
|
||||||
'user': user,
|
|
||||||
'tags': tags,
|
'tags': tags,
|
||||||
|
'user': user,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue