aboutsummaryrefslogtreecommitdiffstats
path: root/templates/repo/view_file.tmpl
blob: 4e2d4fc64c98af257cb00c7cdaa5e5aa6f65c472 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<div class="panel panel-radius" id="{{if .ReadmeExist}}repo-readme{{else}}repo-read-file{{end}}">
    <p class="panel-header">
        {{if .ReadmeExist}}
            <i class="icon fa fa-book fa-lg"></i>
	        {{if .ReadmeInList}}
	        <strong class="file-name">{{.FileName}}</strong>
	        {{else}}
	        <strong>{{.FileName}}</strong><span class="file-size">{{FileSize .FileSize}}</span>
	        {{end}}
	    {{else}}
            <i class="icon fa fa-file-text-o"></i>
            <strong class="file-name">{{.FileName}}</strong><span class="file-size">{{FileSize .FileSize}}</span>
	    {{end}}
        {{if not .ReadmeInList}}
            <a class="right" href="{{.RepoLink}}/commits/{{.BranchName}}/{{.TreeName}}">
                <button class="btn btn-medium btn-gray btn-right-radius btn-comb">{{.i18n.Tr "repo.file_history"}}</button>
            </a>
            <a class="right" href="{{.FileLink}}">
                <button class="btn btn-medium btn-gray btn-left-radius btn-comb">{{.i18n.Tr "repo.file_raw"}}</button>
            </a>
        {{end}}
    </p>
    <div class="{{if .ReadmeExist}}panel-content markdown{{end}} code-view" id="repo-code-view">
    	{{if .ReadmeExist}}
    	{{if .FileContent}}{{.FileContent | Str2html}}{{end}}
        {{else if not .IsFileText}}
        <div class="view-raw">
            {{if .IsImageFile}}
            <img src="{{.FileLink}}">
            {{else}}
            <a href="{{.FileLink}}" rel="nofollow" class="btn btn-gray btn-radius">{{.i18n.Tr "repo.file_view_raw"}}</a>
            {{end}}
        </div>
    	{{else if .FileSize}}
        <table>
            <tbody>
                <tr>
                    <td class="lines-num"></td>
                    <td class="lines-code"><pre class="prettyprint linenums {{if .FileExt}}lang-{{.FileExt}}{{end}}"><code>{{.FileContent}}</code></pre></td>
                </tr>
            </tbody>
        </table>
    	{{end}}
    </div>
</div>