Add ExtensionHook for User Pages

Review Request #3875 — Created Feb. 16, 2013 and submitted

Information

Review Board

Reviewers

Add support for extensions in UserPage
    
This patch adds support for adding extensions in UserPage and works very similar to the DashboardHook. It takes a dictionary of label, url and an optional subitems -- which itself can be an array of (label,url) -- to add custom links in the /users/<username> page.

Also updated the documentation page to indicate the usage of this. Im not sure how to build the doc page into html, so the formatting hasnt been checked for the new documentation.

I added support for this hook so that people wanting to build user-specific reports can use this. For e.g. reports like review-requests assigned to me, or a users' RSS feed can all be linked directly from a user page.
Ran all existing tests. 
Added a new test for the UserPageHook.
Added a new test extension that demonstrates the use of this (Screenshot attached).
Tested without extension to ensure no other breakage.

Description From Last Updated

There's some trailing whitespace here and elsewhere in the file.

chipx86chipx86

It's possible we'd want to add other sorts of hooks to this page (such as a banner of some sort …

chipx86chipx86

Let's see an example with subitems too.

mike_conleymike_conley

Nit - let's put these in alphabetical ordering.

mike_conleymike_conley

Looks like all the newly introduced tags should be indented by 1 space (to be relative to the endif). The …

chipx86chipx86
reviewbot
  1. This is a review from Review Bot.
      Tool: PEP8 Style Checker
      Processed Files:
        reviewboard/reviews/views.py
        reviewboard/extensions/hooks.py
        reviewboard/extensions/tests.py
      Ignored Files:
        docs/codebase/extending/extensions.txt
        reviewboard/templates/reviews/user_page.html
    
    
  2. 
      
RA
chipx86
  1. 
      
  2. docs/codebase/extending/extensions.txt (Diff revision 1)
     
     
    Show all issues
    There's some trailing whitespace here and elsewhere in the file.
  3. reviewboard/extensions/hooks.py (Diff revision 1)
     
     
    Show all issues
    It's possible we'd want to add other sorts of hooks to this page (such as a banner of some sort above the list of review requests). That may make this name confusing.
    
    I think a more fitting name would be UserPageSidebarHook.
    1. Renamed the hook as UserPageSidebarHook
  4. 
      
RA
reviewbot
  1. This is a review from Review Bot.
      Tool: PEP8 Style Checker
      Processed Files:
        reviewboard/reviews/views.py
        reviewboard/extensions/hooks.py
        reviewboard/extensions/tests.py
      Ignored Files:
        docs/codebase/extending/extensions.txt
        reviewboard/templates/reviews/user_page.html
    
    
  2. 
      
mike_conley
  1. I'm quite happy with this change. Just two suggestions, and then I'll give my ship-it.
    
    Thanks for the excellent patch!
  2. docs/codebase/extending/extensions.txt (Diff revision 2)
     
     
    Show all issues
    Let's see an example with subitems too.
    1. Ive added another code block to show with sub-items as they are optional.
  3. reviewboard/reviews/views.py (Diff revision 2)
     
     
     
     
    Show all issues
    Nit - let's put these in alphabetical ordering.
  4. 
      
chipx86
  1. 
      
  2. Show all issues
    Looks like all the newly introduced tags should be indented by 1 space (to be relative to the endif).
    
    The other tags in this file are all pretty off. Even that endif should really be indented by 2. Oh well.. Might as well get a little closer to correct.
    1. Please let me know if the other changes (outside of my diff) needs to be fixed. I can open a bug and work on that (maybe find a tool that could do it for all other template files as well)
  3. 
      
RA
reviewbot
  1. This is a review from Review Bot.
      Tool: PEP8 Style Checker
      Processed Files:
        reviewboard/reviews/views.py
        reviewboard/extensions/hooks.py
        reviewboard/extensions/tests.py
      Ignored Files:
        docs/codebase/extending/extensions.txt
        reviewboard/templates/reviews/user_page.html
    
    
  2. 
      
david
  1. Ship It!
  2. 
      
RA
Review request changed
Status:
Completed
Change Summary:
Pushed to master (452211a). Thanks!