From 6dc13a32a397881e2310609792d0c0e79661545f Mon Sep 17 00:00:00 2001 From: n <67550725+n194@users.noreply.github.com> Date: Sun, 10 Oct 2021 20:08:54 +0900 Subject: [PATCH 1/6] Add UI hints to create a Wiki sidebar and footer --- options/locale/locale_en-US.ini | 2 ++ routers/web/repo/wiki.go | 3 +++ templates/repo/wiki/view.tmpl | 14 ++++++++++++-- web_src/less/_base.less | 3 ++- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index d5af933f4041a..db90f00c57cf7 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1554,6 +1554,8 @@ wiki.page_already_exists = A wiki page with the same name already exists. wiki.reserved_page = The wiki page name '%s' is reserved. wiki.pages = Pages wiki.last_updated = Last updated %s +wiki.add_sidebar = Add a Custom Sidebar +wiki.add_footer = Add a Custom Footer activity = Activity activity.period.filter_label = Period: diff --git a/routers/web/repo/wiki.go b/routers/web/repo/wiki.go index a571c46fd73e4..935e95ce027fe 100644 --- a/routers/web/repo/wiki.go +++ b/routers/web/repo/wiki.go @@ -577,6 +577,9 @@ func NewWiki(ctx *context.Context) { if !ctx.Repo.Repository.HasWiki() { ctx.Data["title"] = "Home" } + if ctx.FormString("title") != "" { + ctx.Data["title"] = ctx.FormString("title") + } ctx.HTML(http.StatusOK, tplWikiNew) } diff --git a/templates/repo/wiki/view.tmpl b/templates/repo/wiki/view.tmpl index a393fb20a18f0..c606bf594fba7 100644 --- a/templates/repo/wiki/view.tmpl +++ b/templates/repo/wiki/view.tmpl @@ -60,8 +60,8 @@

{{.FormatWarning}}

{{end}} -
-
+
+
{{.content | Str2html}}
{{if .sidebarPresent}} @@ -73,6 +73,12 @@ {{.sidebarContent | Str2html}}
+ {{else if and .CanWriteWiki (not .Repository.IsMirror)}} +
+ +
{{end}}
{{if .footerPresent}} @@ -82,6 +88,10 @@ {{end}} {{.footerContent | Str2html}} + {{else if and .CanWriteWiki (not .Repository.IsMirror)}} +
+ {{svg "octicon-plus"}} {{.i18n.Tr "repo.wiki.add_footer"}} +
{{end}} diff --git a/web_src/less/_base.less b/web_src/less/_base.less index 4e2782a4c8ce4..f88a8e7596341 100644 --- a/web_src/less/_base.less +++ b/web_src/less/_base.less @@ -1830,7 +1830,8 @@ a.ui.basic.label:hover { .ui.segment, .ui.segments, -.ui.attached.segment { +.ui.attached.segment, +.ui.segment.placeholder { background: var(--color-box-body); color: var(--color-text); border-color: var(--color-secondary); From 92ac8d211f1730ae1e522a00687f36bfa603217e Mon Sep 17 00:00:00 2001 From: n <67550725+n194@users.noreply.github.com> Date: Mon, 11 Oct 2021 17:47:32 +0900 Subject: [PATCH 2/6] Undo Sidebar and Footer hints in Wiki --- options/locale/locale_en-US.ini | 2 -- templates/repo/wiki/view.tmpl | 16 +++------------- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index db90f00c57cf7..d5af933f4041a 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1554,8 +1554,6 @@ wiki.page_already_exists = A wiki page with the same name already exists. wiki.reserved_page = The wiki page name '%s' is reserved. wiki.pages = Pages wiki.last_updated = Last updated %s -wiki.add_sidebar = Add a Custom Sidebar -wiki.add_footer = Add a Custom Footer activity = Activity activity.period.filter_label = Period: diff --git a/templates/repo/wiki/view.tmpl b/templates/repo/wiki/view.tmpl index c606bf594fba7..27b6263a0afc8 100644 --- a/templates/repo/wiki/view.tmpl +++ b/templates/repo/wiki/view.tmpl @@ -60,8 +60,8 @@

{{.FormatWarning}}

{{end}} -
-
+
+
{{.content | Str2html}}
{{if .sidebarPresent}} @@ -73,12 +73,6 @@ {{.sidebarContent | Str2html}}
- {{else if and .CanWriteWiki (not .Repository.IsMirror)}} -
- -
{{end}}
{{if .footerPresent}} @@ -88,10 +82,6 @@ {{end}} {{.footerContent | Str2html}} - {{else if and .CanWriteWiki (not .Repository.IsMirror)}} -
- {{svg "octicon-plus"}} {{.i18n.Tr "repo.wiki.add_footer"}} -
{{end}} @@ -107,4 +97,4 @@ {{template "base/delete_modal_actions" .}} -{{template "base/footer" .}} +{{template "base/footer" .}} \ No newline at end of file From 0cebd65b8278039c8c508b7a37b4af2501f52ae6 Mon Sep 17 00:00:00 2001 From: n <67550725+n194@users.noreply.github.com> Date: Mon, 11 Oct 2021 18:11:50 +0900 Subject: [PATCH 3/6] Add description to Wiki new page creation --- options/locale/locale_en-US.ini | 4 ++++ templates/repo/wiki/new.tmpl | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index d5af933f4041a..23e0ceb3cbcb2 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1554,6 +1554,10 @@ wiki.page_already_exists = A wiki page with the same name already exists. wiki.reserved_page = The wiki page name '%s' is reserved. wiki.pages = Pages wiki.last_updated = Last updated %s +wiki.page_name_desc = Enter a name for this Wiki page. Some special names are: +wiki.page_name_desc_home = Home: The landing page for your Wiki +wiki.page_name_desc_sidebar = _Sidebar: Appears as a sidebar for your Wiki +wiki.page_name_desc_footer = _Footer: Appears as a footer for your Wiki activity = Activity activity.period.filter_label = Period: diff --git a/templates/repo/wiki/new.tmpl b/templates/repo/wiki/new.tmpl index 6de6ef9a201a8..83f937f9f44c1 100644 --- a/templates/repo/wiki/new.tmpl +++ b/templates/repo/wiki/new.tmpl @@ -16,6 +16,14 @@
+
+ {{.i18n.Tr "repo.wiki.page_name_desc"}} + +
-{{template "base/footer" .}} \ No newline at end of file +{{template "base/footer" .}} From 122e107e97578e394a706edabfe06214d5b98cc4 Mon Sep 17 00:00:00 2001 From: n <67550725+n194@users.noreply.github.com> Date: Mon, 11 Oct 2021 21:23:12 +0900 Subject: [PATCH 5/6] Remove now unnecessary CSS change --- web_src/less/_base.less | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/web_src/less/_base.less b/web_src/less/_base.less index f88a8e7596341..4e2782a4c8ce4 100644 --- a/web_src/less/_base.less +++ b/web_src/less/_base.less @@ -1830,8 +1830,7 @@ a.ui.basic.label:hover { .ui.segment, .ui.segments, -.ui.attached.segment, -.ui.segment.placeholder { +.ui.attached.segment { background: var(--color-box-body); color: var(--color-text); border-color: var(--color-secondary); From 3a3bbc86684c16a33dcc101788c4dd1fd0c11412 Mon Sep 17 00:00:00 2001 From: n <67550725+n194@users.noreply.github.com> Date: Fri, 26 Nov 2021 21:21:18 +0900 Subject: [PATCH 6/6] Shorten wiki page name description --- options/locale/locale_en-US.ini | 5 +---- templates/repo/wiki/new.tmpl | 5 ----- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 23e0ceb3cbcb2..81a424a178690 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1554,10 +1554,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.pages = Pages wiki.last_updated = Last updated %s -wiki.page_name_desc = Enter a name for this Wiki page. Some special names are: -wiki.page_name_desc_home = Home: The landing page for your Wiki -wiki.page_name_desc_sidebar = _Sidebar: Appears as a sidebar for your Wiki -wiki.page_name_desc_footer = _Footer: Appears as a footer for your Wiki +wiki.page_name_desc = Enter a name for this Wiki page. Some special names are: 'Home', '_Sidebar' and '_Footer'. activity = Activity activity.period.filter_label = Period: diff --git a/templates/repo/wiki/new.tmpl b/templates/repo/wiki/new.tmpl index 83f937f9f44c1..ca2bede8af31d 100644 --- a/templates/repo/wiki/new.tmpl +++ b/templates/repo/wiki/new.tmpl @@ -18,11 +18,6 @@
{{.i18n.Tr "repo.wiki.page_name_desc"}} -