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():
...
...
14
    %end
14
    %end
15
    %if d.has_key('author') and len(d['author']) > 0:
15
    %if d.has_key('author') and len(d['author']) > 0:
16
        <div class="search-result-author">{{d['author']}}</div>
16
        <div class="search-result-author">{{d['author']}}</div>
17
    %end
17
    %end
18
    <div class="search-result-url">
18
    <div class="search-result-url">
19
        %urllabel = d['url'].replace('/'+d['filename'],'').replace('file://','')
19
        %urllabel = os.path.dirname(d['url'].replace('file://', ''))
20
        %for r in config['dirs']:
20
        %for r in config['dirs']:
21
            %urllabel = urllabel.replace(r.rsplit('/',1)[0] + '/' , '')
21
            %urllabel = urllabel.replace(r.rsplit('/',1)[0] + '/' , '')
22
        %end
22
        %end
23
        <a href="{{url.replace('/'+d['filename'],'')}}">{{urllabel}}</a>
23
        <a href="{{os.path.dirname(url)}}">{{urllabel}}</a>
24
    </div>
24
    </div>
25
%if hasrclextract:
25
%if hasrclextract:
26
    <div class="search-result-links">
26
    <div class="search-result-links">
27
    <a href="preview/{{number-1}}?{{query_string}}" target="_blank">Preview</a>
27
    <a href="preview/{{number-1}}?{{query_string}}" target="_blank">Preview</a>
28
    </div>
28
    </div>