Add hints for special Wiki pages (#17283)

* Add UI hints to create a Wiki sidebar and footer
This commit is contained in:
n 2021-12-03 16:28:54 +09:00 committed by GitHub
parent 6ceef87671
commit 6791aae8de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 0 deletions

View File

@ -1585,6 +1585,7 @@ wiki.page_already_exists = A wiki page with the same name already exists.
wiki.reserved_page = The wiki page name '%s' is reserved. wiki.reserved_page = The wiki page name '%s' is reserved.
wiki.pages = Pages wiki.pages = Pages
wiki.last_updated = Last updated %s wiki.last_updated = Last updated %s
wiki.page_name_desc = Enter a name for this Wiki page. Some special names are: 'Home', '_Sidebar' and '_Footer'.
activity = Activity activity = Activity
activity.period.filter_label = Period: activity.period.filter_label = Period:

View File

@ -627,6 +627,9 @@ func NewWiki(ctx *context.Context) {
if !ctx.Repo.Repository.HasWiki() { if !ctx.Repo.Repository.HasWiki() {
ctx.Data["title"] = "Home" ctx.Data["title"] = "Home"
} }
if ctx.FormString("title") != "" {
ctx.Data["title"] = ctx.FormString("title")
}
ctx.HTML(http.StatusOK, tplWikiNew) ctx.HTML(http.StatusOK, tplWikiNew)
} }

View File

@ -16,6 +16,9 @@
<div class="field {{if .Err_Title}}error{{end}}"> <div class="field {{if .Err_Title}}error{{end}}">
<input name="title" value="{{.title}}" autofocus required> <input name="title" value="{{.title}}" autofocus required>
</div> </div>
<div class="help">
{{.i18n.Tr "repo.wiki.page_name_desc"}}
</div>
<div class="ui top attached tabular menu previewtabs" data-write="write" data-preview="preview"> <div class="ui top attached tabular menu previewtabs" data-write="write" data-preview="preview">
<a class="active item" data-tab="write">{{.i18n.Tr "write"}}</a> <a class="active item" data-tab="write">{{.i18n.Tr "write"}}</a>
<a class="item" data-tab="preview" data-url="{{$.Repository.APIURL}}/markdown" data-context="{{$.RepoLink}}">{{$.i18n.Tr "preview"}}</a> <a class="item" data-tab="preview" data-url="{{$.Repository.APIURL}}/markdown" data-context="{{$.RepoLink}}">{{$.i18n.Tr "preview"}}</a>