Add clone button in repos
8e89a1ba47f53e1ad3a3a61fd9c5d2b13cfcc867
1 parent
99b2731a
handler.go
+2 -0
| 140 | 140 | Readme *BlobInfo |
|
| 141 | 141 | LastCommit *CommitInfo |
|
| 142 | 142 | ActiveBlob *BlobInfo |
|
| 143 | 143 | ActivePath string |
|
| 144 | 144 | IsEmpty bool |
|
| 145 | + | CloneURL string |
|
| 145 | 146 | } |
|
| 146 | 147 | ||
| 147 | 148 | func (s *server) handleSummary(w http.ResponseWriter, r *http.Request, repo *RepoInfo) { |
|
| 148 | 149 | s.renderHome(w, repo, "", nil, "") |
|
| 149 | 150 | } |
| 184 | 185 | Tree: tree, |
|
| 185 | 186 | Readme: readme, |
|
| 186 | 187 | LastCommit: lastCommit, |
|
| 187 | 188 | ActiveBlob: blob, |
|
| 188 | 189 | ActivePath: activePath, |
|
| 190 | + | CloneURL: "git@radiant.computer:radiant/" + repo.Name + ".git", |
|
| 189 | 191 | } |
|
| 190 | 192 | s.tmpl.render(w, "home", pd) |
|
| 191 | 193 | } |
|
| 192 | 194 | ||
| 193 | 195 | func (s *server) handleLog(w http.ResponseWriter, r *http.Request, repo *RepoInfo, rest string) { |
static/style.css
+72 -0
| 524 | 524 | display: flex; |
|
| 525 | 525 | align-items: center; |
|
| 526 | 526 | } |
|
| 527 | 527 | .view-nav .last-commit { |
|
| 528 | 528 | margin-left: auto; |
|
| 529 | + | margin-right: 1rem; |
|
| 530 | + | text-align: right; |
|
| 529 | 531 | } |
|
| 530 | 532 | .view-nav .branch-selector { |
|
| 531 | 533 | margin-right: 1.5rem; |
|
| 532 | 534 | } |
|
| 533 | 535 |
| 594 | 596 | .branch-selector li.active a { |
|
| 595 | 597 | background: var(--bg-alt); |
|
| 596 | 598 | font-weight: 600; |
|
| 597 | 599 | } |
|
| 598 | 600 | ||
| 601 | + | /* --- Clone selector --- */ |
|
| 602 | + | ||
| 603 | + | .clone-selector { |
|
| 604 | + | position: relative; |
|
| 605 | + | } |
|
| 606 | + | .clone-selector summary { |
|
| 607 | + | display: flex; |
|
| 608 | + | align-items: center; |
|
| 609 | + | gap: 0.5rem; |
|
| 610 | + | border: 1px solid var(--border); |
|
| 611 | + | border-radius: 4px; |
|
| 612 | + | padding: 0.25rem 0.75rem; |
|
| 613 | + | font-size: 0.875rem; |
|
| 614 | + | cursor: pointer; |
|
| 615 | + | list-style: none; |
|
| 616 | + | } |
|
| 617 | + | .clone-selector summary:hover { |
|
| 618 | + | background: var(--bg-alt); |
|
| 619 | + | } |
|
| 620 | + | .clone-selector summary::-webkit-details-marker { display: none; } |
|
| 621 | + | .clone-selector summary::after { |
|
| 622 | + | content: ""; |
|
| 623 | + | flex-shrink: 0; |
|
| 624 | + | margin-left: auto; |
|
| 625 | + | width: 0; |
|
| 626 | + | height: 0; |
|
| 627 | + | border-left: 4px solid transparent; |
|
| 628 | + | border-right: 4px solid transparent; |
|
| 629 | + | border-top: 5px solid var(--fg-dim); |
|
| 630 | + | } |
|
| 631 | + | .clone-selector[open] summary::after { |
|
| 632 | + | border-top: none; |
|
| 633 | + | border-bottom: 5px solid var(--fg-dim); |
|
| 634 | + | } |
|
| 635 | + | .clone-dropdown { |
|
| 636 | + | position: absolute; |
|
| 637 | + | right: 0; |
|
| 638 | + | z-index: 10; |
|
| 639 | + | background: var(--bg); |
|
| 640 | + | border: 1px solid var(--border); |
|
| 641 | + | border-radius: 4px; |
|
| 642 | + | margin-top: 0.25rem; |
|
| 643 | + | padding: 0.5rem; |
|
| 644 | + | } |
|
| 645 | + | .clone-dropdown label { |
|
| 646 | + | display: block; |
|
| 647 | + | font-size: 0.875rem; |
|
| 648 | + | color: var(--fg-dim); |
|
| 649 | + | margin: 0.25rem 0 0.5rem; |
|
| 650 | + | } |
|
| 651 | + | .clone-dropdown input { |
|
| 652 | + | font-family: var(--mono); |
|
| 653 | + | font-size: 0.875rem; |
|
| 654 | + | padding: 0.25rem 0.5rem; |
|
| 655 | + | border: 1px solid var(--border); |
|
| 656 | + | border-radius: 4px; |
|
| 657 | + | background: var(--bg-alt); |
|
| 658 | + | color: var(--fg); |
|
| 659 | + | width: 24rem; |
|
| 660 | + | outline: none; |
|
| 661 | + | } |
|
| 662 | + | .clone-dropdown input:focus { |
|
| 663 | + | border-color: var(--fg); |
|
| 664 | + | } |
|
| 665 | + | ||
| 599 | 666 | /* --- File tree --- */ |
|
| 600 | 667 | ||
| 601 | 668 | .tree-entry { |
|
| 602 | 669 | display: flex; |
|
| 603 | 670 | align-items: baseline; |
| 647 | 714 | border-top: 1px solid var(--border); |
|
| 648 | 715 | font-size: 1rem; |
|
| 649 | 716 | color: var(--fg-dim); |
|
| 650 | 717 | } |
|
| 651 | 718 | ||
| 719 | + | footer p { |
|
| 720 | + | display: flex; |
|
| 721 | + | justify-content: space-between; |
|
| 722 | + | } |
|
| 723 | + | ||
| 652 | 724 | /* --- Syntax highlighting (Radiance) --- */ |
|
| 653 | 725 | ||
| 654 | 726 | .language-radiance .comment { color: var(--color-dimmer); font-style: italic; } |
|
| 655 | 727 | .language-radiance .builtin { color: var(--color-secondary); } |
|
| 656 | 728 | .language-radiance .op { color: var(--color-dim); } |
templates/home.html
+7 -0
| 18 | 18 | <span class="subject">{{.Data.LastCommit.Subject}}</span> |
|
| 19 | 19 | <span class="author">{{.Data.LastCommit.Author}}</span> |
|
| 20 | 20 | <span class="date">{{timeAgo .Data.LastCommit.AuthorDate}} ago</span> |
|
| 21 | 21 | </div> |
|
| 22 | 22 | {{end}} |
|
| 23 | + | <details class="clone-selector"> |
|
| 24 | + | <summary>Clone</summary> |
|
| 25 | + | <div class="clone-dropdown"> |
|
| 26 | + | <label>SSH</label> |
|
| 27 | + | <input type="text" value="{{.Data.CloneURL}}" readonly> |
|
| 28 | + | </div> |
|
| 29 | + | </details> |
|
| 23 | 30 | </nav> |
|
| 24 | 31 | ||
| 25 | 32 | <div class="repo-home"> |
|
| 26 | 33 | <div class="file-tree"> |
|
| 27 | 34 | {{range .Data.Tree}} |