summaryrefslogtreecommitdiffstats
path: root/templates/repo/single.tmpl
blob: 019ec8eaaa90a7212ee9e4766f53c5a62907abe3 (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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
{{template "base/head" .}}
{{template "base/navbar" .}}
{{template "repo/nav" .}}
{{template "repo/toolbar" .}}
<div id="gogs-body" class="container">
    <div id="gogs-source">
        {{if .IsBareRepo}}
        Need to fill in some guide.
        {{else}}
        <div class="source-toolbar">
            {{ $username := .Username}}
            {{ $reponame := .Reponame}}
            {{ $branchname := .Branchname}}
            {{ $treenames := .Treenames}}
            {{ $repoLink := .RepositoryLink}}
            {{ $n := len $treenames}}
            <button class="btn btn-default pull-right"><i class="fa fa-plus-square"></i>Add File</button>
            <div class="dropdown branch-switch">
                <a href="#" class="btn btn-success dropdown-toggle" data-toggle="dropdown"><i class="fa fa-chain"></i>{{$branchname}}&nbsp;&nbsp;
                    <b class="caret"></b></a>
                <ul class="dropdown-menu">
                    {{range .Branches}}
                    <li><a {{if eq . $branchname}}class="current" {{end}}href="/{{$repoLink}}/tree/{{.}}">{{.}}</a></li>
                    {{end}}
                </ul>
            </div>
            {{$paths := .Paths}}
            {{ $l := Subtract $n 1}}
            <ol class="breadcrumb">
                <li class="root dir">
                    <a href="/{{$username}}/{{$reponame}}/tree/{{$branchname}}">{{.Repository.Name}}</a></li>
                {{range $i, $v := $treenames}}
                <li class="dir">
                    {{if eq $i $l}}{{$v}}
                    {{else}}
                    <a href="/{{$username}}/{{$reponame}}/tree/{{$branchname}}/{{index $paths $i}}">{{$v}}</a>&nbsp;
                    {{end}}
                </li>
                {{end}}
            </ol>
        </div>

        <div class="panel panel-default info-box">
            <div class="panel-heading info-head">
                <a href="/{{$username}}/{{$reponame}}/commit/{{.LatestCommit.SHA}}">{{.LatestCommit.Message}}</a>
            </div>
            <div class="panel-body info-content">
                <a href="/user/{{.LatestCommit.Author}}">{{.LatestCommit.Author}}</a> <span class="text-muted">{{TimeSince .LatestCommit.Date}}</span>
            </div>
            <table class="panel-footer table file-list">
                <thead class="hidden">
                <tr>
                    <th class="icon"></th>
                    <th class="name">Filename</th>
                    <th class="text">Message</th>
                    <th class="date">Date modified</th>
                </tr>
                </thead>
                <tbody>
                {{range .Files}}
                <tr
                {{if .IsDir}}class="is-dir"{{end}}>
                <td class="icon">
                    <i class="fa {{if .IsDir}}fa-folder{{else}}fa-file-text-o{{end}}"></i>
                </td>
                <td class="name">
                    <span class="wrap">
                        {{if .IsDir}}
                        <a href="/{{$username}}/{{$reponame}}/tree/{{$branchname}}/{{.Path}}">{{.Name}}</a>
                        {{else}}
                        <a href="/{{$username}}/{{$reponame}}/blob/{{$branchname}}/{{.Name}}">{{.Name}}</a>
                        {{end}}
                    </span>
                </td>
                <td class="text">
                    <span class="wrap"><a href="/{{$username}}/{{$reponame}}/commit/{{.LastCommit}}">{{.Message}}</a></span>
                </td>
                <td class="date">
                    <span class="wrap">{{TimeSince .Created}}</span>
                </td>
                </tr>
                {{end}}
                </tbody>
            </table>
        </div>
        {{if .ReadmeExist}}
        <div class="panel panel-default file-content">
            <div class="panel-heading file-head">
                <i class="icon fa fa-book"></i> README.md
            </div>
            {{if .FileIsLarge}}
                <div class="panel-footer">
                    Large file size 1000kb
                </div>
            {{else}}
                <div class="panel-body file-body markdown">
                    {{.ReadmeContent|str2html}}
                </div>
            {{end}}
        </div>
        {{end}}
        {{end}}
    </div>
</div>
{{template "base/footer" .}}