Changeset - 6ec53c16c744
[Not reviewed]
beta
0 3 0
Marcin Kuzminski - 15 years ago 2011-02-14 15:29:53
marcin@python-works.com
fixed binary file issues
3 files changed with 24 insertions and 12 deletions:
0 comments (0 inline, 0 general)
rhodecode/controllers/files.py
Show inline comments
 
@@ -224,12 +224,16 @@ class FilesController(BaseController):
 
        elif c.action == 'diff':
 
            if node1.size > self.cut_off_limit or node2.size > self.cut_off_limit:
 
                c.cur_diff = _('Diff is to big to display')
 
            elif node1.is_binary or node2.is_binary:
 
                c.cur_diff = _('Binary file')
 
            else:
 
                c.cur_diff = diff.as_html()
 
        else:
 
            #default option
 
            if node1.size > self.cut_off_limit or node2.size > self.cut_off_limit:
 
                c.cur_diff = _('Diff is to big to display')
 
            elif node1.is_binary or node2.is_binary:
 
                c.cur_diff = _('Binary file')
 
            else:
 
                c.cur_diff = diff.as_html()
 

	
rhodecode/templates/files/files_annotate.html
Show inline comments
 
@@ -63,24 +63,28 @@
 
					<div class="commit">"${c.file.message}"</div>
 
				</div>
 
				<div class="code-body">
 
			       %if c.file.is_binary:
 
			           ${_('Binary file')}
 
			       %else:				
 
					% if c.file.size < c.cut_off_limit:
 
						${h.pygmentize_annotation(c.file,linenos=True,anchorlinenos=True,lineanchors='S',cssclass="code-highlight")}
 
					%else:
 
						${_('File is to big to display')} ${h.link_to(_('show as raw'),
 
						h.url('files_raw_home',repo_name=c.repo_name,revision=c.cs.revision,f_path=c.f_path))}
 
					%endif				
 
					%endif
 
		            <script type="text/javascript">
 
		            YAHOO.util.Event.onDOMReady(function(){
 
		                YAHOO.util.Event.addListener('show_rev','click',function(e){
 
		                    YAHOO.util.Event.preventDefault(e);
 
		                    var cs = YAHOO.util.Dom.get('diff1').value;
 
		                    var url = "${h.url('files_annotate_home',repo_name=c.repo_name,revision='__CS__',f_path=c.f_path)}".replace('__CS__',cs);
 
		                    window.location = url;
 
		                    });
 
		               });
 
		            </script>				
 
				   %endif				
 
				</div>
 
			</div>
 
			<script type="text/javascript">
 
			YAHOO.util.Event.onDOMReady(function(){
 
			    YAHOO.util.Event.addListener('show_rev','click',function(e){
 
			        YAHOO.util.Event.preventDefault(e);
 
			        var cs = YAHOO.util.Dom.get('diff1').value;
 
			        var url = "${h.url('files_annotate_home',repo_name=c.repo_name,revision='__CS__',f_path=c.f_path)}".replace('__CS__',cs);
 
			        window.location = url;
 
			        });
 
			   });
 
			</script>			
 
		</div>    
 
    </div>
 
</div>    
rhodecode/templates/files/files_source.html
Show inline comments
 
@@ -36,6 +36,9 @@
 
		<div class="commit">"${c.files_list.last_changeset.message}"</div>
 
	</div>
 
	<div class="code-body">
 
	   %if c.files_list.is_binary:
 
	       ${_('Binary file')}
 
	   %else:
 
		% if c.files_list.size < c.cut_off_limit:
 
			${h.pygmentize(c.files_list,linenos=True,anchorlinenos=True,lineanchors='L',cssclass="code-highlight")}
 
		%else:
 
@@ -71,7 +74,8 @@
 
             }
 
           highlight_lines(h_lines);              
 
           }
 
       </script>		
 
       </script>
 
     %endif		
 
	</div>
 
</div>
 

	
0 comments (0 inline, 0 general)