forked from tangled.org/core
this repo has no description

fix up blob page to allow sidescrolling

Changed files
+23 -29
appview
pages
templates
repo
+5
appview/pages/pages.go
···
return pairs, nil
},
"timeFmt": humanize.Time,
+
"length": func(v []string) int {
+
return len(v)
+
},
}
}
···
type RepoBlobParams struct {
LoggedInUser *auth.User
RepoInfo RepoInfo
+
Active string
types.RepoBlobResponse
}
func (p *Pages) RepoBlob(w io.Writer, params RepoBlobParams) error {
+
params.Active = "overview"
return p.executeRepo("repo/blob", w, params)
}
+8 -11
appview/pages/templates/repo/blob.html
···
{{ define "repoContent" }}
-
<table>
-
<tbody><tr>
-
<td class="line-numbers">
-
{{ range $i, $x := split .Contents }}
-
{{ add $i 1 }} {{ $x }} <br>
-
{{ end }}
-
</td>
-
<td class="file-content"></td>
-
</tbody></tr>
-
</table>
-
{{end}}
+
{{ $lines := split .Contents }}
+
{{ $tot_lines := len $lines }}
+
{{ $tot_chars := len (printf "%d" $tot_lines) }}
+
{{ $code_number_style := "code-line-num text-gray-400 mr-2 px-1 sticky left-0 bg-white border-r border-black text-right w-[{{$tot_chars}}rem]" }}
+
<pre class="font-mono text-sm overflow-auto relative text-ellipsis"><code>{{ range $idx, $line := $lines }}<span class="flex">
+
<span class="{{ $code_number_style }}">{{ add $idx 1 }}</span>
+
<span class="whitespace-pre">{{ $line }}</span></span>{{ else }}<em class="text-gray-400">this file is empty</em>{{ end }}</code></pre>
+
{{ end }}
+9 -17
flake.nix
···
${pkgs.tailwindcss}/bin/tailwindcss -i input.css -o appview/pages/static/tw.css
'';
subPackages = ["cmd/appview"];
-
vendorHash = "sha256-QgUPTOgAdKUTg+ztfs194G7pt3/qDtqTMkDRmMECxSo=";
+
vendorHash = "sha256-t7lWrCyFWCI7zjUcC6XNWzCrUPSCFnFu9gTmRTsYrz0=";
env.CGO_ENABLED = 1;
stdenv = pkgsStatic.stdenv;
};
-
-
knotserver = with final;
+
knotserver = with final;
final.pkgsStatic.buildGoModule {
-
pname = "knotserver";
-
version = "0.1.0";
-
src = gitignoreSource ./.;
-
subPackages = ["cmd/knotserver"];
-
vendorHash = "sha256-QgUPTOgAdKUTg+ztfs194G7pt3/qDtqTMkDRmMECxSo=";
-
env.CGO_ENABLED = 1;
-
nativeBuildInputs = with pkgsMusl; [ pkg-config ];
-
-
# Add these ldflags for static compilation
-
ldflags = [ "-s" "-w" "-linkmode external" ''-extldflags "-static -L${pkgsStatic.musl}/lib"'' ];
-
-
# Use static stdenv
-
stdenv = pkgMusl.stdenv;
-
};
+
pname = "knotserver";
+
version = "0.1.0";
+
src = gitignoreSource ./.;
+
subPackages = ["cmd/knotserver"];
+
vendorHash = "sha256-t7lWrCyFWCI7zjUcC6XNWzCrUPSCFnFu9gTmRTsYrz0=";
+
env.CGO_ENABLED = 1;
+
};
};
packages = forAllSystems (system: {
inherit (nixpkgsFor."${system}") indigo-lexgen appview knotserver;
+1 -1
go.mod
···
github.com/bluesky-social/indigo v0.0.0-20250123072624-9e3b84fdbb20
github.com/bluesky-social/jetstream v0.0.0-20241210005130-ea96859b93d1
github.com/casbin/casbin/v2 v2.103.0
+
github.com/dustin/go-humanize v1.0.1
github.com/gliderlabs/ssh v0.3.5
github.com/go-chi/chi/v5 v5.2.0
github.com/go-git/go-git/v5 v5.12.0
···
github.com/cloudflare/circl v1.4.0 // indirect
github.com/cyphar/filepath-securejoin v0.3.3 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
-
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect