- {{block "edit category heading" .CatName}}Edit category {{beautifulName .}}{{end}}
- {{if len .Hyphae | not}}
- {{block "empty cat" .}}This category is empty{{end}}
- {{end}}
-
- {{if .GivenPermissionToModify}}
- {{block "add to category title" .}}Add a hypha to the category{{end}}
-
-
- {{if len .Hyphae}}
- {{block "remove hyphae" .}}Remove hyphae from the category{{end}}
-
- {{end}}{{end}}
-
-{{end}}
diff --git a/categories/views.go b/categories/views.go
index 6526ea7..0ceb0e5 100644
--- a/categories/views.go
+++ b/categories/views.go
@@ -1,45 +1,29 @@
package categories
import (
- "embed"
- "sort"
-
"github.com/bouncepaw/mycorrhiza/web/viewutil"
)
const ruTranslation = `
-{{define "empty cat"}}Эта категория пуста.{{end}}
-{{define "cat"}}Категория{{end}}
-{{define "hypha name"}}Название гифы{{end}}
+{{define "empty cat"}}{{end}}
+{{define "cat"}}{{end}}
+{{define "hypha name"}}{{end}}
{{define "categories"}}Категории{{end}}
{{define "placeholder"}}Название категории...{{end}}
{{define "remove from category title"}}Убрать гифу из этой категории{{end}}
-{{define "add to category title"}}Добавить гифу в эту категорию{{end}}
-{{define "category list"}}Список категорий{{end}}
-{{define "no categories"}}В этой вики нет категорий.{{end}}
-{{define "category x"}}Категория {{. | beautifulName}}{{end}}
+{{define "add to category title"}}{{end}}
+{{define "category list"}}{{end}}
+{{define "no categories"}}{{end}}
+{{define "category x"}}{{end}}
-{{define "edit category x"}}Редактирование категории {{beautifulName .}}{{end}}
-{{define "edit category heading"}}Редактирование категории
+ {{block "edit category heading" .CatName}}Edit category {{beautifulName .}}{{end}}
+ {{if len .Hyphae | not}}
+ {{block "empty cat" .}}This category is empty{{end}}
+ {{end}}
+
+ {{if .GivenPermissionToModify}}
+ {{block "add to category title" .}}Add a hypha to the category{{end}}
+
+
+ {{if len .Hyphae}}
+ {{block "remove hyphae" .}}Remove hyphae from the category{{end}}
+
+ {{end}}{{end}}
+
+{{end}}
diff --git a/categories/view_list.html b/web/views/cat-list.html
similarity index 100%
rename from categories/view_list.html
rename to web/views/cat-list.html
diff --git a/categories/view_page.html b/web/views/cat-page.html
similarity index 100%
rename from categories/view_page.html
rename to web/views/cat-page.html
diff --git a/web/web.go b/web/web.go
index 2887914..01ba4e6 100644
--- a/web/web.go
+++ b/web/web.go
@@ -16,7 +16,6 @@ import (
"net/url"
"strings"
- "github.com/bouncepaw/mycorrhiza/categories"
"github.com/bouncepaw/mycorrhiza/help"
"github.com/bouncepaw/mycorrhiza/history/histweb"
"github.com/bouncepaw/mycorrhiza/hypview"
@@ -73,12 +72,17 @@ func Handler() http.Handler {
initReaders(r)
initMutators(r)
help.InitHandlers(r)
- categories.InitHandlers(r)
misc.InitHandlers(r)
hypview.Init()
histweb.InitHandlers(r)
interwiki.InitHandlers(r)
+ r.PathPrefix("/add-to-category").HandlerFunc(handlerAddToCategory).Methods("POST")
+ r.PathPrefix("/remove-from-category").HandlerFunc(handlerRemoveFromCategory).Methods("POST")
+ r.PathPrefix("/category/").HandlerFunc(handlerCategory).Methods("GET")
+ r.PathPrefix("/edit-category/").HandlerFunc(handlerEditCategory).Methods("GET")
+ r.PathPrefix("/category").HandlerFunc(handlerListCategory).Methods("GET")
+
// Admin routes
if cfg.UseAuth {
adminRouter := r.PathPrefix("/admin").Subrouter()