Changeset - 47e54cf3047b
[Not reviewed]
default
0 3 0
Martin Vium - 12 years ago 2013-11-12 11:10:38
martinv@unity3d.com
files: preview of images
3 files changed with 17 insertions and 1 deletions:
0 comments (0 inline, 0 general)
kallithea/lib/vcs/nodes.py
Show inline comments
 
@@ -422,6 +422,14 @@ class FileNode(Node):
 
        _bin = '\0' in self._get_content()
 
        return _bin
 

	
 
    def is_browser_compatible_image(self):
 
        return self.mimetype in [
 
            "image/gif",
 
            "image/jpeg",
 
            "image/png",
 
            "image/bmp"
 
        ]
 

	
 
    @LazyProperty
 
    def extension(self):
 
        """Returns filenode extension"""
kallithea/public/css/style.css
Show inline comments
 
@@ -5122,6 +5122,12 @@ div.comment:target>.comment-wrapp {
 
    margin: -2px;
 
}
 

	
 
.img-preview {
 
    max-width: 100%;
 
    height: auto;
 
    margin: 5px;
 
}
 

	
 
div.prev-next-comment div.prev-comment,
 
div.prev-next-comment div.next-comment {
 
    display: inline-block;
kallithea/templates/files/files_source.html
Show inline comments
 
@@ -56,7 +56,9 @@
 
        <div class="commit">${h.urlify_commit(c.file_changeset.message,c.repo_name)}</div>
 
    </div>
 
    <div class="code-body">
 
       %if c.file.is_binary:
 
      %if c.file.is_browser_compatible_image():
 
        <img src="${h.url('files_raw_home',repo_name=c.repo_name,revision=c.file_changeset.raw_id,f_path=c.f_path)}" class="img-preview"/>
 
      %elif c.file.is_binary:
 
           <div style="padding:5px">
 
           ${_('Binary file (%s)') % c.file.mimetype}
 
           </div>
0 comments (0 inline, 0 general)