blob: e62e68ad78a4c2a91ff0a9f58a2c5db3314e8fcb (
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
|
{% import "git.gabrielgio.me/cerrado/pkg/humanize" %}
{% import "git.gabrielgio.me/cerrado/pkg/service" %}
{% import "context" %}
{% import "strings" %}
{% code
type GitListPage struct {
Respositories []*service.Repository
About []byte
}
%}
{% code func firstLine(text string) string {
lines := strings.Split(text, "\n")
if len(lines) > 0 {
return lines[0]
}
return ""
}
%}
{% func (p *GitListPage) Title(ctx context.Context) %}Git | List{% endfunc %}
{% func (p *GitListPage) Navbar(ctx context.Context) %}{%= Navbar(ctx, Git) %}{% endfunc %}
{% func (p *GitListPage) Content(ctx context.Context) %}
<div class="row">
<div class="col-md-6 order-last order-md-first">
<div class="event-list">
{% for _, r := range p.Respositories %}
<div class="event">
<div class="row">
<div class="col-md">
<a href="/{%s r.Name %}/">{%s r.Name %}</a>
</div>
<div class="col-md text-md-end">
<small>{% if !r.Public %}private{% endif %}</small>
</div>
</div>
</hr>
<p>{%s r.Description %}</p>
<div class="event-commit row">
<a class="col-xl-2" title="{%s r.LastCommit.Commit().Hash.String() %}" href="/{%s r.Name %}/commit/{%s r.LastCommit.Commit().Hash.String() %}/">{%s r.LastCommit.Commit().Hash.String()[0:8] %}</a>
<a class="col-xl-7"> {%s firstLine(r.LastCommit.Commit().Message) %}</a>
<a class="col-xl-3" title="{%s r.LastCommit.Commit().Author.When.UTC().Format("2006-01-02 15:04:05")%} UTC">{%s humanize.Time(r.LastCommit.Commit().Author.When) %}</a>
</div>
<p>
<a href="/{%s r.Name %}/log/{%s r.Ref %}/">log</a>
<a href="/{%s r.Name %}/tree/{%s r.Ref %}/">tree</a>
<a href="/{%s r.Name %}/refs/">refs</a>
</p>
</div>
{% endfor %}
</div>
</div>
<div id="about" class="col-md-4 order-first order-md-last">
{%z= p.About %}
<div class="alert alert-warning text-center" role="alert">
This project is under development, things may be broken or incomplete.
</div>
</div>
</div>
{% endfunc %}
{% func (p *GitListPage) Script(ctx context.Context) %}
{% endfunc %}
|