forked from tangled.org/core
Monorepo for Tangled — https://tangled.org

minor fixes and improvements

anirudh.fi d4b69dc9 5b0691ac

verified
Changed files
+28 -20
appview
db
pages
templates
state
+1 -1
appview/db/issues.go
···
func (d *DB) GetIssues(repoAt string) ([]Issue, error) {
var issues []Issue
-
rows, err := d.db.Query(`select owner_did, issue_id, created, title, body, open from issues where repo_at = ?`, repoAt)
+
rows, err := d.db.Query(`select owner_did, issue_id, created, title, body, open from issues where repo_at = ? order by created desc`, repoAt)
if err != nil {
return nil, err
}
+21 -15
appview/pages/templates/repo/commit.html
···
<div id="commit-message">
{{ $messageParts := splitN $commit.Message "\n\n" 2 }}
<div>
-
{{ index $messageParts 0 }}
+
<p class="pb-2">{{ index $messageParts 0 }}</p>
{{ if gt (len $messageParts) 1 }}
-
<p class="mt-1 cursor-text pb-2">{{ nl2br (unwrapText (index $messageParts 1)) }}</p>
+
<p class="mt-1 cursor-text pb-2 text-sm">{{ nl2br (unwrapText (index $messageParts 1)) }}</p>
{{ end }}
</div>
</div>
-
<p class="text-sm text-gray-500">
-
<a href="mailto:{{ $commit.Author.Email }}" class="no-underline hover:underline text-gray-500">{{ $commit.Author.Name }}</a>
-
<span class="px-1 select-none before:content-['\00B7']"></span>
-
{{ timeFmt $commit.Author.When }}
-
<span class="px-1 select-none before:content-['\00B7']"></span>
-
<span class="font-mono">{{ $stat.FilesChanged }}</span> files <span class="font-mono">(+{{ $stat.Insertions }}, -{{ $stat.Deletions }})</span>
-
<span class="px-1 select-none before:content-['\00B7']"></span>
-
<a href="/{{ $repo }}/commit/{{ $commit.This }}" class="no-underline hover:underline text-gray-500">{{ slice $commit.This 0 8 }}</a>
-
{{ if $commit.Parent }}
-
<span class="select-none">&LeftArrow;</span>
-
<a href="/{{ $repo }}/commit/{{ $commit.Parent }}" class="no-underline hover:underline text-gray-500">{{ slice $commit.Parent 0 8 }}</a>
-
{{ end }}
-
</p>
+
<div class="flex items-center">
+
<p class="text-sm text-gray-500">
+
<a href="mailto:{{ $commit.Author.Email }}" class="no-underline hover:underline text-gray-500">{{ $commit.Author.Name }}</a>
+
<span class="px-1 select-none before:content-['\00B7']"></span>
+
{{ timeFmt $commit.Author.When }}
+
<span class="px-1 select-none before:content-['\00B7']"></span>
+
<span class="font-mono">{{ $stat.FilesChanged }}</span> files <span class="font-mono">(+{{ $stat.Insertions }}, -{{ $stat.Deletions }})</span>
+
<span class="px-1 select-none before:content-['\00B7']"></span>
+
</p>
+
+
<p class="flex items-center text-sm text-gray-500">
+
<a href="/{{ $repo }}/commit/{{ $commit.This }}" class="no-underline hover:underline text-gray-500">{{ slice $commit.This 0 8 }}</a>
+
{{ if $commit.Parent }}
+
<i class="w-3 h-3 mx-1" data-lucide="arrow-left"></i>
+
<a href="/{{ $repo }}/commit/{{ $commit.Parent }}" class="no-underline hover:underline text-gray-500">{{ slice $commit.Parent 0 8 }}</a>
+
{{ end }}
+
</p>
+
</div>
+
<div class="diff-stat">
<br>
<strong>jump to</strong>
+2
appview/pages/templates/repo/issue.html
···
{{ end }}
<form
hx-post="/{{ .RepoInfo.FullName }}/issues/{{ .Issue.IssueId }}/{{ $action }}"
+
hx-swap="none"
class="mt-8"
>
<button type="submit" class="btn hover:bg-{{ $hoverColor }}-300">
···
></i>
<span class="text-black">{{ $action }}</span>
</button>
+
<div id="issue-action" class="error"></div>
</form>
{{ end }}
{{ end }}
+4 -4
appview/state/repo.go
···
issue, err := s.db.GetIssue(f.RepoAt, issueIdInt)
if err != nil {
log.Println("failed to get issue", err)
-
s.pages.Notice(w, "issues", "Failed to close issue. Try again later.")
+
s.pages.Notice(w, "issue-action", "Failed to close issue. Try again later.")
return
}
···
if err != nil {
log.Println("failed to update issue state", err)
-
s.pages.Notice(w, "issues", "Failed to close issue. Try again later.")
+
s.pages.Notice(w, "issue-action", "Failed to close issue. Try again later.")
return
}
err := s.db.CloseIssue(f.RepoAt, issueIdInt)
if err != nil {
log.Println("failed to close issue", err)
-
s.pages.Notice(w, "issues", "Failed to close issue. Try again later.")
+
s.pages.Notice(w, "issue-action", "Failed to close issue. Try again later.")
return
}
···
err := s.db.ReopenIssue(f.RepoAt, issueIdInt)
if err != nil {
log.Println("failed to reopen issue", err)
-
s.pages.Notice(w, "issues", "Failed to reopen issue. Try again later.")
+
s.pages.Notice(w, "issue-action", "Failed to reopen issue. Try again later.")
return
}
s.pages.HxLocation(w, fmt.Sprintf("/%s/issues/%d", f.OwnerSlashRepo(), issueIdInt))