Browse Source

ui and pulls index fix

pull/1524/merge
Unknwon 9 years ago
parent
commit
2a2a8cd619
  1. 4
      models/repo.go
  2. 2
      public/css/gogs.min.css
  3. 10
      public/less/_dashboard.less
  4. 2
      routers/repo/issue.go
  5. 2
      routers/repo/pull.go
  6. 13
      templates/user/dashboard/issues.tmpl

4
models/repo.go

@ -268,6 +268,10 @@ func (repo *Repository) IsOwnedBy(userID int64) bool {
return repo.OwnerID == userID return repo.OwnerID == userID
} }
func (repo *Repository) NextIssueIndex() int64 {
return int64(repo.NumIssues+repo.NumPulls) + 1
}
var ( var (
DescPattern = regexp.MustCompile(`https?://\S+`) DescPattern = regexp.MustCompile(`https?://\S+`)
) )

2
public/css/gogs.min.css vendored

File diff suppressed because one or more lines are too long

10
public/less/_dashboard.less

@ -11,10 +11,20 @@
} }
} }
.filter.menu { .filter.menu {
.item {
text-align: left;
.floating.label {
top: 7px;
left: 95%;
}
}
.item.active { .item.active {
background-color: #4183c4; background-color: #4183c4;
color: #FFF; color: #FFF;
} }
.item .text {
width: 90%;
}
} }
.ui.right .head.menu { .ui.right .head.menu {
margin-top: -5px; margin-top: -5px;

2
routers/repo/issue.go

@ -350,7 +350,7 @@ func NewIssuePost(ctx *middleware.Context, form auth.CreateIssueForm) {
issue := &models.Issue{ issue := &models.Issue{
RepoID: ctx.Repo.Repository.ID, RepoID: ctx.Repo.Repository.ID,
Index: int64(repo.NumIssues) + int64(repo.NumPulls) + 1, Index: repo.NextIssueIndex(),
Name: form.Title, Name: form.Title,
PosterID: ctx.User.Id, PosterID: ctx.User.Id,
Poster: ctx.User, Poster: ctx.User,

2
routers/repo/pull.go

@ -598,7 +598,7 @@ func CompareAndPullRequestPost(ctx *middleware.Context, form auth.CreateIssueFor
pull := &models.Issue{ pull := &models.Issue{
RepoID: repo.ID, RepoID: repo.ID,
Index: int64(repo.NumIssues) + 1, Index: repo.NextIssueIndex(),
Name: form.Title, Name: form.Title,
PosterID: ctx.User.Id, PosterID: ctx.User.Id,
Poster: ctx.User, Poster: ctx.User,

13
templates/user/dashboard/issues.tmpl

@ -5,23 +5,26 @@
<div class="ui grid"> <div class="ui grid">
<div class="four wide column"> <div class="four wide column">
<div class="ui secondary vertical filter menu"> <div class="ui secondary vertical filter menu">
<a class="{{if eq .ViewType "all"}}active{{end}} item" href="{{.Link}}?repo={{.RepoID}}&state={{.State}}"> <a class="{{if eq .ViewType "all"}}ui basic blue button{{end}} item" href="{{.Link}}?repo={{.RepoID}}&state={{.State}}">
{{.i18n.Tr "home.issues.in_your_repos"}} {{.i18n.Tr "home.issues.in_your_repos"}}
<strong class="ui right">{{.IssueStats.AllCount}}</strong> <strong class="ui right">{{.IssueStats.AllCount}}</strong>
</a> </a>
{{if not .ContextUser.IsOrganization}} {{if not .ContextUser.IsOrganization}}
<a class="{{if eq .ViewType "assigned"}}active{{end}} item" href="{{.Link}}?type=assigned&repo={{.RepoID}}&state={{.State}}"> <a class="{{if eq .ViewType "assigned"}}ui basic blue button{{end}} item" href="{{.Link}}?type=assigned&repo={{.RepoID}}&state={{.State}}">
{{.i18n.Tr "repo.issues.filter_type.assigned_to_you"}} {{.i18n.Tr "repo.issues.filter_type.assigned_to_you"}}
<strong class="ui right">{{.IssueStats.AssignCount}}</strong> <strong class="ui right">{{.IssueStats.AssignCount}}</strong>
</a> </a>
<a class="{{if eq .ViewType "created_by"}}active{{end}} item" href="{{.Link}}?type=created_by&repo={{.RepoID}}&state={{.State}}"> <a class="{{if eq .ViewType "created_by"}}ui basic blue button{{end}} item" href="{{.Link}}?type=created_by&repo={{.RepoID}}&state={{.State}}">
{{.i18n.Tr "repo.issues.filter_type.created_by_you"}} {{.i18n.Tr "repo.issues.filter_type.created_by_you"}}
<strong class="ui right">{{.IssueStats.CreateCount}}</strong> <strong class="ui right">{{.IssueStats.CreateCount}}</strong>
</a> </a>
{{end}} {{end}}
<div class="ui divider"></div> <div class="ui divider"></div>
{{range .Repos}} {{range .Repos}}
<a class="{{if eq $.RepoID .ID}}active{{end}} item" href="{{$.Link}}?type={{$.ViewType}}{{if not (eq $.RepoID .ID)}}&repo={{.ID}}{{end}}&state={{$.State}}">{{$.ContextUser.Name}}/{{.Name}} <strong class="ui right">{{if $.IsShowClosed}}{{.NumClosedIssues}}{{else}}{{.NumOpenIssues}}{{end}}</strong></a> <a class="{{if eq $.RepoID .ID}}ui basic blue button{{end}} repo name item" href="{{$.Link}}?type={{$.ViewType}}{{if not (eq $.RepoID .ID)}}&repo={{.ID}}{{end}}&state={{$.State}}">
<span class="text truncate">{{$.ContextUser.Name}}/{{.Name}}12312312312312312</span>
<div class="floating ui {{if $.IsShowClosed}}red{{else}}green{{end}} label">{{if $.IsShowClosed}}{{.NumClosedIssues}}{{else}}{{.NumOpenIssues}}{{end}}</div>
</a>
{{end}} {{end}}
</div> </div>
</div> </div>
@ -41,7 +44,7 @@
{{range .Issues}} {{range .Issues}}
{{ $timeStr:= TimeSince .Created $.Lang }} {{ $timeStr:= TimeSince .Created $.Lang }}
<li class="item"> <li class="item">
<div class="ui label">#{{.ID}}</div> <div class="ui label">{{if not $.RepoID}}{{.Repo.Name}}{{end}}#{{.Index}}</div>
<a class="title" href="{{AppSubUrl}}/{{.Repo.Owner.Name}}/{{.Repo.Name}}/issues/{{.Index}}">{{.Name}}</a> <a class="title" href="{{AppSubUrl}}/{{.Repo.Owner.Name}}/{{.Repo.Name}}/issues/{{.Index}}">{{.Name}}</a>
{{if .NumComments}} {{if .NumComments}}

Loading…
Cancel
Save