SPB Git

spb/spbgit Public MIT

SPB Git — the platform hosting itself

JavaScript 73.9% CSS 11.7% Nunjucks 11.6% Shell 2.7%
3.0 KB · 58 lines jinja
Raw Blame History
1{#2  ─────────────────────────────────────────────3   SPB Git — Personal Git Platform4  ─────────────────────────────────────────────5   Author  : Simon-Pierre Boucher6   Contact : contact@spboucher.ai7   File    : src/web/views/repo.njk8   Purpose : Repo home — clone box, file table, rendered README9   License : MIT © Simon-Pierre Boucher10  ─────────────────────────────────────────────11#}{% extends "layout.njk" %}12{% block content %}13{% include "partials/repo-header.njk" %}1415{% if overview.empty %}16<div class="empty-repo">17  <h2>This repository is empty</h2>18  <p>Push something to bring it to life:</p>19  <pre class="clone-snippet">git remote add origin {{ overview.cloneUrl }}20git push -u origin {{ overview.defaultBranch }}</pre>21  <p class="muted">or, from anywhere: <code>spbgit clone {{ overview.name }}</code></p>22</div>23{% else %}2425<div class="repo-toolbar">26  <div class="ref-select-wrap">27    <label class="sr-only" for="ref-select">Branch</label>28    <select id="ref-select" class="ref-select" data-repo="{{ overview.name }}" data-kind="tree">29      {% for branch in branches %}30      <option value="{{ branch.name }}" {{ 'selected' if branch.name == currentRef }}>{{ branch.name }}{{ ' (default)' if branch.isDefault }}</option>31      {% endfor %}32      {% for tag in tags %}33      <option value="{{ tag.name }}" {{ 'selected' if tag.name == currentRef }}>tag: {{ tag.name }}</option>34      {% endfor %}35    </select>36  </div>37  <div class="clone-box">38    <input class="clone-url" type="text" readonly value="{{ overview.cloneUrl }}" aria-label="Clone URL">39    <button class="btn copy-btn" type="button" data-copy="{{ overview.cloneUrl }}" title="Copy clone URL">Copy</button>40    <button class="btn copy-btn" type="button" data-copy="spbgit clone {{ overview.name }}" title="Copy spbgit command">spbgit</button>41    <a class="btn" href="/archive/{{ overview.name }}/{{ currentRef }}.zip" rel="nofollow">ZIP</a>42  </div>43</div>4445{% include "partials/file-table.njk" %}4647{% if readme %}48<section class="readme-section" aria-label="README">49  <div class="readme-header">50    <svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path d="M0 1.75A.75.75 0 0 1 .75 1h4.253c1.227 0 2.317.59 3 1.501A3.743 3.743 0 0 1 11.006 1h4.245a.75.75 0 0 1 .75.75v10.5a.75.75 0 0 1-.75.75h-4.507a2.25 2.25 0 0 0-1.591.659l-.622.621a.75.75 0 0 1-1.06 0l-.622-.621A2.25 2.25 0 0 0 5.258 13H.75a.75.75 0 0 1-.75-.75Zm7.251 10.324.004-5.073-.002-2.253A2.25 2.25 0 0 0 5.003 2.5H1.5v9h3.757a3.75 3.75 0 0 1 1.994.574M8.755 4.75l-.004 7.322a3.752 3.752 0 0 1 1.992-.572H14.5v-9h-3.495a2.25 2.25 0 0 0-2.25 2.25"/></svg>51    <code>{{ readme.path }}</code>52  </div>53  <article class="markdown-body">{{ readme.html | safe }}</article>54</section>55{% endif %}56{% endif %}57{% endblock %}58