Add edit issue
This commit is contained in:
parent
2c073afbec
commit
ffa59739b6
|
@ -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.
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -4,17 +4,17 @@
|
|||
{{template "repo/toolbar" .}}
|
||||
<div id="body" class="container">
|
||||
<div id="issue">
|
||||
<div id="issue-{issue.id}" class="issue-whole issue-is-opening">
|
||||
<div id="issue-{{.Issue.Id}}" class="issue-whole issue-is-opening">
|
||||
<div class="issue-head clearfix">
|
||||
<div class="number pull-right">#{{.Issue.Index}}</div>
|
||||
<a class="author pull-left" href="/user/{{.Issue.Poster.Name}}"><img class="avatar" src="{{.Issue.Poster.AvatarLink}}" alt="" width="30"/></a>
|
||||
<h1 class="title pull-left">{{.Issue.Name}}</h1>
|
||||
<input id="issue-edit-title" class="form-control input-lg pull-left hidden" type="text" value="{issue.title}" data-ajax-rel="issue-edit-save" data-ajax-val="val" data-ajax-field="title"/>
|
||||
<input type="hidden" value="{issue.id}" data-ajax-rel="issue-edit-save" data-ajax-val="val" data-ajax-field="issue_id"/>
|
||||
<input id="issue-edit-title" class="form-control input-lg pull-left hidden" type="text" value="{{.Issue.Name}}" data-ajax-rel="issue-edit-save" data-ajax-val="val" data-ajax-field="title"/>
|
||||
<input type="hidden" value="{{.Issue.Id}}" data-ajax-rel="issue-edit-save" data-ajax-val="val" data-ajax-field="issue_id"/>
|
||||
<p class="info pull-left">
|
||||
<a class="btn btn-default pull-right issue-edit" href="#" id="issue-edit-btn">Edit</a>
|
||||
<a class="btn btn-danger pull-right issue-edit-cancel hidden" href="#">Cancel</a>
|
||||
<a class="btn btn-primary pull-right issue-edit-save hidden" href="#" data-ajax="{issue.edit.save.link}" data-ajax-name="issue-edit-save" data-ajax-method="post">Save</a>
|
||||
<a class="btn btn-primary pull-right issue-edit-save hidden" href="#" data-ajax="/{{.RepositoryLink}}/issues/{{.Issue.Index}}" data-ajax-name="issue-edit-save" data-ajax-method="post">Save</a>
|
||||
<span class="status label label-{{if .Issue.IsClosed}}danger{{else}}success{{end}}">{{if .Issue.IsClosed}}Closed{{else}}Open{{end}}</span>
|
||||
<a href="/user/{{.Issue.Poster.Name}}" class="author"><strong>{{.Issue.Poster.Name}}</strong></a> opened this issue
|
||||
<span class="time">{{TimeSince .Issue.Created}}</span> · {{.Issue.NumComments}} comments
|
||||
|
@ -24,13 +24,13 @@
|
|||
<div class="panel panel-default issue-content">
|
||||
<div class="panel-body markdown">
|
||||
<div class="content">
|
||||
{{str2html .Issue.Content}}
|
||||
{{str2html .Issue.RenderedContent}}
|
||||
</div>
|
||||
<textarea class="form-control hidden" name="content" id="issue-edit-content" rows="10" data-ajax-rel="issue-edit-save" data-ajax-val="val" data-ajax-field="content">{issue.content}</textarea>
|
||||
<textarea class="form-control hidden" name="content" id="issue-edit-content" rows="10" data-ajax-rel="issue-edit-save" data-ajax-val="val" data-ajax-field="content">{{.Issue.Content}}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
{{range .Comments}}
|
||||
<div class="issue-child" id="issue-comment-{issue.comment.id}">
|
||||
<div class="issue-child" id="issue-comment-{{.Id}}">
|
||||
<a class="user pull-left" href="/user/{{.Poster.Name}}"><img class="avatar" src="{{.Poster.AvatarLink}}" alt=""/></a>
|
||||
<div class="issue-content panel panel-default">
|
||||
<div class="panel-heading">
|
||||
|
|
Loading…
Reference in New Issue
Block a user