forked from tangled.org/core
Monorepo for Tangled

minor fixes and improvements

anirudh.fi d4b69dc9 5b0691ac

verified
Changed files
+28 -20
appview
db
pages
templates
state
+1 -1
appview/db/issues.go
··· 95 95 func (d *DB) GetIssues(repoAt string) ([]Issue, error) { 96 96 var issues []Issue 97 97 98 - rows, err := d.db.Query(`select owner_did, issue_id, created, title, body, open from issues where repo_at = ?`, repoAt) 98 + rows, err := d.db.Query(`select owner_did, issue_id, created, title, body, open from issues where repo_at = ? order by created desc`, repoAt) 99 99 if err != nil { 100 100 return nil, err 101 101 }
+21 -15
appview/pages/templates/repo/commit.html
··· 11 11 <div id="commit-message"> 12 12 {{ $messageParts := splitN $commit.Message "\n\n" 2 }} 13 13 <div> 14 - {{ index $messageParts 0 }} 14 + <p class="pb-2">{{ index $messageParts 0 }}</p> 15 15 {{ if gt (len $messageParts) 1 }} 16 - <p class="mt-1 cursor-text pb-2">{{ nl2br (unwrapText (index $messageParts 1)) }}</p> 16 + <p class="mt-1 cursor-text pb-2 text-sm">{{ nl2br (unwrapText (index $messageParts 1)) }}</p> 17 17 {{ end }} 18 18 </div> 19 19 </div> 20 20 21 - <p class="text-sm text-gray-500"> 22 - <a href="mailto:{{ $commit.Author.Email }}" class="no-underline hover:underline text-gray-500">{{ $commit.Author.Name }}</a> 23 - <span class="px-1 select-none before:content-['\00B7']"></span> 24 - {{ timeFmt $commit.Author.When }} 25 - <span class="px-1 select-none before:content-['\00B7']"></span> 26 - <span class="font-mono">{{ $stat.FilesChanged }}</span> files <span class="font-mono">(+{{ $stat.Insertions }}, -{{ $stat.Deletions }})</span> 27 - <span class="px-1 select-none before:content-['\00B7']"></span> 28 - <a href="/{{ $repo }}/commit/{{ $commit.This }}" class="no-underline hover:underline text-gray-500">{{ slice $commit.This 0 8 }}</a> 29 - {{ if $commit.Parent }} 30 - <span class="select-none">&LeftArrow;</span> 31 - <a href="/{{ $repo }}/commit/{{ $commit.Parent }}" class="no-underline hover:underline text-gray-500">{{ slice $commit.Parent 0 8 }}</a> 32 - {{ end }} 33 - </p> 21 + <div class="flex items-center"> 22 + <p class="text-sm text-gray-500"> 23 + <a href="mailto:{{ $commit.Author.Email }}" class="no-underline hover:underline text-gray-500">{{ $commit.Author.Name }}</a> 24 + <span class="px-1 select-none before:content-['\00B7']"></span> 25 + {{ timeFmt $commit.Author.When }} 26 + <span class="px-1 select-none before:content-['\00B7']"></span> 27 + <span class="font-mono">{{ $stat.FilesChanged }}</span> files <span class="font-mono">(+{{ $stat.Insertions }}, -{{ $stat.Deletions }})</span> 28 + <span class="px-1 select-none before:content-['\00B7']"></span> 29 + </p> 30 + 31 + <p class="flex items-center text-sm text-gray-500"> 32 + <a href="/{{ $repo }}/commit/{{ $commit.This }}" class="no-underline hover:underline text-gray-500">{{ slice $commit.This 0 8 }}</a> 33 + {{ if $commit.Parent }} 34 + <i class="w-3 h-3 mx-1" data-lucide="arrow-left"></i> 35 + <a href="/{{ $repo }}/commit/{{ $commit.Parent }}" class="no-underline hover:underline text-gray-500">{{ slice $commit.Parent 0 8 }}</a> 36 + {{ end }} 37 + </p> 38 + </div> 39 + 34 40 <div class="diff-stat"> 35 41 <br> 36 42 <strong>jump to</strong>
+2
appview/pages/templates/repo/issue.html
··· 93 93 {{ end }} 94 94 <form 95 95 hx-post="/{{ .RepoInfo.FullName }}/issues/{{ .Issue.IssueId }}/{{ $action }}" 96 + hx-swap="none" 96 97 class="mt-8" 97 98 > 98 99 <button type="submit" class="btn hover:bg-{{ $hoverColor }}-300"> ··· 102 103 ></i> 103 104 <span class="text-black">{{ $action }}</span> 104 105 </button> 106 + <div id="issue-action" class="error"></div> 105 107 </form> 106 108 {{ end }} 107 109 {{ end }}
+4 -4
appview/state/repo.go
··· 572 572 issue, err := s.db.GetIssue(f.RepoAt, issueIdInt) 573 573 if err != nil { 574 574 log.Println("failed to get issue", err) 575 - s.pages.Notice(w, "issues", "Failed to close issue. Try again later.") 575 + s.pages.Notice(w, "issue-action", "Failed to close issue. Try again later.") 576 576 return 577 577 } 578 578 ··· 596 596 597 597 if err != nil { 598 598 log.Println("failed to update issue state", err) 599 - s.pages.Notice(w, "issues", "Failed to close issue. Try again later.") 599 + s.pages.Notice(w, "issue-action", "Failed to close issue. Try again later.") 600 600 return 601 601 } 602 602 603 603 err := s.db.CloseIssue(f.RepoAt, issueIdInt) 604 604 if err != nil { 605 605 log.Println("failed to close issue", err) 606 - s.pages.Notice(w, "issues", "Failed to close issue. Try again later.") 606 + s.pages.Notice(w, "issue-action", "Failed to close issue. Try again later.") 607 607 return 608 608 } 609 609 ··· 636 636 err := s.db.ReopenIssue(f.RepoAt, issueIdInt) 637 637 if err != nil { 638 638 log.Println("failed to reopen issue", err) 639 - s.pages.Notice(w, "issues", "Failed to reopen issue. Try again later.") 639 + s.pages.Notice(w, "issue-action", "Failed to reopen issue. Try again later.") 640 640 return 641 641 } 642 642 s.pages.HxLocation(w, fmt.Sprintf("/%s/issues/%d", f.OwnerSlashRepo(), issueIdInt))