]> source.dussan.org Git - gitea.git/commitdiff
wiki history improvements (#7391)
authorCherrg <michael@gnehr.de>
Thu, 11 Jul 2019 14:45:10 +0000 (16:45 +0200)
committerLunny Xiao <xiaolunwen@gmail.com>
Thu, 11 Jul 2019 14:45:10 +0000 (22:45 +0800)
* add history comments to detect page delete

Signed-off-by: Michael Gnehr <michael@gnehr.de>
* fix too much history entries
- caused by --follow flag
  - if files with same contents exists

Signed-off-by: Michael Gnehr <michael@gnehr.de>
* style imprevements wiki
- history - wrap long author names

Signed-off-by: Michael Gnehr <michael@gnehr.de>
modules/git/repo_commit.go
public/css/index.css
public/less/_markdown.less
routers/repo/wiki.go
templates/repo/wiki/revision.tmpl

index 8ea2a331458b4248f54e70cebb0b203cc0615d50..8429a57039337026b8e44d4c1ad8cabb256d663a 100644 (file)
@@ -266,6 +266,16 @@ func (repo *Repository) CommitsByFileAndRange(revision, file string, page int) (
        return repo.parsePrettyFormatLogToList(stdout)
 }
 
+// CommitsByFileAndRangeNoFollow return the commits according revison file and the page
+func (repo *Repository) CommitsByFileAndRangeNoFollow(revision, file string, page int) (*list.List, error) {
+       stdout, err := NewCommand("log", revision, "--skip="+strconv.Itoa((page-1)*50),
+               "--max-count="+strconv.Itoa(CommitsRangeSize), prettyLogFormat, "--", file).RunInDirBytes(repo.Path)
+       if err != nil {
+               return nil, err
+       }
+       return repo.parsePrettyFormatLogToList(stdout)
+}
+
 // FilesCountBetween return the number of files changed between two commits
 func (repo *Repository) FilesCountBetween(startCommitID, endCommitID string) (int, error) {
        stdout, err := NewCommand("diff", "--name-only", startCommitID+"..."+endCommitID).RunInDir(repo.Path)
index b948766b416b1bade68f106a955498d915a8714a..a260c8c706a17a4a13a5c0f2bf0d3ed38e143936 100644 (file)
@@ -292,7 +292,7 @@ footer .ui.left,footer .ui.right{line-height:40px}
 .markdown:not(code) .ui.list .list,.markdown:not(code) ol.ui.list ol,.markdown:not(code) ul.ui.list ul{padding-left:2em}
 .repository.wiki.revisions .ui.container>.ui.stackable.grid{flex-direction:row-reverse}
 .repository.wiki.revisions .ui.container>.ui.stackable.grid>.header{margin-top:0}
-.repository.wiki.revisions .ui.container>.ui.stackable.grid>.header .sub.header{padding-left:52px}
+.repository.wiki.revisions .ui.container>.ui.stackable.grid>.header .sub.header{padding-left:52px;word-break:break-word}
 .file-revisions-btn{display:block;float:left;margin-bottom:2px!important;padding:11px!important;margin-right:10px!important}
 .file-revisions-btn i{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}
 .home .logo{max-width:220px}
index 1dcc2caf94356f981fc124827dbbc4a016201f90..8c7b1125c97d24297c268814a32877ca18e463fc 100644 (file)
 
             .sub.header {
                 padding-left: 52px;
+                word-break: break-word;
             }
         }
     }
index 0fdf8536307e739c687502f32f5bc5a06b7897bd..0d965f2183937fa1bc907e3b830ab380fda3a60d 100644 (file)
@@ -248,9 +248,9 @@ func renderRevisionPage(ctx *context.Context) (*git.Repository, *git.TreeEntry)
        }
 
        // get Commit Count
-       commitsHistory, err := wikiRepo.CommitsByFileAndRange("master", pageFilename, page)
+       commitsHistory, err := wikiRepo.CommitsByFileAndRangeNoFollow("master", pageFilename, page)
        if err != nil {
-               ctx.ServerError("CommitsByFileAndRange", err)
+               ctx.ServerError("CommitsByFileAndRangeNoFollow", err)
                return nil, nil
        }
        commitsHistory = models.ValidateCommitsWithEmails(commitsHistory)
index a64c386edcade19a5842dfd51bfe419c30f69fe2..c3a4f7636b357ecc870251f9d354cc4c66fa69b7 100644 (file)
@@ -31,7 +31,7 @@
                        <div class="ui header eight wide column">
                                <a class="file-revisions-btn ui basic button" title="{{.i18n.Tr "repo.wiki.back_to_wiki"}}" href="{{.RepoLink}}/wiki/{{.PageURL}}" ><span>{{.revision}}</span> <i class="fa fa-fw fa-file-text-o"></i></a>
                                {{$title}}
-                               <div class="ui sub header">
+                               <div class="ui sub header wrap">
                                        {{$timeSince := TimeSince .Author.When $.Lang}}
                                        {{.i18n.Tr "repo.wiki.last_commit_info" .Author.Name $timeSince | Safe}}
                                </div>
@@ -52,8 +52,9 @@
                                        <table class="ui very basic striped fixed table single line" id="commits-table">
                                                <thead>
                                                        <tr>
-                                                               <th class="eight wide">{{.i18n.Tr "repo.commits.author"}}</th>
-                                                               <th class="four wide sha">SHA1</th>
+                                                               <th class="four wide">{{.i18n.Tr "repo.commits.author"}}</th>
+                                                               <th class="tree wide sha">SHA1</th>
+                                                               <th class="five wide message">{{.i18n.Tr "repo.commits.message"}}</th>
                                                                <th class="four wide">{{.i18n.Tr "repo.commits.date"}}</th>
                                                        </tr>
                                                </thead>
                                                                                        {{end}}
                                                                                </label>
                                                                        </td>
+                                                                       <td class="message">
+                                                                               <span class="message-wrapper">
+                                                                                       <span class="commit-summary has-emoji{{if gt .ParentCount 1}} grey text{{end}}" title="{{.Summary}}">{{.Summary}}</span>
+                                                                                       {{if IsMultilineCommitMessage .Message}}
+                                                                                       <button class="basic compact mini ui icon button commit-button"><i class="ellipsis horizontal icon"></i></button>
+                                                                                       <pre class="commit-body" style="display: none;">{{RenderCommitBody .Message $.RepoLink $.Repository.ComposeMetas}}</pre>
+                                                                                       {{end}}
+                                                                               </span>
+                                                                       </td>
                                                                        <td class="grey text">{{TimeSince .Author.When $.Lang}}</td>
                                                                </tr>
                                                        {{end}}