Skip to content

Commit a06998c

Browse files
committed
Add RootURL to admin template paths.
1 parent 8a16996 commit a06998c

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

admin/base.html

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,30 @@
44
<head>
55
<title>{{ .Title }} {{ if .Title }}|{{ end}} DictPress</title>
66
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
7-
<link rel="stylesheet" type="text/css" href="/admin/static/grid.css?v={{ .AssetVer }}">
8-
<link rel="stylesheet" type="text/css" href="/admin/static/style.css?v={{ .AssetVer }}">
7+
<link rel="stylesheet" type="text/css" href="{{ .Consts.RootURL }}/admin/static/grid.css?v={{ .AssetVer }}">
8+
<link rel="stylesheet" type="text/css" href="{{ .Consts.RootURL }}/admin/static/style.css?v={{ .AssetVer }}">
99

10-
<link rel="shortcut icon" href="/admin/static/favicon.png?v={{ .AssetVer }}" type="image/x-icon" />
11-
<script defer src="/admin/static/main.js?v={{ .AssetVer }}"></script>
12-
<script defer src="/admin/static/alpine.js?v={{ .AssetVer }}"></script>
10+
<link rel="shortcut icon" href="{{ .Consts.RootURL }}/admin/static/favicon.png?v={{ .AssetVer }}" type="image/x-icon" />
11+
<script defer src="{{ .Consts.RootURL }}/admin/static/main.js?v={{ .AssetVer }}"></script>
12+
<script defer src="{{ .Consts.RootURL }}/admin/static/alpine.js?v={{ .AssetVer }}"></script>
1313
</head>
1414
<body x-init="onLoad()" x-data="globalComponent()">
1515
<template x-if="ready">
1616
<div class="container wrap">
1717
<header class="header">
1818
<div class="row">
1919
<div class="three columns logo">
20-
<a href="/admin"><img src="/admin/static/logo.svg?v={{ .AssetVer }}" alt="logo" /></a>
20+
<a href="{{ .Consts.RootURL }}/admin"><img src="{{ .Consts.RootURL }}/admin/static/logo.svg?v={{ .AssetVer }}" alt="logo" /></a>
2121
<template x-if="Object.keys(loading).length > 0"><span class="loading"></span></template>
2222
</div>
2323
<nav class="eight columns nav">
2424
<a href="" @click.prevent="onNewEntry">Add new</a>
25-
<a href="/admin/pending">Pending</a>
25+
<a href="{{ .Consts.RootURL }}/admin/pending">Pending</a>
2626
</nav>
2727
</div>
2828
</header>
2929

30-
<form class="search" action="/admin/search" x-data="searchFormComponent()" @submit="onSearch">
30+
<form class="search" action="{{ .Consts.RootURL }}/admin/search" x-data="searchFormComponent()" @submit="onSearch">
3131
<fieldset class="row">
3232
<div class="column four">
3333
<select name="from_lang" x-model="fromLang">

cmd/dictpress/admin.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,8 @@ func adminPage(tpl string) func(c echo.Context) error {
413413
err := app.adminTpl.ExecuteTemplate(b, tpl, struct {
414414
Title string
415415
AssetVer string
416-
}{title, assetVer})
416+
Consts Consts
417+
}{title, assetVer, app.consts})
417418
if err != nil {
418419
return echo.NewHTTPError(http.StatusInternalServerError,
419420
fmt.Sprintf("error compiling template: %v", err))

0 commit comments

Comments
 (0)