internal/web/templates/snippet.html

4a511e42574ead9c92dc73fd320f296cc4dbea07
gitbay/internal/web/templates/snippet.html

62 lines · 3789 bytes

 1{{define "title"}}{{if .Snippet.Description}}{{.Snippet.Description}}{{else}}{{.Snippet.PublicID}}{{end}} · {{.Owner}}{{end}}
 2{{define "content"}}
 3<div class="pagehead">
 4  <h1><a href="/{{.Owner}}">{{.Owner}}</a> / <a href="/{{.Owner}}/-/snippets">snippets</a> / {{.Snippet.PublicID}}</h1>
 5  <span class="grow"></span>
 6  <button type="button" class="btn" data-copy="gitbay snippet show {{.Snippet.PublicID}}">Copy CLI</button>
 7</div>
 8{{if .Snippet.Description}}<p class="desc lede">{{.Snippet.Description}}</p>{{end}}
 9<p class="meta"><span class="chip chip-neutral">{{.Snippet.Visibility}}</span> · updated {{when .Snippet.UpdatedAt}} · <code>gitbay snippet show {{.Snippet.PublicID}}</code></p>
10{{if .Notice}}<p class="error" role="alert">{{.Notice}}</p>{{end}}
11{{range .Files}}
12<section class="snippetfile setcard" id="file-{{.Name}}">
13<div class="pathbar">
14  <span class="crumbs"><strong>{{.Name}}</strong></span>
15  <span class="spacer"></span>
16  <div class="btngroup">
17    <a class="button btn" href="/{{$.Owner}}/-/snippets/{{$.Snippet.PublicID}}/raw/{{.Name}}">raw</a>
18    {{if $.CanWrite}}<details class="popover"><summary class="popbtn popbtn-danger">Remove</summary><div class="popmenu">
19      <form method="post" action="/{{$.Owner}}/-/snippets/{{$.Snippet.PublicID}}/file/remove" class="popform popform-stack">
20        <input type="hidden" name="name" value="{{.Name}}">
21        {{template "confirmfield" .Name}}
22        <button type="submit" class="danger">Remove {{.Name}}</button>
23      </form>
24    </div></details>{{end}}
25  </div>
26</div>
27<p class="filefacts">{{.Lines}} lines · {{.Size}} bytes</p>
28{{if .TooLarge}}<p class="empty-note">too large to render here — <a href="/{{$.Owner}}/-/snippets/{{$.Snippet.PublicID}}/raw/{{.Name}}">raw</a></p>{{else}}<div class="code">{{.HTML}}</div>{{end}}
29{{if $.CanWrite}}<details class="editbox"><summary>Edit {{.Name}}</summary>
30<form method="post" action="/{{$.Owner}}/-/snippets/{{$.Snippet.PublicID}}/file" class="commentform">
31<input type="hidden" name="name" value="{{.Name}}">
32<p><textarea name="content" aria-label="Content of {{.Name}}" rows="12">{{.Content}}</textarea></p>
33<p class="btngroup"><button type="submit">Save</button> <span class="meta">⌘↵ to save</span></p>
34</form>
35</details>{{end}}
36</section>
37{{end}}
38{{if .CanWrite}}
39<details class="editbox"><summary>Add a file</summary>
40<form method="post" action="/{{.Owner}}/-/snippets/{{.Snippet.PublicID}}/file" class="commentform">
41<p><input type="text" name="name" aria-label="File name" placeholder="filename" required autocomplete="off" spellcheck="false"></p>
42<p><textarea name="content" aria-label="Content" rows="12" required></textarea></p>
43<p><button type="submit">Add file</button></p>
44</form></details>
45<details class="editbox"><summary>Settings</summary>
46<form method="post" action="/{{.Owner}}/-/snippets/{{.Snippet.PublicID}}/edit" class="setform stack">
47<label for="snip-desc">Description</label>
48<input type="text" id="snip-desc" name="description" aria-label="Description" value="{{.Snippet.Description}}" placeholder="description">
49<label for="snip-vis">Visibility</label>
50<select id="snip-vis" name="visibility" aria-label="Visibility">
51<option value="public"{{if eq .Snippet.Visibility "public"}} selected{{end}}>public</option>
52<option value="unlisted"{{if eq .Snippet.Visibility "unlisted"}} selected{{end}}>unlisted</option>
53<option value="private"{{if eq .Snippet.Visibility "private"}} selected{{end}}>private</option>
54</select>
55<span class="btngroup"><button type="submit">Save</button></span>
56</form>
57<form method="post" action="/{{.Owner}}/-/snippets/{{.Snippet.PublicID}}/delete">
58<p>{{template "confirmfield" .Snippet.PublicID}} <button type="submit" class="danger">Delete snippet</button></p>
59</form>
60</details>
61{{end}}
62{{end}}
Keyboard shortcuts

Global

⌘K
Command palette & jump
/
Focus search
?
Show this help
g d
Dashboard
g e
Explore repositories
g n
Notifications

Repository & editor

t
Find file in repository
y
Copy immutable SHA permalink
g c
Code tab
g i
Issues tab
g m
Merge requests tab
g b
Builds tab
⌘↵
Submit active form