2
0
Files
gitcaddy-server/templates/repo/settings/pages_advanced.tmpl
logikonline b43345986a
Some checks failed
Build and Release / Unit Tests (push) Successful in 6m20s
Build and Release / Create Release (push) Successful in 0s
Build and Release / Lint (push) Successful in 6m31s
Build and Release / Build Binaries (amd64, windows, windows-latest) (push) Failing after 9h1m42s
Build and Release / Integration Tests (PostgreSQL) (push) Has been cancelled
Build and Release / Build Binaries (amd64, linux, linux-latest) (push) Has been cancelled
Build and Release / Build Binaries (amd64, darwin, macos) (push) Has been cancelled
Build and Release / Build Binaries (arm64, darwin, macos) (push) Has been cancelled
Build and Release / Build Binary (linux/arm64) (push) Has been cancelled
refactor(pages): remove unused app store fields from advanced settings
2026-03-30 09:32:58 -04:00

83 lines
4.7 KiB
Handlebars

{{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings pages")}}
<div class="user-main-content twelve wide column">
<h4 class="ui top attached header">{{ctx.Locale.Tr "repo.settings.pages.advanced"}}</h4>
<div class="ui attached segment">
<form class="ui form" method="post">
{{.CsrfTokenHtml}}
<h5 class="ui dividing header">{{ctx.Locale.Tr "repo.settings.pages.static_routes"}}</h5>
<p class="help">{{ctx.Locale.Tr "repo.settings.pages.static_routes_desc"}}</p>
<div id="routes-container">
{{range $i, $route := .Config.Advanced.StaticRoutes}}
<div class="field route-item tw-flex tw-items-center tw-gap-2">
<input name="static_route_{{$i}}" value="{{$route}}" placeholder="/schema/*" class="tw-flex-1">
<button type="button" class="ui red mini icon button" onclick="this.closest('.route-item').remove()">{{svg "octicon-trash" 14}}</button>
</div>
{{end}}
{{if not .Config.Advanced.StaticRoutes}}
<div class="field route-item tw-flex tw-items-center tw-gap-2">
<input name="static_route_0" placeholder="/schema/*" class="tw-flex-1">
<button type="button" class="ui red mini icon button" onclick="this.closest('.route-item').remove()">{{svg "octicon-trash" 14}}</button>
</div>
{{end}}
</div>
<button type="button" class="ui mini button tw-mb-4" onclick="addRoute()">+ {{ctx.Locale.Tr "repo.settings.pages.add_route"}}</button>
<h5 class="ui dividing header">{{ctx.Locale.Tr "repo.settings.pages.redirects"}}</h5>
<p class="help">{{ctx.Locale.Tr "repo.settings.pages.redirects_desc"}}</p>
<div id="redirects-container">
{{range $path, $target := .Config.Advanced.Redirects}}
<div class="two fields redirect-item">
<div class="field"><input name="redirect_from_{{$path}}" value="{{$path}}" placeholder="/old-path"></div>
<div class="field tw-flex tw-items-center tw-gap-2">
<input name="redirect_to_{{$path}}" value="{{$target}}" placeholder="https://new-url" class="tw-flex-1">
<button type="button" class="ui red mini icon button" onclick="this.closest('.redirect-item').remove()">{{svg "octicon-trash" 14}}</button>
</div>
</div>
{{end}}
{{if not .Config.Advanced.Redirects}}
<div class="two fields redirect-item">
<div class="field"><input name="redirect_from_0" placeholder="/old-path"></div>
<div class="field tw-flex tw-items-center tw-gap-2">
<input name="redirect_to_0" placeholder="https://new-url" class="tw-flex-1">
<button type="button" class="ui red mini icon button" onclick="this.closest('.redirect-item').remove()">{{svg "octicon-trash" 14}}</button>
</div>
</div>
{{end}}
</div>
<button type="button" class="ui mini button tw-mb-4" onclick="addRedirect()">+ {{ctx.Locale.Tr "repo.settings.pages.add_redirect"}}</button>
<h5 class="ui dividing header">{{ctx.Locale.Tr "repo.settings.pages.custom_code"}}</h5>
<div class="field">
<label>{{ctx.Locale.Tr "repo.settings.pages.custom_css"}}</label>
<textarea name="custom_css" rows="4" placeholder="body { }">{{.Config.Advanced.CustomCSS}}</textarea>
</div>
<div class="field">
<label>{{ctx.Locale.Tr "repo.settings.pages.custom_head"}}</label>
<textarea name="custom_head" rows="4" placeholder="<meta ...>">{{.Config.Advanced.CustomHead}}</textarea>
</div>
<div class="field">
<button class="ui primary button">{{ctx.Locale.Tr "save"}}</button>
</div>
</form>
</div>
</div>
<script>
let routeCount = {{len .Config.Advanced.StaticRoutes}};
let redirectCount = {{len .Config.Advanced.Redirects}};
if (routeCount === 0) routeCount = 1;
if (redirectCount === 0) redirectCount = 1;
function addRoute() {
const c = document.getElementById('routes-container');
c.insertAdjacentHTML('beforeend', `<div class="field route-item tw-flex tw-items-center tw-gap-2"><input name="static_route_${routeCount}" placeholder="/schema/*" class="tw-flex-1"><button type="button" class="ui red mini icon button" onclick="this.closest('.route-item').remove()">{{svg "octicon-trash" 14}}</button></div>`);
routeCount++;
}
function addRedirect() {
const c = document.getElementById('redirects-container');
c.insertAdjacentHTML('beforeend', `<div class="two fields redirect-item"><div class="field"><input name="redirect_from_${redirectCount}" placeholder="/old-path"></div><div class="field tw-flex tw-items-center tw-gap-2"><input name="redirect_to_${redirectCount}" placeholder="https://new-url" class="tw-flex-1"><button type="button" class="ui red mini icon button" onclick="this.closest('.redirect-item').remove()">{{svg "octicon-trash" 14}}</button></div></div>`);
redirectCount++;
}
</script>
{{template "repo/settings/layout_footer" .}}