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