aboutsummaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2023-04-20 01:50:10 +0800
committerGitHub <noreply@github.com>2023-04-19 13:50:10 -0400
commitb39a5bbbd610ba30651218658caaec1c86d6bca1 (patch)
tree392d7ca47badb62190b286cb2a82ef1e9042956a /templates
parent738f2af5274e8c82ff5bff87d80b10c7ab391667 (diff)
downloadgitea-b39a5bbbd610ba30651218658caaec1c86d6bca1.tar.gz
gitea-b39a5bbbd610ba30651218658caaec1c86d6bca1.zip
Make wiki title supports dashes and improve wiki name related features (#24143)
Close #7570 1. Clearly define the wiki path behaviors, see `services/wiki/wiki_path.go` and tests 2. Keep compatibility with old contents 3. Allow to use dashes in titles, eg: "2000-01-02 Meeting record" 4. Add a "Pages" link in the dropdown, otherwise users can't go to the Pages page easily. 5. Add a "View original git file" link in the Pages list, even if some file names are broken, users still have a chance to edit or remove it, without cloning the wiki repo to local. 6. Fix 500 error when the name contains prefix spaces. This PR also introduces the ability to support sub-directories, but it can't be done at the moment due to there are a lot of legacy wiki data, which use "%2F" in file names. ![image](https://user-images.githubusercontent.com/2114189/232239004-3359d7b9-7bf3-4ff3-8446-bfb0e79645dd.png) ![image](https://user-images.githubusercontent.com/2114189/232239020-74b92c72-bf73-4377-a319-1c85609f82b1.png) Co-authored-by: Giteabot <teabot@gitea.io>
Diffstat (limited to 'templates')
-rw-r--r--templates/repo/wiki/pages.tmpl11
-rw-r--r--templates/repo/wiki/view.tmpl44
2 files changed, 26 insertions, 29 deletions
diff --git a/templates/repo/wiki/pages.tmpl b/templates/repo/wiki/pages.tmpl
index 743574d0a5..97abf9b543 100644
--- a/templates/repo/wiki/pages.tmpl
+++ b/templates/repo/wiki/pages.tmpl
@@ -3,22 +3,21 @@
{{template "repo/header" .}}
<div class="ui container">
<h2 class="ui header gt-df gt-ac gt-sb">
- <div>
- {{.locale.Tr "repo.wiki.pages"}}
- </div>
- <div>
+ <span>{{.locale.Tr "repo.wiki.pages"}}</span>
+ <span>
{{if and .CanWriteWiki (not .IsRepositoryMirror)}}
<a class="ui green small button" href="{{.RepoLink}}/wiki?action=_new">{{.locale.Tr "repo.wiki.new_page_button"}}</a>
{{end}}
- </div>
+ </span>
</h2>
- <table class="ui table">
+ <table class="ui table wiki-pages-list">
<tbody>
{{range .Pages}}
<tr>
<td>
{{svg "octicon-file"}}
<a href="{{$.RepoLink}}/wiki/{{.SubURL}}">{{.Name}}</a>
+ <a class="wiki-git-entry" href="{{$.RepoLink}}/wiki/{{.GitEntryName | PathEscape}}" data-tooltip-content="{{$.locale.Tr "repo.wiki.original_git_entry_tooltip"}}">{{svg "octicon-chevron-right"}}</a>
</td>
{{$timeSince := TimeSinceUnix .UpdatedUnix $.locale}}
<td class="text right">{{$.locale.Tr "repo.wiki.last_updated" $timeSince | Safe}}</td>
diff --git a/templates/repo/wiki/view.tmpl b/templates/repo/wiki/view.tmpl
index 318006d96e..123511d011 100644
--- a/templates/repo/wiki/view.tmpl
+++ b/templates/repo/wiki/view.tmpl
@@ -5,34 +5,32 @@
<div class="ui container">
<div class="repo-button-row gt-df gt-ac gt-sb gt-fw">
<div class="gt-df gt-ac">
- <div class="choose page">
- <div class="ui floating filter dropdown" data-no-results="{{.locale.Tr "repo.pulls.no_results"}}">
- <div class="ui basic small button">
- <span class="text">
- {{.locale.Tr "repo.wiki.page"}}:
- <strong>{{$title}}</strong>
- </span>
- {{svg "octicon-triangle-down" 14 "dropdown icon"}}
+ <div class="ui floating filter dropdown" data-no-results="{{.locale.Tr "repo.pulls.no_results"}}">
+ <div class="ui basic small button">
+ <span class="text">
+ {{.locale.Tr "repo.wiki.page"}}:
+ <strong>{{$title}}</strong>
+ </span>
+ {{svg "octicon-triangle-down" 14 "dropdown icon"}}
+ </div>
+ <div class="menu">
+ <div class="ui icon search input">
+ <i class="icon gt-df gt-ac gt-jc gt-m-0">{{svg "octicon-filter" 16}}</i>
+ <input name="search" placeholder="{{.locale.Tr "repo.wiki.filter_page"}}...">
</div>
- <div class="menu">
- <div class="ui icon search input">
- <i class="icon gt-df gt-ac gt-jc gt-m-0">{{svg "octicon-filter" 16}}</i>
- <input name="search" placeholder="{{.locale.Tr "repo.wiki.filter_page"}}...">
- </div>
- <div class="scrolling menu">
- {{range .Pages}}
- <div class="item {{if eq $.Title .Name}}selected{{end}}" data-url="{{$.RepoLink}}/wiki/{{.SubURL}}">{{.Name}}</div>
- {{end}}
- </div>
+ <div class="scrolling menu">
+ <a class="item muted" href="{{.RepoLink}}/wiki/?action=_pages">{{.locale.Tr "repo.wiki.pages"}}</a>
+ <div class="ui divider"></div>
+ {{range .Pages}}
+ <a class="item {{if eq $.Title .Name}}selected{{end}}" href="{{$.RepoLink}}/wiki/{{.SubURL}}">{{.Name}}</a>
+ {{end}}
</div>
</div>
</div>
</div>
- <div class="gt-df gt-ac">
- <div class="ui action small input" id="clone-panel">
- {{template "repo/clone_buttons" .}}
- {{template "repo/clone_script" .}}
- </div>
+ <div class="ui action small input gt-df gt-ac" id="clone-panel">
+ {{template "repo/clone_buttons" .}}
+ {{template "repo/clone_script" .}}
</div>
</div>
<div class="ui dividing header">