Lucas Stadler лет назад: 8
Родитель
Сommit
091cc71ba9
1 измененных файлов с 61 добавлено и 2 удалено
  1. 61 2
      quit.go

+ 61 - 2
quit.go

23
		err = repoTmpl.Execute(buf, map[string]interface{}{
23
		err = repoTmpl.Execute(buf, map[string]interface{}{
24
			"RepoPath": "~/t/libgit2",
24
			"RepoPath": "~/t/libgit2",
25
			"Repo":     NewFancyRepo(repo),
25
			"Repo":     NewFancyRepo(repo),
26
			"Style":    template.CSS(repoStyle),
26
		})
27
		})
27
		if err != nil {
28
		if err != nil {
28
			log.Println("rendering repo: ", err)
29
			log.Println("rendering repo: ", err)
141
	<head>
142
	<head>
142
		<meta charset="utf-8" />
143
		<meta charset="utf-8" />
143
		<title>{{ .RepoPath }}</title>
144
		<title>{{ .RepoPath }}</title>
145
		<style>{{ .Style }}</style>
144
	</head>
146
	</head>
145
147
146
	<body>
148
	<body>
151
			<time class="commit-date">{{ .Repo.Commit.Date }}</time>
153
			<time class="commit-date">{{ .Repo.Commit.Date }}</time>
152
		</section>
154
		</section>
153
155
154
		<table class="files">
156
		<table id="files">
155
			{{ range $file := .Repo.Commit.Files }}
157
			{{ range $file := .Repo.Commit.Files }}
156
			<tr class="file">
158
			<tr class="file">
157
				<td class="file-type-{{ $file.Type }}">{{ $file.Name }}</td>
159
				<td class="file-name file-type-{{ $file.Type }}">{{ $file.Name }}</td>
158
			</tr>
160
			</tr>
159
			{{ end }}
161
			{{ end }}
160
	</body>
162
	</body>
161
</html>
163
</html>
162
`))
164
`))
165
166
var repoStyle = `
167
body {
168
  font-family: Arial, sans-serif;
169
}
170
171
#commit {
172
  display: flex;
173
  justify-content: space-between;
174
  align-items: baseline;
175
  padding: 0.6em 0.5em;
176
  width: 70vw;
177
  background-color: rgba(200, 0, 255, 0.15);
178
}
179
180
#commit .commit-author {
181
  font-weight: 600;
182
}
183
184
#commit .commit-id {
185
  font-family: monospace;
186
}
187
188
#files td {
189
  border: 1px solid #333;
190
  border-radius: 2px;
191
  margin-bottom: 0;
192
  padding: 0.2em 0.5em;
193
  font-size: 95%;
194
}
195
196
#files tr:hover {
197
  background-color: #efefef;
198
}
199
200
#files {
201
  width: 70vw;
202
}
203
204
.file-name {
205
  color: #00445a;
206
}
207
208
.file-type-blob:before {
209
  content:"🖹";
210
  padding-right: 0.5em;
211
}
212
213
.file-type-tree:before {
214
  content: "🗀";
215
  padding-right: 0.2em;
216
}
217
218
.file-type-tree:after {
219
  content: "/";
220
}
221
`