Browse Source

route fixes

pull/946/head
Alexey Makhov 10 years ago
parent
commit
33c0c4fbe0
  1. 2
      cmd/web.go
  2. 1
      routers/repo/commit.go
  3. 4
      templates/repo/diff.tmpl

2
cmd/web.go

@ -373,7 +373,6 @@ func runWeb(ctx *cli.Context) {
m.Group("/:username/:reponame", func() {
m.Get("/settings", repo.Settings)
m.Post("/settings", bindIgnErr(auth.RepoSettingForm{}), repo.SettingsPost)
m.Post("/commit/comment/:action/:commitId", repo.CreateCommitComment)
m.Group("/settings", func() {
m.Route("/collaboration", "GET,POST", repo.SettingsCollaboration)
m.Get("/hooks", repo.Webhooks)
@ -442,6 +441,7 @@ func runWeb(ctx *cli.Context) {
m.Get("/commits/*", repo.RefCommits)
m.Get("/commit/comment/*", repo.GetCommentForm)
m.Get("/commit/*", repo.Diff)
m.Post("/commit/comment/:action/:commitId", repo.CreateCommitComment)
}, middleware.RepoRef())
m.Get("/compare/:before([a-z0-9]+)...:after([a-z0-9]+)", repo.CompareDiff)

1
routers/repo/commit.go

@ -386,7 +386,6 @@ func CreateCommitComment(ctx *middleware.Context) {
content := ctx.Query("content")
line := ctx.Query("line")
lineRe, err := regexp.Compile("[0-9]+L[0-9]+")
fmt.Println(ctx.Locale.Tr("repo.commits.comment.required_field"))
if len(content) > 0 && lineRe.MatchString(line) {
switch ctx.Params(":action") {
case "new":

4
templates/repo/diff.tmpl

@ -112,7 +112,7 @@
<span rel="diff-{{$lineNum}}">{{if $line.RightIdx}}{{$line.RightIdx}}{{end}}</span>
</td>
<td class="lines-code">
{{if $.SignedUser}}{{if $k}}<b class="octicon octicon-plus" aria-label="Add line comment"></b>{{end}}{{end}}
{{if $.SignedUser}}{{if $k}}<b class="octicon octicon-plus" aria-label="{{$.i18n.Tr "repo.commits.comment.comment_line"}}"></b>{{end}}{{end}}
<pre>{{$line.Content}}</pre>
</td>
</tr>
@ -128,7 +128,7 @@
alt=""></a>
<div class="panel panel-radius">
<p class="panel-header clear"><a class="author-name" href="#">{{.Poster.Name}}</a>
<p class="panel-header clear"><a class="author-name" href="{{AppSubUrl}}/{{.Poster.Name}}">{{.Poster.Name}}</a>
<span class="date">{{TimeSince .Created $.Lang}}</span>
<span class="action right">
{{if $.IsRepositoryOwner}}

Loading…
Cancel
Save