Users should be able to specify their default Dashboard view

Review Request #3653 — Created Dec. 11, 2012 and discarded

rajasaur
Review Board
581
reviewboard
Users should be able to specify their default dashboard view.
    
Introduce a User Profile attribute that allows the user to select one of "incoming","outgoing","starred","mine". Once they select one of these (the default will be "incoming"), the default view will be set to that and will be shown anytime they come into the /dashboard/ page.
    
Summary of changes:
* reviewboard/accounts/evolutions/__init__.py
* reviewboard/accounts/evolutions/default_view.py
  + Migration script to add the "default_view" column to accounts_profile
    
* reviewboard/accounts/forms.py
  + Create a default_view field selected from a dropdown list of "incoming", "outgoing", "mine" or "starred".
  + Save the user selected value when saving the user profile.
    
* reviewboard/accounts/models.py
  + Create a default_view field in the model (CharField) that has a default value of "incoming".
    
* reviewboard/reviews/datagrids.py
  + Get the value from the constructor and set it to be the default_view. If nothing is setup, default to 'incoming' (Existing behaviour) Fill it out the same way as how it would be when a         
    user does /dashboard?view=<view type>
    
* reviewboard/reviews/tests.py
  + Added testDashboardDefaultView that sets the default view for "doc" user. Test the counts by varying the account profile value.
    
* reviewboard/reviews/views.py
  + Call DashboardDataGrid passing in the user's default_view profile setting.

Manual, ran the test cases (new and existing).

I wasnt sure of how to run the migration testing, so that was not tested.
Loading file attachments...

Description From Last Updated

Should be listed alphabetically.

chipx86chipx86

Can we call this default_dashboard_view, so it's clear?

chipx86chipx86

The human-readable strings should be localized (using _(..))

chipx86chipx86

Should also be default_dashboard_view. Also, alignment issue.

chipx86chipx86

The other functions in this class don't do this yet, but we're trying to move unit tests to use underscore_separated_functions, ...

chipx86chipx86

Trailing whitespace. I think it's best to have all parameters on their own lines, aligned with default_view, so that there's ...

chipx86chipx86

I'd prefer this go in Profile.

chipx86chipx86

I think ideally, this would be 4 separate test functions, one per view. That way we know that each of ...

chipx86chipx86

use assertTrue.

chipx86chipx86

assertTrue.

chipx86chipx86

This shouldn't be needed.

chipx86chipx86
chipx86
  1. 
      
  2. reviewboard/accounts/forms.py (Diff revision 1)
     
     
    Should be listed alphabetically.
  3. reviewboard/accounts/forms.py (Diff revision 1)
     
     
    Can we call this default_dashboard_view, so it's clear?
  4. reviewboard/accounts/models.py (Diff revision 1)
     
     
     
     
     
    The human-readable strings should be localized (using _(..))
  5. reviewboard/accounts/models.py (Diff revision 1)
     
     
     
    Should also be default_dashboard_view.
    
    Also, alignment issue.
  6. reviewboard/reviews/tests.py (Diff revision 1)
     
     
    The other functions in this class don't do this yet, but we're trying to move unit tests to use underscore_separated_functions, like the rest of the codebase. Can you update this to do that?
  7. reviewboard/reviews/views.py (Diff revision 1)
     
     
     
    Trailing whitespace.
    
    I think it's best to have all parameters on their own lines, aligned with default_view, so that there's consistency. Like:
    
    grid = DashboardDataGrid(
        request,
        local_site=...,
        ...)
  8. 
      
RA
reviewbot
  1. This is a review from Review Bot.
      Tool: PEP8 Style Checker
      Processed Files:
        reviewboard/reviews/views.py
        reviewboard/reviews/tests.py
        reviewboard/accounts/views.py
        reviewboard/accounts/evolutions/__init__.py
        reviewboard/accounts/models.py
        reviewboard/reviews/datagrids.py
        reviewboard/accounts/evolutions/default_dashboard_view.py
        reviewboard/accounts/forms.py
      Ignored Files:
        reviewboard/templates/accounts/prefs.html
    
    
  2. 
      
chipx86
  1. 
      
  2. reviewboard/accounts/models.py (Diff revision 2)
     
     
    I'd prefer this go in Profile.
  3. reviewboard/reviews/tests.py (Diff revision 2)
     
     
    I think ideally, this would be 4 separate test functions, one per view. That way we know that each of those does the right thing, and our tests become more fine-grained (easier to see what breaks).
  4. reviewboard/reviews/tests.py (Diff revision 2)
     
     
    use assertTrue.
  5. reviewboard/reviews/tests.py (Diff revision 2)
     
     
    assertTrue.
  6. reviewboard/reviews/tests.py (Diff revision 2)
     
     
    This shouldn't be needed.
  7. 
      
RA
reviewbot
  1. This is a review from Review Bot.
      Tool: PEP8 Style Checker
      Processed Files:
        reviewboard/reviews/views.py
        reviewboard/reviews/tests.py
        reviewboard/accounts/views.py
        reviewboard/accounts/evolutions/__init__.py
        reviewboard/accounts/models.py
        reviewboard/reviews/datagrids.py
        reviewboard/accounts/evolutions/default_dashboard_view.py
        reviewboard/accounts/forms.py
      Ignored Files:
        reviewboard/templates/accounts/prefs.html
    
    
  2. 
      
RA
Review request changed

Status: Discarded

Loading...