Switch to unified view

a/views/result.tpl b/views/result.tpl
1
%import shlex, unicodedata
1
%import shlex, unicodedata, os
2
<div class="search-result">
2
<div class="search-result">
3
    %number = (query['page'] - 1)*config['perpage'] + i + 1
3
    %number = (query['page'] - 1)*config['perpage'] + i + 1
4
    <div class="search-result-number"><a href="#r{{d['sha']}}">#{{number}}</a></div>
4
    <div class="search-result-number"><a href="#r{{d['sha']}}">#{{number}}</a></div>
5
    %url = d['url'].replace('file://', '')
5
    %url = d['url'].replace('file://', '')
6
    %for dr, prefix in config['mounts'].items():
6
    %for dr, prefix in config['mounts'].items():
...
...
12
    %end
12
    %end
13
    %if d.has_key('author') and len(d['author']) > 0:
13
    %if d.has_key('author') and len(d['author']) > 0:
14
        <div class="search-result-author">{{d['author']}}</div>
14
        <div class="search-result-author">{{d['author']}}</div>
15
    %end
15
    %end
16
    <div class="search-result-url">
16
    <div class="search-result-url">
17
        %urllabel = d['url'].replace('/'+d['filename'],'').replace('file://','')
17
        %urllabel = os.path.dirname(d['url'].replace('file://', ''))
18
        %for r in config['dirs']:
18
        %for r in config['dirs']:
19
            %urllabel = urllabel.replace(r.rsplit('/',1)[0] + '/' , '')
19
            %urllabel = urllabel.replace(r.rsplit('/',1)[0] + '/' , '')
20
        %end
20
        %end
21
        <a href="{{url.replace('/'+d['filename'],'')}}">{{urllabel}}</a>
21
        <a href="{{os.path.dirname(url)}}">{{urllabel}}</a>
22
    </div>
22
    </div>
23
%if hasrclextract:
23
%if hasrclextract:
24
    <div class="search-result-links">
24
    <div class="search-result-links">
25
    <a href="/preview/{{number-1}}?{{query_string}}" target="_blank">Preview</a>
25
    <a href="/preview/{{number-1}}?{{query_string}}" target="_blank">Preview</a>
26
    <a href="/download/{{number-1}}?{{query_string}}">Download</a>
26
    <a href="/download/{{number-1}}?{{query_string}}">Download</a>