Skip to content

Commit 3b4bcba

Browse files
committed
fix
1 parent c2fa157 commit 3b4bcba

File tree

17 files changed

+255
-108
lines changed

17 files changed

+255
-108
lines changed

eslint.config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,6 @@ export default defineConfig([
575575
'no-restricted-imports': [2, {paths: [
576576
{name: 'jquery', message: 'Use the global $ instead', allowTypeImports: true},
577577
{name: 'htmx.org', message: 'Use the global htmx instead', allowTypeImports: true},
578-
{name: 'idiomorph/htmx', message: 'Loaded in globals.ts', allowTypeImports: true},
579578
]}],
580579
'no-restricted-syntax': [2, 'WithStatement', 'ForInStatement', 'LabeledStatement', 'SequenceExpression'],
581580
'no-return-assign': [0],

routers/web/repo/star.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,5 @@ func ActionStar(ctx *context.Context) {
2626
ctx.ServerError("GetRepositoryByName", err)
2727
return
2828
}
29-
ctx.RespHeader().Add("hx-trigger", "refreshUserCards") // see the `hx-trigger="refreshUserCards ..."` comments in tmpl
3029
ctx.HTML(http.StatusOK, tplStarUnstar)
3130
}

routers/web/repo/view.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,9 @@ func renderDirectoryFiles(ctx *context.Context, timeout time.Duration) git.Entri
316316
clearFilesCommitInfo := func() {
317317
log.Warn("clear directory file commit info to force async loading on frontend")
318318
for i := range files {
319-
files[i].Commit = nil
319+
if i%2 == 0 {
320+
files[i].Commit = nil
321+
}
320322
}
321323
}
322324
_ = clearFilesCommitInfo

routers/web/repo/watch.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,5 @@ func ActionWatch(ctx *context.Context) {
2626
ctx.ServerError("GetRepositoryByName", err)
2727
return
2828
}
29-
ctx.RespHeader().Add("hx-trigger", "refreshUserCards") // see the `hx-trigger="refreshUserCards ..."` comments in tmpl
3029
ctx.HTML(http.StatusOK, tplWatchUnwatch)
3130
}

routers/web/web.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1710,7 +1710,7 @@ func registerWebRoutes(m *web.Router, webAuth *AuthMiddleware) {
17101710

17111711
m.Get("/forks", repo.Forks)
17121712
m.Get("/commit/{sha:([a-f0-9]{7,64})}.{ext:patch|diff}", repo.MustBeNotEmpty, repo.RawDiff)
1713-
m.Post("/lastcommit/*", context.RepoRefByType(git.RefTypeCommit), repo.LastCommit)
1713+
m.Get("/lastcommit/*", context.RepoRefByType(git.RefTypeCommit), repo.LastCommit)
17141714
}, optSignIn, context.RepoAssignment, reqUnitCodeReader)
17151715
// end "/{username}/{reponame}": repo code
17161716

templates/admin/dashboard.tmpl

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,7 @@
7676
</h4>
7777
{{/* TODO: make these stats work in multi-server deployments, likely needs per-server stats in DB */}}
7878
<div class="ui attached table segment">
79-
<div class="no-loading-indicator tw-hidden"></div>
80-
<div hx-get="{{$.Link}}/system_status" hx-swap="morph:innerHTML" hx-trigger="every 5s" hx-indicator=".no-loading-indicator">
81-
{{template "admin/system_status" .}}
82-
</div>
79+
{{template "admin/system_status" .}}
8380
</div>
8481
</div>
8582
{{template "admin/layout_footer" .}}

templates/admin/system_status.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<dl class="admin-dl-horizontal">
1+
<dl class="admin-dl-horizontal" data-url="{{AppSubUrl}}/-/admin/system_status" data-fetch-sync="$idiomorph" data-fetch-trigger="every 5s">
22
<dt>{{ctx.Locale.Tr "admin.dashboard.server_uptime"}}</dt>
33
<dd><relative-time format="duration" datetime="{{.SysStatus.StartTime}}">{{.SysStatus.StartTime}}</relative-time></dd>
44
<dt>{{ctx.Locale.Tr "admin.dashboard.current_goroutine"}}</dt>

templates/base/head.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
{{template "base/head_script" .}}
2424
{{template "custom/header" .}}
2525
</head>
26-
<body hx-swap="outerHTML" hx-ext="morph" hx-push-url="false">
26+
<body hx-swap="outerHTML" hx-push-url="false">
2727
{{template "custom/body_outer_pre" .}}
2828

2929
<div class="full height">

templates/projects/view.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@
108108
>
109109
{{svg "octicon-star"}} {{ctx.Locale.Tr "repo.projects.column.set_default"}}
110110
</a>
111-
<a class="item button link-action" data-url="{{$.Link}}/{{.ID}}" data-link-action-method="DELETE"
111+
<a class="item button link-action" data-url="{{$.Link}}/{{.ID}}" data-fetch-action-method="DELETE"
112112
data-modal-confirm-header="{{ctx.Locale.Tr "repo.projects.column.delete"}}"
113113
data-modal-confirm-content="{{ctx.Locale.Tr "repo.projects.column.deletion_desc"}}"
114114
>

templates/repo/star_unstar.tmpl

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
1-
<form class="flex-text-inline" hx-boost="true" hx-target="this" method="post" action="{{$.RepoLink}}/action/{{if $.IsStaringRepo}}unstar{{else}}star{{end}}">
2-
<div class="ui labeled button" {{if not $.IsSigned}}data-tooltip-content="{{ctx.Locale.Tr "repo.star_guest_user"}}"{{end}}>
3-
{{$buttonText := ctx.Locale.Tr "repo.star"}}
4-
{{if $.IsStaringRepo}}{{$buttonText = ctx.Locale.Tr "repo.unstar"}}{{end}}
5-
<button type="submit" class="ui compact small basic button"{{if not $.IsSigned}} disabled{{end}} aria-label="{{$buttonText}}">
6-
{{svg (Iif $.IsStaringRepo "octicon-star-fill" "octicon-star")}}
7-
<span class="not-mobile" aria-hidden="true">{{$buttonText}}</span>
8-
</button>
9-
<a hx-boost="false" class="ui basic label" href="{{$.RepoLink}}/stars">
10-
{{CountFmt .Repository.NumStars}}
11-
</a>
12-
</div>
13-
</form>
1+
<div class="ui labeled button" {{if not $.IsSigned}}data-tooltip-content="{{ctx.Locale.Tr "repo.star_guest_user"}}"{{end}}>
2+
{{$buttonText := ctx.Locale.Tr "repo.star"}}
3+
{{if $.IsStaringRepo}}{{$buttonText = ctx.Locale.Tr "repo.unstar"}}{{end}}
4+
<button type="button" class="ui compact small basic button link-action" aria-label="{{$buttonText}}"
5+
{{if $.IsSigned}}
6+
data-url="{{$.RepoLink}}/action/{{if $.IsStaringRepo}}unstar{{else}}star{{end}}"
7+
data-fetch-sync="$closest(.ui.labeled.button)"
8+
{{else}}
9+
disabled
10+
{{end}}
11+
>
12+
{{svg (Iif $.IsStaringRepo "octicon-star-fill" "octicon-star")}}
13+
<span class="not-mobile" aria-hidden="true">{{$buttonText}}</span>
14+
</button>
15+
<a class="ui basic label" href="{{$.RepoLink}}/stars">
16+
{{CountFmt .Repository.NumStars}}
17+
</a>
18+
</div>

0 commit comments

Comments
 (0)