Add previous and next buttons to navigate between file attachments

Review Request #8443 — Created Sept. 27, 2016 and submitted

Information

Review Board
release-3.0.x
0992759...

Reviewers

The file attachment UI previously did not have any way to navigate
between any file attachments. A user would have to navigate back to the
review request and select the next one they wished to review.

Now there are previous and next buttons on the edges of the page when
there are more file attachments to review. They follow the order of the
review request UI and only navigate to active (and latest revisions).
When they are hovered over, they expand out to show the thumbnail of the
attachment that will be navigated to.

Ran unit tests.

Tested in the following browsers on OSX:

  • Chrome
  • Firefox release
  • Firefox developer edition
  • Safari

Verified the links were correct on local site review requests.


Description From Last Updated

Can you show screenshots/add Testing Done for this on both Firefox (stable) and Chrome?

chipx86chipx86

Can you also test with Local Sites to make sure links are correct?

chipx86chipx86

Can we give this a bit of a box-shadow so that the layering is more apparent?

daviddavid

It might be nice to break this out into a method, or at least comment it and explain what it's …

daviddavid

Perhaps we can change get_latest_file_attachments to return a generator expression instead of a list?

daviddavid

I don't think this change is correct.

daviddavid

Where does the 14px come from?

daviddavid

There's an extra space before this templatetag.

daviddavid

This is all indented 1 space too much.

daviddavid

Indented 1 space too much.

daviddavid

undefined name 'next_obj'

reviewbotreviewbot

undefined name 'prev_obj'

reviewbotreviewbot

Col: 80 E501 line too long (117 > 79 characters)

reviewbotreviewbot

It might be nice to say what "next" and "previous" mean.

daviddavid

Col: 80 E501 line too long (117 > 79 characters)

reviewbotreviewbot

Can we define a constant for this?

daviddavid

Col: 80 E501 line too long (117 > 79 characters)

reviewbotreviewbot

If we made a change to have @page-container-padding be in px instead of em, we could use LESS's calculations here …

daviddavid

Col: 80 E501 line too long (117 > 79 characters)

reviewbotreviewbot

Col: 80 E501 line too long (117 > 79 characters)

reviewbotreviewbot

Col: 80 E501 line too long (117 > 79 characters)

reviewbotreviewbot

Should be: Yields: reviewboard.attachments.models.FileAttachment ...

chipx86chipx86

Col: 80 E501 line too long (117 > 79 characters)

reviewbotreviewbot

Swap these. Elements before classes. (Elements, then IDs, then classes.)

chipx86chipx86

Swap these.

chipx86chipx86

Two blank lines.

chipx86chipx86

You shouldn't need to use the "localsite" template tag for anything. The url tag from there is automatically injected globally …

chipx86chipx86

We want to use the display ID, not the database ID, for review requests on these URLs.

chipx86chipx86

Col: 80 E501 line too long (117 > 79 characters)

reviewbotreviewbot
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/reviews/views.py
        reviewboard/reviews/ui/base.py
        reviewboard/attachments/models.py
    
    Ignored Files:
        reviewboard/templates/reviews/ui/base.html
        reviewboard/static/rb/css/pages/reviews.less
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/reviews/views.py
        reviewboard/reviews/ui/base.py
        reviewboard/attachments/models.py
    
    Ignored Files:
        reviewboard/templates/reviews/ui/base.html
        reviewboard/static/rb/css/pages/reviews.less
    
    
  2. 
      
david
  1. 
      
  2. reviewboard/reviews/ui/base.py (Diff revision 1)
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    Show all issues

    It might be nice to break this out into a method, or at least comment it and explain what it's doing.

  3. reviewboard/reviews/ui/base.py (Diff revision 1)
     
     
    Show all issues

    Perhaps we can change get_latest_file_attachments to return a generator expression instead of a list?

  4. reviewboard/reviews/views.py (Diff revision 1)
     
     
    Show all issues

    I don't think this change is correct.

    1. Thanks for catching that.

  5. Show all issues

    Where does the 14px come from?

  6. Show all issues

    There's an extra space before this templatetag.

  7. reviewboard/templates/reviews/ui/base.html (Diff revision 1)
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    Show all issues

    This is all indented 1 space too much.

  8. reviewboard/templates/reviews/ui/base.html (Diff revision 1)
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    Show all issues

    Indented 1 space too much.

  9. 
      
brennie
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/reviews/views.py
        reviewboard/reviews/ui/base.py
        reviewboard/attachments/models.py
    
    Ignored Files:
        reviewboard/templates/reviews/ui/base.html
        reviewboard/static/rb/css/pages/reviews.less
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/reviews/views.py
        reviewboard/reviews/ui/base.py
        reviewboard/attachments/models.py
    
    Ignored Files:
        reviewboard/templates/reviews/ui/base.html
        reviewboard/static/rb/css/pages/reviews.less
    
    
  2. reviewboard/reviews/ui/base.py (Diff revision 2)
     
     
    Show all issues
     undefined name 'next_obj'
    
  3. reviewboard/reviews/ui/base.py (Diff revision 2)
     
     
    Show all issues
     undefined name 'prev_obj'
    
  4. reviewboard/reviews/ui/base.py (Diff revision 2)
     
     
    Show all issues
    Col: 80
     E501 line too long (117 > 79 characters)
    
  5. 
      
brennie
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/reviews/views.py
        reviewboard/reviews/ui/base.py
        reviewboard/attachments/models.py
    
    Ignored Files:
        reviewboard/templates/reviews/ui/base.html
        reviewboard/static/rb/css/pages/reviews.less
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/reviews/views.py
        reviewboard/reviews/ui/base.py
        reviewboard/attachments/models.py
    
    Ignored Files:
        reviewboard/templates/reviews/ui/base.html
        reviewboard/static/rb/css/pages/reviews.less
    
    
  2. reviewboard/reviews/ui/base.py (Diff revision 3)
     
     
    Show all issues
    Col: 80
     E501 line too long (117 > 79 characters)
    
  3. 
      
david
  1. 
      
  2. Show all issues

    Can we give this a bit of a box-shadow so that the layering is more apparent?

  3. reviewboard/reviews/ui/base.py (Diff revision 3)
     
     
    Show all issues

    It might be nice to say what "next" and "previous" mean.

  4. 
      
brennie
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/reviews/views.py
        reviewboard/reviews/ui/base.py
        reviewboard/attachments/models.py
    
    Ignored Files:
        reviewboard/templates/reviews/ui/base.html
        reviewboard/static/rb/css/pages/reviews.less
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/reviews/views.py
        reviewboard/reviews/ui/base.py
        reviewboard/attachments/models.py
    
    Ignored Files:
        reviewboard/templates/reviews/ui/base.html
        reviewboard/static/rb/css/pages/reviews.less
    
    
  2. reviewboard/reviews/ui/base.py (Diff revision 4)
     
     
    Show all issues
    Col: 80
     E501 line too long (117 > 79 characters)
    
  3. 
      
david
  1. 
      
  2. reviewboard/static/rb/css/pages/reviews.less (Diff revisions 3 - 4)
     
     
    Show all issues

    Can we define a constant for this?

    1. Replaced this with a calc() expression.

  3. 
      
brennie
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/reviews/views.py
        reviewboard/reviews/ui/base.py
        reviewboard/attachments/models.py
    
    Ignored Files:
        reviewboard/templates/reviews/ui/base.html
        reviewboard/static/rb/css/pages/reviews.less
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/reviews/views.py
        reviewboard/reviews/ui/base.py
        reviewboard/attachments/models.py
    
    Ignored Files:
        reviewboard/templates/reviews/ui/base.html
        reviewboard/static/rb/css/pages/reviews.less
    
    
  2. reviewboard/reviews/ui/base.py (Diff revision 5)
     
     
    Show all issues
    Col: 80
     E501 line too long (117 > 79 characters)
    
  3. 
      
david
  1. 
      
  2. reviewboard/static/rb/css/pages/reviews.less (Diff revisions 4 - 5)
     
     
    Show all issues

    If we made a change to have @page-container-padding be in px instead of em, we could use LESS's calculations here instead of calc().

  3. 
      
brennie
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/reviews/views.py
        reviewboard/reviews/ui/base.py
        reviewboard/attachments/models.py
    
    Ignored Files:
        reviewboard/templates/reviews/ui/base.html
        reviewboard/static/rb/css/pages/reviews.less
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/reviews/views.py
        reviewboard/reviews/ui/base.py
        reviewboard/attachments/models.py
    
    Ignored Files:
        reviewboard/templates/reviews/ui/base.html
        reviewboard/static/rb/css/pages/reviews.less
    
    
  2. reviewboard/reviews/ui/base.py (Diff revision 6)
     
     
    Show all issues
    Col: 80
     E501 line too long (117 > 79 characters)
    
  3. 
      
brennie
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/reviews/views.py
        reviewboard/reviews/ui/base.py
        reviewboard/attachments/models.py
    
    Ignored Files:
        reviewboard/templates/reviews/ui/base.html
        reviewboard/static/rb/css/pages/reviews.less
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/reviews/views.py
        reviewboard/reviews/ui/base.py
        reviewboard/attachments/models.py
    
    Ignored Files:
        reviewboard/templates/reviews/ui/base.html
        reviewboard/static/rb/css/pages/reviews.less
    
    
  2. reviewboard/reviews/ui/base.py (Diff revision 7)
     
     
    Show all issues
    Col: 80
     E501 line too long (117 > 79 characters)
    
  3. 
      
brennie
brennie
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/reviews/views.py
        reviewboard/reviews/ui/base.py
        reviewboard/attachments/models.py
    
    Ignored Files:
        reviewboard/templates/reviews/ui/base.html
        reviewboard/static/rb/css/pages/reviews.less
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/reviews/views.py
        reviewboard/reviews/ui/base.py
        reviewboard/attachments/models.py
    
    Ignored Files:
        reviewboard/templates/reviews/ui/base.html
        reviewboard/static/rb/css/pages/reviews.less
    
    
  2. reviewboard/reviews/ui/base.py (Diff revision 8)
     
     
    Show all issues
    Col: 80
     E501 line too long (117 > 79 characters)
    
  3. 
      
chipx86
  1. 
      
  2. Show all issues

    Can you show screenshots/add Testing Done for this on both Firefox (stable) and Chrome?

  3. Show all issues

    Can you also test with Local Sites to make sure links are correct?

  4. reviewboard/attachments/models.py (Diff revision 8)
     
     
     
    Show all issues

    Should be:

    Yields:
        reviewboard.attachments.models.FileAttachment
        ...
    
  5. reviewboard/static/rb/css/pages/reviews.less (Diff revision 8)
     
     
     
     
     
     
     
     
    Show all issues

    Swap these. Elements before classes. (Elements, then IDs, then classes.)

  6. Show all issues

    Swap these.

  7. reviewboard/static/rb/css/pages/reviews.less (Diff revision 8)
     
     
     
     
    Show all issues

    Two blank lines.

  8. Show all issues

    You shouldn't need to use the "localsite" template tag for anything. The url tag from there is automatically injected globally by Review Board.

  9. Show all issues

    We want to use the display ID, not the database ID, for review requests on these URLs.

  10. 
      
brennie
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/reviews/views.py
        reviewboard/reviews/ui/base.py
        reviewboard/attachments/models.py
    
    Ignored Files:
        reviewboard/templates/reviews/ui/base.html
        reviewboard/static/rb/css/pages/reviews.less
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/reviews/views.py
        reviewboard/reviews/ui/base.py
        reviewboard/attachments/models.py
    
    Ignored Files:
        reviewboard/templates/reviews/ui/base.html
        reviewboard/static/rb/css/pages/reviews.less
    
    
  2. reviewboard/reviews/ui/base.py (Diff revision 9)
     
     
    Show all issues
    Col: 80
     E501 line too long (117 > 79 characters)
    
  3. 
      
chipx86
  1. 
      
  2. 
      
brennie
Review request changed
Status:
Completed
Change Summary:
Pushed to release-3.0.x (e68e977)