• 
      

    Introducing Thumbnail Integration through Extensions

    Review Request #3614 — Created Dec. 3, 2012 and submitted

    Information

    Review Board
    master

    Reviewers

    ReviewBoard Extensions can now define how to create thumbnails
    for specified file attachment mimetypes.
    
    Added FileAttachmentThumbnailHook to generalize a hook point for
    all files of all mimetypes. Mimetype Handlers for text-based
    mimetypes can leverage `reviewboard.attachments.mimetypes.TextMimetype`
    by simply overriding `_generate_preview_html` to define how to
    generate the HTML used in the thumbnail, instead of having to
    redefine `get_thumbnail`.
    Test Steps:
    
    - Disabled the registration of XMLMimetype in reviewboard.attachments.__init__ (
    - Verified that XML thumbnails now fall back to raw uncolored text)
    - Copied over the XMLReviewUIExtension from the sample extension branch, and:
      - Added XMLThumbnail.py to define the XMLMimetype class for generating XML thumbnails
      - Modified extensions.py to use the FileAttachmentThumbnailHook to hook XMLMimetype into ReviewBoard to handle XML thumbnails.
    - Verified that the Extension installs without error
    - Verified that Extension-installed XML thumbnails feature work exactly as did before.
    
    (see attached screenshot, disregard the hyperlink lines - that was due to a separate change to master: http://reviews.reviewboard.org/r/3569/)

    Description From Last Updated

    Why are the *s on different lines?

    daviddavid
    SL
    SL
    david
    1. This looks pretty good. Just one question.
    2. reviewboard/extensions/hooks.py (Diff revision 3)
       
       
       
       
       
       
       
       
       
       
      Show all issues
      Why are the *s on different lines?
      1. I believe this is the syntax used when items in a list need span multiple lines in the pre-rendered docs text:
        
        Raw: https://github.com/reviewboard/reviewboard/blob/master/docs/codebase/extending/extensions.txt#L350
        Result: http://www.reviewboard.org/docs/codebase/dev/extending/extensions/#settings-form
        Similar comments: http://reviews.reviewboard.org/r/3596/diff/1/?file=25245#file25245line482
      2. Okay. I'm not very familiar with rst, I guess.
    3. 
        
    chipx86
    1. Why is the text so tiny?
      1. A few possible reasons:
        - Text for XML might appear smaller by contrast as I stopped zooming in to take the screenshots.
        - I've noticed that markdown, docutil, and pygments produce different style/layouts of HTML based on raw text: they all use the same div class "file-thumbnail-clipped" in reviewboard/static/rb/css/reviews.less to scale down font-sizes by 40% on "p, table, pre, code, img, li, h1, h2, h3, h4, h5, h6" - but markdown files will appear slightly larger than .rst or .xml counterparts visually.
        
        However, the thumbnail text render size is not affected by this change in particular: XML thumbnails render and behave exactly the same when enabled as part of RB, or as through an Extension.
    2. 
        
    david
    1. Ship It!
    2. 
        
    SL
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to release-1.7.x (63f82e2). Thanks!