Editable Templates - Loader & template components

Review Request #2186 — Created March 4, 2011 and discarded

Information

Review Board

Reviewers

Extension template loader implemented.
admin/dashboard.html broken into:
   - admin/dashboard.html
   - admin/dashboard/dashboard_manage.html
   - admin/dashboard/dashboard_news.html
   - admin/dashboard/dashboard_server_info.html

for easier extension.
Manual:
   - created a dashboard_extension.html with no {% extends ...%} -> correctly loads the blank page in place of the dashboard
   - created a dashboard_extension.html with {% extends ...%} -> correctly extends the original dashboard
   - created a dashboard_manage_extension.html with no {% extends ...%} (both with and without the dashboard_extension.html) correctly displays all of the dashboard excluding the dashboard_manage.html
   - created a dashboard_manage_extension.html with {% extends ...%} (both with and without the dashboard_extension.html) correctly displays the original dashboard with the manage extension
chipx86
  1. Make sure you're updating the same review request, not creating new ones. You need to use the -r <id> parameter to post-review.
    
    Can you go through and delete your old review requests?
  2. 
      
TC
TC
TC
chipx86
  1. 
      
  2. docs/manual/template_extension.txt (Diff revision 4)
     
     
    Make sure all the trailing whitespace is removed.
    
    Also, it doesn't look like this file will actually parse properly when generating the docs. Please install Python Sphinx and generate the docs with "make html" (in the docs/manual directory). You'll get warnings/errors for anything that's wrong. You should also be able to find the resulting HTML files and view them in a browser.
  3. reviewboard/settings.py (Diff revision 4)
     
     
    Do we still need this?
    1. Yes, I tried it without, that loader seems to be loading django's default templates. Removing it breaks everything.
  4. reviewboard/template_loader.py (Diff revision 4)
     
     
     
    Swap these.
  5. reviewboard/template_loader.py (Diff revision 4)
     
     
     
     
    Two blank lines.
  6. reviewboard/template_loader.py (Diff revision 4)
     
     
     
    Alignment problem.
    
    First line should only be one line long. I'd make it a very brief summary, and go into more detail on subsequent lines.
  7. reviewboard/template_loader.py (Diff revision 4)
     
     
     
     
    Comments should always be in sentence casing, with trailing periods.
  8. reviewboard/template_loader.py (Diff revision 4)
     
     
     
    I still don't think we need to mangle the names here. If done right, a file can just be called "foo.html" and won't need to be "foo_extended.html." The "reviewboard/" prefix trick should be sufficient.
    1. I think that would work if we set up a different directory structure to store the extensions, but if we want the extended files to remain in the same directories as the originals, then using the same name would just overwrite the original templates whenever someone tries to extend it.
  9. Every one of these new files should have the new content in a block. That way, templates can subclass these and override or augment the content.
  10. reviewboard/templates/accounts/register/register_form.html (Diff revision 4)
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    The indentation looks wrong. Should be spaces and aligned properly.
  11. Why the change?
  12. reviewboard/templates/admin/dashboard/dashboard_news.html (Diff revision 4)
     
     
     
     
     
     
     
     
     
    Indentation looks wrong.
  13. reviewboard/templates/admin/dashboard/dashboard_news.html (Diff revision 4)
     
     
     
     
     
     
     
    Here too.
  14. Same comment about sentence casing.
  15. reviewboard/templates/admin/dashboard_news.html (Diff revision 4)
     
     
     
     
     
     
     
     
     
    Indentation looks wrong.
  16. reviewboard/templates/admin/dashboard_news.html (Diff revision 4)
     
     
     
     
     
     
     
    Here too.
  17. reviewboard/templates/base.html (Diff revision 4)
     
     
     
    No spaces before the {% include %}
    
    Same with all other instances.
  18. This should be across two lines. These are two <li>s here.
  19. 
      
TC
TC
david
  1. 
      
  2. docs/manual/template_extension.txt (Diff revision 6)
     
     
    Typo: orinal -> original
  3. reviewboard/template_loader.py (Diff revision 6)
     
     
     
    Switch these two lines (alphabetical order)
  4. There seem to be tab characters in these lines. Please indent with spaces.
  5. reviewboard/templates/admin/dashboard_news.html (Diff revision 6)
     
     
     
     
     
     
     
     
    These should all be indented the same.
  6. reviewboard/templates/admin/dashboard_news.html (Diff revision 6)
     
     
     
     
     
    Watch out for tab characters.
  7. 
      
TC
TC
david
  1. Just one code comment.
  2. reviewboard/template_loader.py (Diff revision 8)
     
     
     
     
    Combine these into one big docstring, like this:
    
    """
    Template loader that loads extended templates.
    
    If a template is specified as "original.html", this loader will look first for "original_extended.html"
    """
  3. Can you go through each changed template and make sure that without any extensions, the pages look the same as they did before this change?
TC
TC
Review request changed

Status: Discarded

Loading...