Skip to content

Commit

Permalink
Merge pull request #87 from arXiv/ARXIVNG-2080-next-prev
Browse files Browse the repository at this point in the history
ARXIVNG-2080 - switch back to classic "hybrid" functionality of prev/next
  • Loading branch information
mhl10 authored Apr 18, 2019
2 parents a1f0fab + c1ecae7 commit 2915840
Showing 1 changed file with 24 additions and 9 deletions.
33 changes: 24 additions & 9 deletions browse/controllers/abs_page/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,15 +294,30 @@ def _check_context(arxiv_identifier: Identifier,

response_data['browse_context'] = context

# Use prevnext controller to determine what the previous or next ID is.
next_url = url_for('browse.previous_next',
id=arxiv_identifier.id,
function='next',
context=context if context else None)
prev_url = url_for('browse.previous_next',
id=arxiv_identifier.id,
function='prev',
context=context if context else None)
next_url = None
prev_url = None
if arxiv_identifier.is_old_id or context == 'arxiv':
# Revert to hybrid approach per ARXIVNG-2080
next_id = metadata.get_next_id(arxiv_identifier)
if next_id:
next_url = url_for('browse.abstract',
arxiv_id=next_id.id,
context='arxiv' if context == 'arxiv' else None)
previous_id = metadata.get_previous_id(arxiv_identifier)
if previous_id:
prev_url = url_for('browse.abstract',
arxiv_id=previous_id.id,
context='arxiv' if context == 'arxiv' else None)
else:
# Use prevnext controller to determine what the previous or next ID is.
next_url = url_for('browse.previous_next',
id=arxiv_identifier.id,
function='next',
context=context if context else None)
prev_url = url_for('browse.previous_next',
id=arxiv_identifier.id,
function='prev',
context=context if context else None)

response_data['browse_context_previous_url'] = prev_url
response_data['browse_context_next_url'] = next_url
Expand Down

0 comments on commit 2915840

Please sign in to comment.