Changeset - 1013437c997a
[Not reviewed]
default
0 2 0
Thomas De Schampheleire - 10 years ago 2015-10-08 17:45:50
thomas.de.schampheleire@gmail.com
files: support annotation on files larger than cut_off_limit

When requesting the annotation for a file larger than the cut_off_limit
configured in the ini file, the only current option is to click the useless
'show as raw' (which is not an annotation).

Replace it with a link 'Show full annotation anyway' instead.
2 files changed with 8 insertions and 3 deletions:
0 comments (0 inline, 0 general)
kallithea/controllers/files.py
Show inline comments
 
@@ -134,12 +134,13 @@ class FilesController(BaseRepoController
 
        c.revision = revision
 
        c.changeset = self.__get_cs(revision)
 
        c.branch = request.GET.get('branch', None)
 
        c.f_path = f_path
 
        c.annotate = annotate
 
        cur_rev = c.changeset.revision
 
        c.fulldiff = request.GET.get('fulldiff')
 

	
 
        # prev link
 
        try:
 
            prev_rev = c.db_repo_scm_instance.get_changeset(cur_rev).prev(c.branch)
 
            c.url_prev = url('files_home', repo_name=c.repo_name,
 
                         revision=prev_rev.raw_id, f_path=f_path)
kallithea/templates/files/files_source.html
Show inline comments
 
@@ -60,21 +60,25 @@
 
        <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>
 
      %else:
 
        %if c.file.size < c.cut_off_limit:
 
        %if c.file.size < c.cut_off_limit or c.fulldiff:
 
            %if c.annotate:
 
              ${h.pygmentize_annotation(c.repo_name,c.file,linenos=True,anchorlinenos=True,lineanchors='L',cssclass="code-highlight")}
 
            %else:
 
              ${h.pygmentize(c.file,linenos=True,anchorlinenos=True,lineanchors='L',cssclass="code-highlight")}
 
            %endif
 
        %else:
 
            ${_('File is too big to display')} ${h.link_to(_('Show as raw'),
 
            h.url('files_raw_home',repo_name=c.repo_name,revision=c.file_changeset.raw_id,f_path=c.f_path))}
 
            ${_('File is too big to display')}
 
            %if c.annotate:
 
              ${h.link_to(_('Show full annotation anyway'), h.url.current(fulldiff=1, **request.GET.mixed()))}
 
            %else:
 
              ${h.link_to(_('Show as raw'), h.url('files_raw_home',repo_name=c.repo_name,revision=c.file_changeset.raw_id,f_path=c.f_path))}
 
            %endif
 
        %endif
 
      %endif
 
    </div>
 
</div>
 

	
 
<script>
0 comments (0 inline, 0 general)