This is an automated email from the ASF dual-hosted git repository.
shuai pushed a commit to branch podling
in repository https://gitbox.apache.org/repos/asf/incubator-answer.git
The following commit(s) were added to refs/heads/podling by this push:
new 1d22401e fix: Update the template file to resolve the HTML rendering
exception in the template/tags.html file
1d22401e is described below
commit 1d22401e47b38fa5b9dadb600e845f91bd67f44d
Author: shuai <[email protected]>
AuthorDate: Tue Nov 7 15:22:13 2023 +0800
fix: Update the template file to resolve the HTML rendering exception in
the template/tags.html file
---
cmd/wire_gen.go | 24 ++----------------------
go.mod | 1 +
go.sum | 1 +
ui/template/header.html | 44 +++++++++++++++++++++++++++++---------------
ui/template/sidenav.html | 41 +++++++++++++++++++++++++++++++++++++++++
ui/template/tags.html | 2 +-
6 files changed, 75 insertions(+), 38 deletions(-)
diff --git a/cmd/wire_gen.go b/cmd/wire_gen.go
index cef3f985..57e4a59d 100644
--- a/cmd/wire_gen.go
+++ b/cmd/wire_gen.go
@@ -1,28 +1,8 @@
-//go:build !wireinject
-// +build !wireinject
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
// Code generated by Wire. DO NOT EDIT.
//go:generate go run github.com/google/wire/cmd/wire
+//go:build !wireinject
+// +build !wireinject
package answercmd
diff --git a/go.mod b/go.mod
index 1a3b49f6..aeb708bb 100644
--- a/go.mod
+++ b/go.mod
@@ -86,6 +86,7 @@ require (
github.com/golang/geo v0.0.0-20190812012225-f41920e961ce // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
+ github.com/google/subcommands v1.0.1 // indirect
github.com/gorilla/css v1.0.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/imdario/mergo v0.3.16 // indirect
diff --git a/go.sum b/go.sum
index 3b97bb54..76d7399d 100644
--- a/go.sum
+++ b/go.sum
@@ -316,6 +316,7 @@ github.com/google/pprof v0.0.0-20221118152302-e6195bd50e26
h1:Xim43kblpZXfIBQsbu
github.com/google/renameio v0.1.0/go.mod
h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4=
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod
h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ=
+github.com/google/subcommands v1.0.1
h1:/eqq+otEXm5vhfBrbREPCSVQbvofip6kIz+mX5TUH7k=
github.com/google/subcommands v1.0.1/go.mod
h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk=
github.com/google/uuid v1.0.0/go.mod
h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.1.2/go.mod
h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
diff --git a/ui/template/header.html b/ui/template/header.html
index 47372ab6..5471391d 100644
--- a/ui/template/header.html
+++ b/ui/template/header.html
@@ -115,7 +115,7 @@
<div id="protect-browser"></div>
</div>
- <nav id="header" class="sticky-top navbar navbar-expand-lg navbar-dark">
+ <nav id="header" class="sticky-top theme-colored navbar navbar-expand-lg
navbar-dark">
<div class="d-flex align-items-center container">
<button
aria-controls="navBarContent"
@@ -129,27 +129,41 @@
<div
class="d-flex justify-content-between align-items-center nav-grow
flex-nowrap"
>
- <a class="lh-1 me-0 me-sm-3 navbar-brand" href="/">
- {{.siteinfo.General.Name}}
- </a>
+ {{if .siteinfo.Branding.Logo}}
+ <a class="lh-1 me-0 me-sm-5 p-0 navbar-brand" href="/">
+ <img class="logo me-0" src="{{.siteinfo.Branding.Logo}}"
alt="{{.siteinfo.General.Name}}">
+ </a>
+ {{else}}
+ <a class="lh-1 me-0 me-sm-3 navbar-brand" href="/">
+ {{.siteinfo.General.Name}}
+ </a>
+ {{end}}
</div>
<div class="me-auto navbar-collapse collapse" id="navBarContent">
<hr class="hr lg-none mb-2" style="margin-top: 12px" />
- <div class="col-md-4">
- <div class="navbar-nav">
- <a class="nav-link" href="/questions"
- >{{translator $.language "ui.header.nav.question"}}</a
- >
- <a class="nav-link" href="/tags"
- >{{translator $.language "ui.header.nav.tag"}}</a
- >
- </div>
+ <div class="ps-0 col-lg-8">
+ <form action="/search" class="w-100 maxw-400">
+ <input placeholder="Search" name="q" type="search"
class="placeholder-search form-control" value="">
+ </form>
+ </div>
+ <!-- <div class="lg-none mt-3 pb-1 nav-item">
+ <a class="text-capitalize text-nowrap btn btn-light"
href="/questions/ask">{{translator $.language "ui.btns.add_question"}}</a>
+ </div> -->
+ <div class="d-none d-lg-flex justify-content-start
justify-content-sm-end col-lg-4">
+ <!-- <a role="button" tabindex="0" href="/users/login"
class="me-2 link-light btn btn-link">
+ {{translator $.language "ui.btns.login"}}
+ </a>
+ <a role="button" tabindex="0" href="/users/register" class="btn
btn-light">
+ {{translator $.language "ui.btns.signup"}}
+ </a> -->
</div>
- <hr class="hr lg-none mt-2" />
</div>
</div>
</nav>
- <div class="position-relative page-wrap">{{end}}</div>
+ <div class="position-relative page-wrap">
+ {{template "sidenav" . }}
+ {{end}}
+ </div>
</div>
</body>
diff --git a/ui/template/sidenav.html b/ui/template/sidenav.html
new file mode 100644
index 00000000..85e5fb6e
--- /dev/null
+++ b/ui/template/sidenav.html
@@ -0,0 +1,41 @@
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+{{define "sidenav"}}
+<div id="sideNav" class="position-relative d-none d-lg-block col-xl-2 col-lg-3
col-md-12">
+ <div class="nav-wrap pt-4">
+ <div class="flex-column nav nav-pills">
+ <a class="nav-link active" href="/questions">
+ <i class="br bi-question-circle-fill me-2"></i>
+ <span>{{translator $.language "ui.header.nav.question"}}</span>
+ </a>
+ <a href="/tags" data-rr-ui-event-key="/tags" class="nav-link">
+ <i class="br bi-tags-fill me-2"></i>
+ <span>{{translator $.language "ui.header.nav.tag"}}</span>
+ </a>
+ <a class="nav-link" href="/users">
+ <i class="br bi-people-fill me-2"></i>
+ <span>{{translator $.language "ui.header.nav.user"}}</span>
+ </a>
+ </div>
+ </div>
+ <div class="side-nav-right-line"></div>
+</div>
+{{end}}
diff --git a/ui/template/tags.html b/ui/template/tags.html
index a3f7542c..7eb2b9b3 100644
--- a/ui/template/tags.html
+++ b/ui/template/tags.html
@@ -42,7 +42,7 @@
<div class="d-flex flex-column align-items-start
card-body">
<a href="/tags/{{.SlugName}}" class="badge-tag
rounded-1 mb-3"><span
class="">{{.SlugName}}</span></a>
- <p class="small flex-fill text-break text-wrap
text-truncate-4">{{.ParsedText}}
+ <p class="small flex-fill text-break text-wrap
text-truncate-4">{{formatLinkNofollow .ParsedText}}
</p>
<div class="d-flex align-items-center">
<span class="text-secondary small
text-nowrap">{{.QuestionCount}}