Keep the globe on the same line #230
This commit is contained in:
parent
5ceb29351d
commit
ae78e5e459
@ -32,7 +32,7 @@ import "github.com/bouncepaw/mycorrhiza/l18n"
|
||||
import "github.com/bouncepaw/mycorrhiza/internal/mimetype"
|
||||
|
||||
//line hypview/readers.qtpl:11
|
||||
import "github.com/bouncepaw/mycorrhiza/tree"
|
||||
import "github.com/bouncepaw/mycorrhiza/internal/tree"
|
||||
|
||||
//line hypview/readers.qtpl:12
|
||||
import "github.com/bouncepaw/mycorrhiza/internal/user"
|
||||
|
||||
@ -2,11 +2,12 @@ package interwiki
|
||||
|
||||
import (
|
||||
"embed"
|
||||
viewutil2 "github.com/bouncepaw/mycorrhiza/web/viewutil"
|
||||
"github.com/gorilla/mux"
|
||||
"log"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/bouncepaw/mycorrhiza/web/viewutil"
|
||||
"github.com/gorilla/mux"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -29,13 +30,13 @@ var (
|
||||
{{define "edit separately."}}Изменяйте записи по отдельности.{{end}}
|
||||
{{define "add interwiki entry"}}Добавить запись в интеркарту{{end}}
|
||||
`
|
||||
chainInterwiki viewutil2.Chain
|
||||
chainNameTaken viewutil2.Chain
|
||||
chainInterwiki viewutil.Chain
|
||||
chainNameTaken viewutil.Chain
|
||||
)
|
||||
|
||||
func InitHandlers(rtr *mux.Router) {
|
||||
chainInterwiki = viewutil2.CopyEnRuWith(fs, "view_interwiki.html", ruTranslation)
|
||||
chainNameTaken = viewutil2.CopyEnRuWith(fs, "view_name_taken.html", ruTranslation)
|
||||
chainInterwiki = viewutil.CopyEnRuWith(fs, "view_interwiki.html", ruTranslation)
|
||||
chainNameTaken = viewutil.CopyEnRuWith(fs, "view_name_taken.html", ruTranslation)
|
||||
rtr.HandleFunc("/interwiki", handlerInterwiki)
|
||||
rtr.HandleFunc("/interwiki/add-entry", handlerAddEntry).Methods(http.MethodPost)
|
||||
rtr.HandleFunc("/interwiki/modify-entry/{target}", handlerModifyEntry).Methods(http.MethodPost)
|
||||
@ -64,13 +65,13 @@ func handlerModifyEntry(w http.ResponseWriter, rq *http.Request) {
|
||||
|
||||
if oldData, ok = entriesByName[name]; !ok {
|
||||
log.Printf("Could not modify interwiki entry ‘%s’ because it does not exist", name)
|
||||
viewutil2.HandlerNotFound(w, rq)
|
||||
viewutil.HandlerNotFound(w, rq)
|
||||
return
|
||||
}
|
||||
|
||||
if err := replaceEntry(oldData, &newData); err != nil {
|
||||
log.Printf("Could not modify interwiki entry ‘%s’ because one of the proposed aliases/name is taken\n", name)
|
||||
viewNameTaken(viewutil2.MetaFrom(w, rq), oldData, err.Error(), "modify-entry/"+name)
|
||||
viewNameTaken(viewutil.MetaFrom(w, rq), oldData, err.Error(), "modify-entry/"+name)
|
||||
return
|
||||
}
|
||||
|
||||
@ -82,7 +83,7 @@ func handlerModifyEntry(w http.ResponseWriter, rq *http.Request) {
|
||||
func handlerAddEntry(w http.ResponseWriter, rq *http.Request) {
|
||||
wiki := readInterwikiEntryFromRequest(rq)
|
||||
if err := addEntry(&wiki); err != nil {
|
||||
viewNameTaken(viewutil2.MetaFrom(w, rq), &wiki, err.Error(), "add-entry")
|
||||
viewNameTaken(viewutil.MetaFrom(w, rq), &wiki, err.Error(), "add-entry")
|
||||
return
|
||||
}
|
||||
saveInterwikiJson()
|
||||
@ -90,15 +91,15 @@ func handlerAddEntry(w http.ResponseWriter, rq *http.Request) {
|
||||
}
|
||||
|
||||
type nameTakenData struct {
|
||||
*viewutil2.BaseData
|
||||
*viewutil.BaseData
|
||||
*Wiki
|
||||
TakenName string
|
||||
Action string
|
||||
}
|
||||
|
||||
func viewNameTaken(meta viewutil2.Meta, wiki *Wiki, takenName, action string) {
|
||||
viewutil2.ExecutePage(meta, chainNameTaken, nameTakenData{
|
||||
BaseData: &viewutil2.BaseData{},
|
||||
func viewNameTaken(meta viewutil.Meta, wiki *Wiki, takenName, action string) {
|
||||
viewutil.ExecutePage(meta, chainNameTaken, nameTakenData{
|
||||
BaseData: &viewutil.BaseData{},
|
||||
Wiki: wiki,
|
||||
TakenName: takenName,
|
||||
Action: action,
|
||||
@ -106,19 +107,19 @@ func viewNameTaken(meta viewutil2.Meta, wiki *Wiki, takenName, action string) {
|
||||
}
|
||||
|
||||
func handlerInterwiki(w http.ResponseWriter, rq *http.Request) {
|
||||
viewInterwiki(viewutil2.MetaFrom(w, rq))
|
||||
viewInterwiki(viewutil.MetaFrom(w, rq))
|
||||
}
|
||||
|
||||
type interwikiData struct {
|
||||
*viewutil2.BaseData
|
||||
*viewutil.BaseData
|
||||
Entries []*Wiki
|
||||
CanEdit bool
|
||||
Error string
|
||||
}
|
||||
|
||||
func viewInterwiki(meta viewutil2.Meta) {
|
||||
viewutil2.ExecutePage(meta, chainInterwiki, interwikiData{
|
||||
BaseData: &viewutil2.BaseData{},
|
||||
func viewInterwiki(meta viewutil.Meta) {
|
||||
viewutil.ExecutePage(meta, chainInterwiki, interwikiData{
|
||||
BaseData: &viewutil.BaseData{},
|
||||
Entries: listOfEntries,
|
||||
CanEdit: meta.U.Group == "admin",
|
||||
Error: "",
|
||||
|
||||
@ -2,8 +2,9 @@ package interwiki
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/bouncepaw/mycorrhiza/util"
|
||||
"log"
|
||||
|
||||
"github.com/bouncepaw/mycorrhiza/util"
|
||||
)
|
||||
|
||||
// WikiEngine is an enumeration of supported interwiki targets.
|
||||
|
||||
@ -106,13 +106,14 @@ textarea {font-size:16px; font-family: inherit; line-height: 150%; }
|
||||
|
||||
main h1:not(.navi-title) {font-size:1.7rem;}
|
||||
blockquote { margin: 0; padding-left: .75rem; }
|
||||
.wikilink_external::before { display: inline-block; width: 18px; height: 16px; vertical-align: sub; }
|
||||
.wikilink { display: inline-block; }
|
||||
.wikilink_external::before { width: 18px; height: 16px; vertical-align: text-top; margin-right: 2px; }
|
||||
/* .wikilink_external { padding-left: 16px; } */
|
||||
.wikilink_gopher::before { content: url("/staticatic/icon/gopher-proto.svg"); }
|
||||
.wikilink_http::before, .wikilink_https::before { content: url("/staticatic/icon/http-proto.svg"); }
|
||||
.wikilink_gopher::before { content: url("/static/icon/gopher-proto.svg"); }
|
||||
.wikilink_http::before, .wikilink_https::before { content: url("/static/icon/http-proto.svg"); }
|
||||
/* .wikilink_https { background: transparent url("/static/icon/http-proto.svg") center left no-repeat; } */
|
||||
.wikilink_gemini::before { content: url("/staticatic/icon/gemini-proto.svg"); }
|
||||
.wikilink_mailto::before { content: url("/staticatic/icon/mailto-proto.svg"); }
|
||||
.wikilink_gemini::before { content: url("/static/icon/gemini-proto.svg"); }
|
||||
.wikilink_mailto::before { content: url("/static/icon/mailto-proto.svg"); }
|
||||
|
||||
article { overflow-wrap: break-word; word-wrap: break-word; word-break: break-word; line-height: 150%; }
|
||||
main h1 { margin: .5rem 0 0 0; }
|
||||
|
||||
Loading…
Reference in New Issue
Block a user