templates/file.html
4.5 KB
| 1 | {{define "title"}}{{.Path}} · {{.Repo.Name}}{{end}} |
| 2 | {{define "content"}} |
| 3 | <div class="repo-topline"> |
| 4 | <a class="repo-topline-link" href="/{{.Repo.CloneURL}}"> |
| 5 | <svg class="octicon" width="16" height="16" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"> |
| 6 | <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8ZM5 12.25a.25.25 0 0 1 .25-.25h3.5a.25.25 0 0 1 .25.25v3.25a.25.25 0 0 1-.4.2l-1.45-1.087a.249.249 0 0 0-.3 0L5.4 15.7a.25.25 0 0 1-.4-.2Z"/> |
| 7 | </svg> |
| 8 | <span class="repo-topline-owner">{{.Repo.Owner.Username}}</span> |
| 9 | <span class="repo-topline-sep">/</span> |
| 10 | <strong class="repo-topline-name">{{.Repo.Name}}</strong> |
| 11 | </a> |
| 12 | {{if .Repo.IsPrivate}} |
| 13 | <span class="badge badge-outline">Private</span> |
| 14 | {{else}} |
| 15 | <span class="badge badge-outline">Public</span> |
| 16 | {{end}} |
| 17 | <div class="toolbar-spacer"></div> |
| 18 | <a class="btn btn-sm" href="/{{.Repo.CloneURL}}?branch={{.Branch | urlquery}}"> |
| 19 | <svg class="octicon" width="16" height="16" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path d="M7.78 12.53a.75.75 0 0 1-1.06 0L2.47 8.28a.75.75 0 0 1 0-1.06l4.25-4.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042L4.81 7h7.44a.75.75 0 0 1 0 1.5H4.81l2.97 2.97a.75.75 0 0 1 0 1.06Z"/></svg> |
| 20 | К репозиторию |
| 21 | </a> |
| 22 | </div> |
| 23 | |
| 24 | <nav class="repo-tabs" aria-label="Разделы репозитория"> |
| 25 | <a class="active" href="/{{.Repo.CloneURL}}?branch={{.Branch | urlquery}}"> |
| 26 | <svg class="octicon" width="16" height="16" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path d="m11.28 3.22 4.25 4.25a.75.75 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734L13.94 8l-3.72-3.72a.749.749 0 0 1 .326-1.275.749.749 0 0 1 .734.215Zm-6.56 0a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042L2.06 8l3.72 3.72a.749.749 0 1 1-1.06 1.06L.47 8.53a.75.75 0 0 1 0-1.06Z"/></svg> |
| 27 | Code |
| 28 | </a> |
| 29 | <a href="/builds?repo={{.Repo.CloneURL}}"> |
| 30 | <svg class="octicon" width="16" height="16" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Zm4.879-2.773 4.264 2.559a.25.25 0 0 1 0 .428l-4.264 2.559A.25.25 0 0 1 6 10.559V5.442a.25.25 0 0 1 .379-.215Z"/></svg> |
| 31 | Actions |
| 32 | </a> |
| 33 | <a href="/{{.Repo.CloneURL}}/releases"> |
| 34 | <svg class="octicon" width="16" height="16" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path d="M8 16A8 8 0 1 1 8 0a8 8 0 0 1 0 16ZM4.5 8.5l2.5 2.5 4.5-4.5a1 1 0 0 0-1.414-1.414L6.99 8.172 5.914 7.086A1 1 0 0 0 4.5 8.5Z"/></svg> |
| 35 | Releases |
| 36 | </a> |
| 37 | </nav> |
| 38 | |
| 39 | <div class="file-view-toolbar"> |
| 40 | <div class="breadcrumb"> |
| 41 | <a href="/{{.Repo.CloneURL}}?branch={{.Branch | urlquery}}">{{.Repo.Name}}</a> |
| 42 | {{range .Crumbs}} |
| 43 | <span class="sep">/</span> |
| 44 | {{if eq .Path $.Path}} |
| 45 | <span>{{.Name}}</span> |
| 46 | {{else}} |
| 47 | <a href="/{{$.Repo.CloneURL}}?branch={{$.Branch | urlquery}}&path={{.Path | urlquery}}">{{.Name}}</a> |
| 48 | {{end}} |
| 49 | {{end}} |
| 50 | </div> |
| 51 | <div class="toolbar-spacer"></div> |
| 52 | <span class="text-small muted">{{.FileSize}}</span> |
| 53 | </div> |
| 54 | |
| 55 | <div class="box file-view"> |
| 56 | <div class="file-box-header"> |
| 57 | <div class="file-box-path"> |
| 58 | <svg class="octicon" width="16" height="16" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688l-.011-.013-2.914-2.914-.013-.011Z"/></svg> |
| 59 | {{.Path}} |
| 60 | </div> |
| 61 | <div class="file-box-actions"> |
| 62 | <span class="text-small muted">{{.FileSize}}</span> |
| 63 | </div> |
| 64 | </div> |
| 65 | <div class="blob-wrapper"> |
| 66 | {{numberedCode .Content}} |
| 67 | </div> |
| 68 | </div> |
| 69 | |
| 70 | {{if .LangClass}} |
| 71 | <link rel="stylesheet" href="/static/css/hljs-github-dark.min.css"> |
| 72 | <script src="/static/js/highlight.min.js"></script> |
| 73 | <script> |
| 74 | document.querySelectorAll(".blob-code-inner").forEach(function (cell) { |
| 75 | var code = document.createElement("code"); |
| 76 | code.className = "{{.LangClass}}"; |
| 77 | code.textContent = cell.textContent; |
| 78 | hljs.highlightElement(code); |
| 79 | cell.innerHTML = code.innerHTML; |
| 80 | if (code.children.length) { |
| 81 | cell.classList.add("hljs-highlighted"); |
| 82 | } |
| 83 | }); |
| 84 | </script> |
| 85 | {{end}} |
| 86 | {{end}} |