1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2025-12-07 00:48:07 +00:00

Backlinks: Isolate

This commit is contained in:
Timur Ismagilov
2022-04-02 19:58:57 +03:00
parent 75ded17a03
commit 2dcb1a5fe7
17 changed files with 162 additions and 232 deletions

View File

@@ -1,30 +0,0 @@
package web
import (
"github.com/bouncepaw/mycorrhiza/hyphae/backlinks"
"github.com/bouncepaw/mycorrhiza/viewutil"
"net/http"
"github.com/gorilla/mux"
"github.com/bouncepaw/mycorrhiza/l18n"
"github.com/bouncepaw/mycorrhiza/util"
"github.com/bouncepaw/mycorrhiza/views"
)
func initBacklinks(r *mux.Router) {
r.PathPrefix("/backlinks/").HandlerFunc(handlerBacklinks)
}
// handlerBacklinks lists all backlinks to a hypha.
func handlerBacklinks(w http.ResponseWriter, rq *http.Request) {
var (
hyphaName = util.HyphaNameFromRq(rq, "backlinks")
lc = l18n.FromRequest(rq)
)
util.HTTP200Page(w, views.Base(
viewutil.MetaFrom(w, rq),
lc.Get("ui.backlinks_title", &l18n.Replacements{"query": util.BeautifulName(hyphaName)}),
views.Backlinks(hyphaName, backlinks.YieldHyphaBacklinks, lc),
))
}

View File

@@ -2,6 +2,7 @@
package web
import (
"github.com/bouncepaw/mycorrhiza/backlinks"
"github.com/bouncepaw/mycorrhiza/categories"
"github.com/bouncepaw/mycorrhiza/misc"
"io"
@@ -47,7 +48,7 @@ func Handler() http.Handler {
initMutators(wikiRouter)
initHistory(wikiRouter)
initHelp(wikiRouter)
initBacklinks(wikiRouter)
backlinks.InitHandlers(wikiRouter)
categories.InitHandlers(wikiRouter)
misc.InitHandlers(wikiRouter)