pastebin / templates /view.html
Akay Borana
Initial upload
421b222
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{.title}}</title>
<meta name="description" content="{{if .paste.Title}}{{.paste.Title}}{{else}}Untitled{{end}} - View paste on Patbin">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/themes/prism-tomorrow.min.css" rel="stylesheet">
<link href="/static/css/style.css" rel="stylesheet">
</head>
<body>
<nav class="navbar">
<div class="container">
<a href="/" class="logo">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/>
<polyline points="14 2 14 8 20 8"/>
<line x1="16" y1="13" x2="8" y2="13"/>
<line x1="16" y1="17" x2="8" y2="17"/>
<polyline points="10 9 9 9 8 9"/>
</svg>
Patbin
</a>
<div class="nav-links">
<button class="theme-toggle" onclick="toggleTheme()" title="Toggle theme">
<svg class="sun" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="12" cy="12" r="5"/>
<line x1="12" y1="1" x2="12" y2="3"/>
<line x1="12" y1="21" x2="12" y2="23"/>
<line x1="4.22" y1="4.22" x2="5.64" y2="5.64"/>
<line x1="18.36" y1="18.36" x2="19.78" y2="19.78"/>
<line x1="1" y1="12" x2="3" y2="12"/>
<line x1="21" y1="12" x2="23" y2="12"/>
<line x1="4.22" y1="19.78" x2="5.64" y2="18.36"/>
<line x1="18.36" y1="5.64" x2="19.78" y2="4.22"/>
</svg>
<svg class="moon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/>
</svg>
</button>
<a href="/" class="btn btn-primary">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M12 5v14M5 12h14"/>
</svg>
New Paste
</a>
</div>
</div>
</nav>
<main class="page">
<div class="container">
<div class="code-container">
<div class="code-header">
<div class="code-title">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<polyline points="16 18 22 12 16 6"/>
<polyline points="8 6 2 12 8 18"/>
</svg>
{{if .paste.Title}}{{.paste.Title}}{{else}}Untitled{{end}}
{{if not .paste.IsPublic}}
<span class="paste-badge private">
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<rect x="3" y="11" width="18" height="11" rx="2" ry="2"/>
<path d="M7 11V7a5 5 0 0 1 10 0v4"/>
</svg>
Private
</span>
{{end}}
</div>
<div class="code-meta">
<span title="Language">{{.language}}</span>
<span title="Lines">{{.lines}} lines</span>
<span title="Views">{{.paste.Views}} views</span>
<span title="Created">{{formatTime .paste.CreatedAt}}</span>
{{if .paste.User}}
<a href="/u/{{.paste.User.Username}}" style="color: inherit">by {{.paste.User.Username}}</a>
{{end}}
</div>
</div>
<div class="code-actions">
<button class="btn btn-secondary btn-sm" onclick="copyToClipboard(document.getElementById('paste-content').textContent, this)">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"/>
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/>
</svg>
Copy
</button>
<button class="btn btn-secondary btn-sm" id="wrap-toggle" onclick="toggleWrap()">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M3 6h18M3 12h15a3 3 0 110 6h-6"/>
<polyline points="10 15 7 18 10 21"/>
</svg>
Wrap
</button>
<a href="/{{.paste.ID}}/raw" class="btn btn-secondary btn-sm" target="_blank">Raw</a>
<button class="btn btn-secondary btn-sm" id="fork-paste" data-paste-id="{{.paste.ID}}">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="12" cy="18" r="3"/>
<circle cx="6" cy="6" r="3"/>
<circle cx="18" cy="6" r="3"/>
<path d="M18 9v1a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2V9"/>
<path d="M12 12v3"/>
</svg>
Fork
</button>
{{if .isOwner}}
<a href="/{{.paste.ID}}/edit" class="btn btn-secondary btn-sm">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/>
<path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/>
</svg>
Edit
</a>
<button class="btn btn-danger btn-sm" id="delete-paste" data-paste-id="{{.paste.ID}}">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<polyline points="3 6 5 6 21 6"/>
<path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/>
</svg>
Delete
</button>
{{end}}
</div>
<div class="code-body">
<div class="line-numbers">
{{range $i := iterate .lines}}
<span>{{add $i 1}}</span>
{{end}}
</div>
<div class="code-content">
<pre><code id="paste-content" class="language-{{.language}}">{{.paste.Content}}</code></pre>
</div>
</div>
</div>
</div>
</main>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/prism.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/plugins/autoloader/prism-autoloader.min.js"></script>
<script src="/static/js/app.js"></script>
<script>
// Re-highlight after page load
Prism.highlightAll();
</script>
</body>
</html>