diff --git a/models/issue.go b/models/issue.go index 39558ae22..9fd1b905a 100644 --- a/models/issue.go +++ b/models/issue.go @@ -18,23 +18,24 @@ var ( // Issue represents an issue or pull request of repository. type Issue struct { - Id int64 - Index int64 // Index in one repository. - Name string - RepoId int64 `xorm:"index"` - Repo *Repository `xorm:"-"` - PosterId int64 - Poster *User `xorm:"-"` - MilestoneId int64 - AssigneeId int64 - IsPull bool // Indicates whether is a pull request or not. - IsClosed bool - Labels string `xorm:"TEXT"` - Mentions string `xorm:"TEXT"` - Content string `xorm:"TEXT"` - NumComments int - Created time.Time `xorm:"created"` - Updated time.Time `xorm:"updated"` + Id int64 + Index int64 // Index in one repository. + Name string + RepoId int64 `xorm:"index"` + Repo *Repository `xorm:"-"` + PosterId int64 + Poster *User `xorm:"-"` + MilestoneId int64 + AssigneeId int64 + IsPull bool // Indicates whether is a pull request or not. + IsClosed bool + Labels string `xorm:"TEXT"` + Mentions string `xorm:"TEXT"` + Content string `xorm:"TEXT"` + RenderedContent string `xorm:"-"` + NumComments int + Created time.Time `xorm:"created"` + Updated time.Time `xorm:"updated"` } // CreateIssue creates new issue for repository. diff --git a/routers/repo/issue.go b/routers/repo/issue.go index c89c8b568..b38967f71 100644 --- a/routers/repo/issue.go +++ b/routers/repo/issue.go @@ -152,7 +152,7 @@ func ViewIssue(ctx *middleware.Context, params martini.Params) { return } issue.Poster = u - issue.Content = string(base.RenderMarkdown([]byte(issue.Content), "")) + issue.RenderedContent = string(base.RenderMarkdown([]byte(issue.Content), "")) // Get comments. comments, err := models.GetIssueComments(issue.Id) @@ -216,8 +216,12 @@ func UpdateIssue(ctx *middleware.Context, params martini.Params, form auth.Creat return } - ctx.Data["Title"] = issue.Name - ctx.Data["Issue"] = issue + ctx.JSON(200, map[string]interface{}{ + "ok": true, + "title": issue.Name, + "content": string(base.RenderMarkdown([]byte(issue.Content), "")), + "raw_content": issue.Content, + }) } func Comment(ctx *middleware.Context, params martini.Params) { diff --git a/templates/issue/view.tmpl b/templates/issue/view.tmpl index c357f5354..c6f1444e4 100644 --- a/templates/issue/view.tmpl +++ b/templates/issue/view.tmpl @@ -4,17 +4,17 @@ {{template "repo/toolbar" .}}
Edit - + {{if .Issue.IsClosed}}Closed{{else}}Open{{end}} {{.Issue.Poster.Name}} opened this issue {{TimeSince .Issue.Created}} ยท {{.Issue.NumComments}} comments @@ -24,13 +24,13 @@