finish create issue with milestone
This commit is contained in:
parent
922f3f3062
commit
09a1b2a1f5
10 changed files with 257 additions and 155 deletions
|
@ -368,10 +368,14 @@ commits.newer = Newer
|
||||||
|
|
||||||
issues.new = New Issue
|
issues.new = New Issue
|
||||||
issues.new.labels = Labels
|
issues.new.labels = Labels
|
||||||
|
issues.new.no_label = No Label
|
||||||
issues.new.clear_labels = Clear labels
|
issues.new.clear_labels = Clear labels
|
||||||
issues.new.milestone = Milestone
|
issues.new.milestone = Milestone
|
||||||
|
issues.new.no_milestone = No Milestone
|
||||||
|
issues.new.clear_milestone = Clear milestone
|
||||||
|
issues.new.open_milestone = Open Milestones
|
||||||
|
issues.new.closed_milestone = Closed Milestones
|
||||||
issues.new.assignee = Assignee
|
issues.new.assignee = Assignee
|
||||||
issues.new.no_label = No Label
|
|
||||||
issues.create = Create Issue
|
issues.create = Create Issue
|
||||||
issues.new_label = New Label
|
issues.new_label = New Label
|
||||||
issues.new_label_placeholder = Label name...
|
issues.new_label_placeholder = Label name...
|
||||||
|
|
|
@ -267,7 +267,8 @@ func (err ErrLabelNotExist) Error() string {
|
||||||
// \/ \/ \/ \/ \/
|
// \/ \/ \/ \/ \/
|
||||||
|
|
||||||
type ErrMilestoneNotExist struct {
|
type ErrMilestoneNotExist struct {
|
||||||
ID int64
|
ID int64
|
||||||
|
RepoID int64
|
||||||
}
|
}
|
||||||
|
|
||||||
func IsErrMilestoneNotExist(err error) bool {
|
func IsErrMilestoneNotExist(err error) bool {
|
||||||
|
@ -276,5 +277,5 @@ func IsErrMilestoneNotExist(err error) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (err ErrMilestoneNotExist) Error() string {
|
func (err ErrMilestoneNotExist) Error() string {
|
||||||
return fmt.Sprintf("milestone does not exist [id: %d]", err.ID)
|
return fmt.Sprintf("milestone does not exist [id: %d, repo_id: %d]", err.ID, err.RepoID)
|
||||||
}
|
}
|
||||||
|
|
|
@ -164,16 +164,13 @@ func NewIssue(issue *Issue, labelIDs []int64) (err error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = sess.Commit(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if issue.MilestoneID > 0 {
|
if issue.MilestoneID > 0 {
|
||||||
// FIXES(280): Update milestone counter.
|
if err = changeMilestoneAssign(sess, 0, issue); err != nil {
|
||||||
return ChangeMilestoneAssign(0, issue.MilestoneID, issue)
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return sess.Commit()
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetIssueByRef returns an Issue specified by a GFM reference.
|
// GetIssueByRef returns an Issue specified by a GFM reference.
|
||||||
|
@ -497,15 +494,14 @@ func GetUserIssueStats(uid int64, filterMode int) *IssueStats {
|
||||||
return stats
|
return stats
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func updateIssue(e Engine, issue *Issue) error {
|
||||||
|
_, err := e.Id(issue.ID).AllCols().Update(issue)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
// UpdateIssue updates information of issue.
|
// UpdateIssue updates information of issue.
|
||||||
func UpdateIssue(issue *Issue) error {
|
func UpdateIssue(issue *Issue) error {
|
||||||
_, err := x.Id(issue.ID).AllCols().Update(issue)
|
return updateIssue(x, issue)
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// UpdateIssueUserByStatus updates issue-user pairs by issue status.
|
// UpdateIssueUserByStatus updates issue-user pairs by issue status.
|
||||||
|
@ -712,7 +708,7 @@ func NewIssueLabel(issueID, labelID int64) error {
|
||||||
|
|
||||||
func getIssueLabels(e Engine, issueID int64) ([]*IssueLabel, error) {
|
func getIssueLabels(e Engine, issueID int64) ([]*IssueLabel, error) {
|
||||||
issueLabels := make([]*IssueLabel, 0, 10)
|
issueLabels := make([]*IssueLabel, 0, 10)
|
||||||
return issueLabels, e.Where("issue_id=?", issueID).Find(&issueLabels)
|
return issueLabels, e.Where("issue_id=?", issueID).Asc("label_id").Find(&issueLabels)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetIssueLabels returns all issue-label relations of given issue by ID.
|
// GetIssueLabels returns all issue-label relations of given issue by ID.
|
||||||
|
@ -802,14 +798,30 @@ func NewMilestone(m *Milestone) (err error) {
|
||||||
return sess.Commit()
|
return sess.Commit()
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetMilestoneByID returns the milestone of given ID.
|
func getMilestoneByID(e Engine, id int64) (*Milestone, error) {
|
||||||
func GetMilestoneByID(id int64) (*Milestone, error) {
|
|
||||||
m := &Milestone{ID: id}
|
m := &Milestone{ID: id}
|
||||||
has, err := x.Get(m)
|
has, err := x.Get(m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else if !has {
|
} else if !has {
|
||||||
return nil, ErrMilestoneNotExist{id}
|
return nil, ErrMilestoneNotExist{id, 0}
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetMilestoneByID returns the milestone of given ID.
|
||||||
|
func GetMilestoneByID(id int64) (*Milestone, error) {
|
||||||
|
return getMilestoneByID(x, id)
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetRepoMilestoneByID returns the milestone of given ID and repository.
|
||||||
|
func GetRepoMilestoneByID(repoID, milestoneID int64) (*Milestone, error) {
|
||||||
|
m := &Milestone{ID: milestoneID, RepoID: repoID}
|
||||||
|
has, err := x.Get(m)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
} else if !has {
|
||||||
|
return nil, ErrMilestoneNotExist{milestoneID, repoID}
|
||||||
}
|
}
|
||||||
return m, nil
|
return m, nil
|
||||||
}
|
}
|
||||||
|
@ -915,16 +927,9 @@ func ChangeMilestoneIssueStats(issue *Issue) error {
|
||||||
return UpdateMilestone(m)
|
return UpdateMilestone(m)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ChangeMilestoneAssign changes assignment of milestone for issue.
|
func changeMilestoneAssign(e *xorm.Session, oldMid int64, issue *Issue) error {
|
||||||
func ChangeMilestoneAssign(oldMid, mid int64, issue *Issue) (err error) {
|
|
||||||
sess := x.NewSession()
|
|
||||||
defer sess.Close()
|
|
||||||
if err = sess.Begin(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if oldMid > 0 {
|
if oldMid > 0 {
|
||||||
m, err := GetMilestoneByID(oldMid)
|
m, err := getMilestoneByID(e, oldMid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -934,20 +939,15 @@ func ChangeMilestoneAssign(oldMid, mid int64, issue *Issue) (err error) {
|
||||||
m.NumClosedIssues--
|
m.NumClosedIssues--
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, err = sess.Id(m.ID).AllCols().Update(m); err != nil {
|
if err = updateMilestone(e, m); err != nil {
|
||||||
sess.Rollback()
|
|
||||||
return err
|
return err
|
||||||
}
|
} else if _, err = e.Exec("UPDATE `issue_user` SET milestone_id=0 WHERE issue_id=?", issue.ID); err != nil {
|
||||||
|
|
||||||
rawSql := "UPDATE `issue_user` SET milestone_id = 0 WHERE issue_id = ?"
|
|
||||||
if _, err = sess.Exec(rawSql, issue.ID); err != nil {
|
|
||||||
sess.Rollback()
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if mid > 0 {
|
if issue.MilestoneID > 0 {
|
||||||
m, err := GetMilestoneByID(mid)
|
m, err := GetMilestoneByID(issue.MilestoneID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -961,16 +961,26 @@ func ChangeMilestoneAssign(oldMid, mid int64, issue *Issue) (err error) {
|
||||||
return ErrWrongIssueCounter
|
return ErrWrongIssueCounter
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, err = sess.Id(m.ID).AllCols().Update(m); err != nil {
|
if err = updateMilestone(e, m); err != nil {
|
||||||
sess.Rollback()
|
return err
|
||||||
|
} else if _, err = e.Exec("UPDATE `issue_user` SET milestone_id=? WHERE issue_id=?", m.ID, issue.ID); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
rawSql := "UPDATE `issue_user` SET milestone_id = ? WHERE issue_id = ?"
|
return nil
|
||||||
if _, err = sess.Exec(rawSql, m.ID, issue.ID); err != nil {
|
}
|
||||||
sess.Rollback()
|
|
||||||
return err
|
// ChangeMilestoneAssign changes assignment of milestone for issue.
|
||||||
}
|
func ChangeMilestoneAssign(oldMid int64, issue *Issue) (err error) {
|
||||||
|
sess := x.NewSession()
|
||||||
|
defer sess.Close()
|
||||||
|
if err = sess.Begin(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if err = changeMilestoneAssign(sess, oldMid, issue); err != nil {
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return sess.Commit()
|
return sess.Commit()
|
||||||
|
|
File diff suppressed because one or more lines are too long
2
public/css/gogs.min.css
vendored
2
public/css/gogs.min.css
vendored
File diff suppressed because one or more lines are too long
|
@ -2,6 +2,94 @@
|
||||||
|
|
||||||
var csrf;
|
var csrf;
|
||||||
|
|
||||||
|
function initCommentForm() {
|
||||||
|
if ($('.comment.form').length == 0) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var $form = $('.comment.form');
|
||||||
|
$form.find('.tabular.menu .item').tab();
|
||||||
|
$form.find('.tabular.menu .item[data-tab="preview"]').click(function () {
|
||||||
|
var $this = $(this);
|
||||||
|
$.post($this.data('url'), {
|
||||||
|
"_csrf": csrf,
|
||||||
|
"mode": "gfm",
|
||||||
|
"context": $this.data('context'),
|
||||||
|
"text": $form.find('.tab.segment[data-tab="write"] textarea').val()
|
||||||
|
},
|
||||||
|
function (data) {
|
||||||
|
$form.find('.tab.segment[data-tab="preview"]').html(data);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Labels
|
||||||
|
var $list = $('.ui.labels.list');
|
||||||
|
var $no_select = $list.find('.no-select');
|
||||||
|
$('.select-label .menu .item:not(.no-select)').click(function () {
|
||||||
|
if ($(this).hasClass('checked')) {
|
||||||
|
$(this).removeClass('checked')
|
||||||
|
$(this).find('.octicon').removeClass('octicon-check')
|
||||||
|
} else {
|
||||||
|
$(this).addClass('checked')
|
||||||
|
$(this).find('.octicon').addClass('octicon-check')
|
||||||
|
}
|
||||||
|
|
||||||
|
var label_ids = "";
|
||||||
|
$(this).parent().find('.item').each(function () {
|
||||||
|
if ($(this).hasClass('checked')) {
|
||||||
|
label_ids += $(this).data('id') + ",";
|
||||||
|
$($(this).data('id-selector')).removeClass('hide');
|
||||||
|
} else {
|
||||||
|
$($(this).data('id-selector')).addClass('hide');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (label_ids.length == 0) {
|
||||||
|
$no_select.removeClass('hide');
|
||||||
|
} else {
|
||||||
|
$no_select.addClass('hide');
|
||||||
|
}
|
||||||
|
$($(this).parent().data('id')).val(label_ids);
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
$('.select-label .menu .no-select.item').click(function () {
|
||||||
|
$(this).parent().find('.item').each(function () {
|
||||||
|
$(this).removeClass('checked');
|
||||||
|
$(this).find('.octicon').removeClass('octicon-check');
|
||||||
|
});
|
||||||
|
|
||||||
|
$list.find('.item').each(function () {
|
||||||
|
$(this).addClass('hide');
|
||||||
|
});
|
||||||
|
$no_select.removeClass('hide');
|
||||||
|
$($(this).parent().data('id')).val('');
|
||||||
|
});
|
||||||
|
|
||||||
|
var $milestone_menu = $('.select-milestone .menu');
|
||||||
|
var $milestone_list = $('.ui.select-milestone.list')
|
||||||
|
// Milestones
|
||||||
|
$milestone_menu.find('.item:not(.no-select)').click(function () {
|
||||||
|
$(this).parent().find('.item').each(function () {
|
||||||
|
$(this).removeClass('selected active')
|
||||||
|
});
|
||||||
|
|
||||||
|
$(this).addClass('selected active');
|
||||||
|
$milestone_list.find('.selected').html('<a class="item" href=' + $(this).data('href') + '>' +
|
||||||
|
$(this).text() + '</a>');
|
||||||
|
$('.ui.select-milestone.list .no-select').addClass('hide');
|
||||||
|
$('#milestone_id').val($(this).data('id'));
|
||||||
|
});
|
||||||
|
$milestone_menu.find('.no-select.item').click(function () {
|
||||||
|
$(this).parent().find('.item:not(.no-select)').each(function () {
|
||||||
|
$(this).removeClass('selected active')
|
||||||
|
});
|
||||||
|
|
||||||
|
$milestone_list.find('.selected').html('');
|
||||||
|
$milestone_list.find('.no-select').removeClass('hide');
|
||||||
|
$('#milestone_id').val('');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function initInstall() {
|
function initInstall() {
|
||||||
if ($('.install').length == 0) {
|
if ($('.install').length == 0) {
|
||||||
return;
|
return;
|
||||||
|
@ -133,66 +221,6 @@ $(document).ready(function () {
|
||||||
});
|
});
|
||||||
$('.poping.up').popup();
|
$('.poping.up').popup();
|
||||||
|
|
||||||
// Comment form
|
|
||||||
if ($('.comment.form').length > 0) {
|
|
||||||
var $form = $(this);
|
|
||||||
$form.find('.tabular.menu .item').tab();
|
|
||||||
$form.find('.tabular.menu .item[data-tab="preview"]').click(function () {
|
|
||||||
var $this = $(this);
|
|
||||||
$.post($this.data('url'), {
|
|
||||||
"_csrf": csrf,
|
|
||||||
"mode": "gfm",
|
|
||||||
"context": $this.data('context'),
|
|
||||||
"text": $form.find('.tab.segment[data-tab="write"] textarea').val()
|
|
||||||
},
|
|
||||||
function (data) {
|
|
||||||
$form.find('.tab.segment[data-tab="preview"]').html(data);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Labels
|
|
||||||
var $list = $('.ui.labels.list');
|
|
||||||
var $no_select = $list.find('.no-select');
|
|
||||||
$('.select-label .item:not(.no-select)').click(function () {
|
|
||||||
if ($(this).hasClass('checked')) {
|
|
||||||
$(this).removeClass('checked')
|
|
||||||
$(this).find('.octicon').removeClass('octicon-check')
|
|
||||||
} else {
|
|
||||||
$(this).addClass('checked')
|
|
||||||
$(this).find('.octicon').addClass('octicon-check')
|
|
||||||
}
|
|
||||||
|
|
||||||
var label_ids = "";
|
|
||||||
$(this).parent().find('.item').each(function () {
|
|
||||||
if ($(this).hasClass('checked')) {
|
|
||||||
label_ids += $(this).data('id') + ",";
|
|
||||||
$($(this).data('id-selector')).removeClass('hide');
|
|
||||||
} else {
|
|
||||||
$($(this).data('id-selector')).addClass('hide');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (label_ids.length == 0) {
|
|
||||||
$no_select.removeClass('hide');
|
|
||||||
} else {
|
|
||||||
$no_select.addClass('hide');
|
|
||||||
}
|
|
||||||
$($(this).parent().data('id')).val(label_ids);
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
$('.select-label .no-select.item').click(function () {
|
|
||||||
$(this).parent().find('.item').each(function () {
|
|
||||||
$(this).removeClass('checked');
|
|
||||||
$(this).find('.octicon').removeClass('octicon-check');
|
|
||||||
});
|
|
||||||
|
|
||||||
$list.find('.item').each(function () {
|
|
||||||
$(this).addClass('hide');
|
|
||||||
});
|
|
||||||
$no_select.removeClass('hide');
|
|
||||||
$($(this).parent().data('id')).val('');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Helpers.
|
// Helpers.
|
||||||
$('.delete-button').click(function () {
|
$('.delete-button').click(function () {
|
||||||
|
@ -211,6 +239,7 @@ $(document).ready(function () {
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
initCommentForm();
|
||||||
initInstall();
|
initInstall();
|
||||||
initRepository();
|
initRepository();
|
||||||
});
|
});
|
|
@ -102,7 +102,7 @@ footer {
|
||||||
}
|
}
|
||||||
|
|
||||||
.hide {
|
.hide {
|
||||||
display: none!important;
|
display: none;
|
||||||
}
|
}
|
||||||
.center {
|
.center {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
|
@ -29,18 +29,27 @@
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.metas .ui.list {
|
.metas {
|
||||||
.label.color {
|
.menu {
|
||||||
padding: 0 8px;
|
max-height: 300px;
|
||||||
margin-right: 5px;
|
overflow-x: auto;
|
||||||
}
|
}
|
||||||
a {
|
.ui.list {
|
||||||
padding-top: 5px;
|
.hide {
|
||||||
padding-right: 10px;
|
display: none!important;
|
||||||
.text {
|
}
|
||||||
color: #444;
|
.label.color {
|
||||||
&:hover {
|
padding: 0 8px;
|
||||||
color: #000;
|
margin-right: 5px;
|
||||||
|
}
|
||||||
|
a {
|
||||||
|
padding-top: 5px;
|
||||||
|
padding-right: 10px;
|
||||||
|
.text {
|
||||||
|
color: #444;
|
||||||
|
&:hover {
|
||||||
|
color: #000;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -190,19 +190,21 @@ func NewIssue(ctx *middleware.Context) {
|
||||||
ctx.Handle(500, "GetLabelsByRepoID: %v", err)
|
ctx.Handle(500, "GetLabelsByRepoID: %v", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// // Get all milestones.
|
ctx.Data["OpenMilestones"], err = models.GetMilestones(repo.ID, -1, false)
|
||||||
// ctx.Data["OpenMilestones"], err = models.GetMilestones(repo.ID, -1, false)
|
if err != nil {
|
||||||
// if err != nil {
|
ctx.Handle(500, "GetMilestones: %v", err)
|
||||||
// ctx.Handle(500, "GetMilestones.1: %v", err)
|
return
|
||||||
// return
|
}
|
||||||
// }
|
ctx.Data["ClosedMilestones"], err = models.GetMilestones(repo.ID, -1, true)
|
||||||
// ctx.Data["ClosedMilestones"], err = models.GetMilestones(repo.ID, -1, true)
|
if err != nil {
|
||||||
// if err != nil {
|
ctx.Handle(500, "GetMilestones: %v", err)
|
||||||
// ctx.Handle(500, "GetMilestones.2: %v", err)
|
return
|
||||||
// return
|
}
|
||||||
// }
|
|
||||||
|
// ctx.Data["AssigneeID"] = 0
|
||||||
|
// ctx.Data["Assignees"], err = repo.GetCollaborators()
|
||||||
|
}
|
||||||
|
|
||||||
// us, err := repo.GetCollaborators()
|
// us, err := repo.GetCollaborators()
|
||||||
// if err != nil {
|
// if err != nil {
|
||||||
|
@ -222,8 +224,9 @@ func NewIssuePost(ctx *middleware.Context, form auth.CreateIssueForm) {
|
||||||
ctx.Data["AttachmentAllowedTypes"] = setting.AttachmentAllowedTypes
|
ctx.Data["AttachmentAllowedTypes"] = setting.AttachmentAllowedTypes
|
||||||
|
|
||||||
var (
|
var (
|
||||||
repo = ctx.Repo.Repository
|
repo = ctx.Repo.Repository
|
||||||
labelIDs []int64
|
labelIDs []int64
|
||||||
|
milestoneID int64
|
||||||
)
|
)
|
||||||
if ctx.User.IsAdmin {
|
if ctx.User.IsAdmin {
|
||||||
// Check labels.
|
// Check labels.
|
||||||
|
@ -244,6 +247,25 @@ func NewIssuePost(ctx *middleware.Context, form auth.CreateIssueForm) {
|
||||||
ctx.Data["HasSelectedLabel"] = hasSelected
|
ctx.Data["HasSelectedLabel"] = hasSelected
|
||||||
ctx.Data["label_ids"] = form.LabelIDs
|
ctx.Data["label_ids"] = form.LabelIDs
|
||||||
ctx.Data["Labels"] = labels
|
ctx.Data["Labels"] = labels
|
||||||
|
|
||||||
|
// Check milestone.
|
||||||
|
milestoneID = form.MilestoneID
|
||||||
|
ctx.Data["OpenMilestones"], err = models.GetMilestones(repo.ID, -1, false)
|
||||||
|
if err != nil {
|
||||||
|
ctx.Handle(500, "GetMilestones: %v", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ctx.Data["ClosedMilestones"], err = models.GetMilestones(repo.ID, -1, true)
|
||||||
|
if err != nil {
|
||||||
|
ctx.Handle(500, "GetMilestones: %v", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ctx.Data["Milestone"], err = models.GetRepoMilestoneByID(repo.ID, milestoneID)
|
||||||
|
if err != nil {
|
||||||
|
ctx.Handle(500, "GetRepoMilestoneByID: %v", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ctx.Data["milestone_id"] = milestoneID
|
||||||
}
|
}
|
||||||
|
|
||||||
if ctx.HasError() {
|
if ctx.HasError() {
|
||||||
|
@ -252,11 +274,11 @@ 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) + 1,
|
Index: int64(repo.NumIssues) + 1,
|
||||||
Name: form.Title,
|
Name: form.Title,
|
||||||
PosterID: ctx.User.Id,
|
PosterID: ctx.User.Id,
|
||||||
// MilestoneID: form.MilestoneID,
|
MilestoneID: milestoneID,
|
||||||
// AssigneeID: form.AssigneeID,
|
// AssigneeID: form.AssigneeID,
|
||||||
Content: form.Content,
|
Content: form.Content,
|
||||||
}
|
}
|
||||||
|
@ -683,7 +705,7 @@ func UpdateIssueMilestone(ctx *middleware.Context) {
|
||||||
|
|
||||||
// Not check for invalid milestone id and give responsibility to owners.
|
// Not check for invalid milestone id and give responsibility to owners.
|
||||||
issue.MilestoneID = mid
|
issue.MilestoneID = mid
|
||||||
if err = models.ChangeMilestoneAssign(oldMid, mid, issue); err != nil {
|
if err = models.ChangeMilestoneAssign(oldMid, issue); err != nil {
|
||||||
ctx.Handle(500, "issue.UpdateIssueMilestone(ChangeMilestoneAssign)", err)
|
ctx.Handle(500, "issue.UpdateIssueMilestone(ChangeMilestoneAssign)", err)
|
||||||
return
|
return
|
||||||
} else if err = models.UpdateIssue(issue); err != nil {
|
} else if err = models.UpdateIssue(issue); err != nil {
|
||||||
|
|
|
@ -38,16 +38,16 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{if .IsRepositoryAdmin}}
|
{{if .IsRepositoryAdmin}}
|
||||||
<input id="label_ids" name="label_ids" type="hidden" value="{{.label_ids}}">
|
|
||||||
<div class="four wide column">
|
<div class="four wide column">
|
||||||
<div class="ui segment metas">
|
<div class="ui segment metas">
|
||||||
|
<input id="label_ids" name="label_ids" type="hidden" value="{{.label_ids}}">
|
||||||
<div class="ui {{if not .Labels}}disabled{{end}} jump select-label dropdown">
|
<div class="ui {{if not .Labels}}disabled{{end}} jump select-label dropdown">
|
||||||
<span class="text">
|
<span class="text">
|
||||||
<strong>{{.i18n.Tr "repo.issues.new.labels"}}</strong>
|
<strong>{{.i18n.Tr "repo.issues.new.labels"}}</strong>
|
||||||
<span class="octicon octicon-gear"></span>
|
<span class="octicon octicon-gear"></span>
|
||||||
</span>
|
</span>
|
||||||
<div class="filter menu" data-id="#label_ids">
|
<div class="filter menu" data-id="#label_ids">
|
||||||
<a class="no-select item" href="#">{{.i18n.Tr "repo.issues.new.clear_labels"}}</a>
|
<div class="no-select item">{{.i18n.Tr "repo.issues.new.clear_labels"}}</div>
|
||||||
{{range .Labels}}
|
{{range .Labels}}
|
||||||
<a class="{{if .IsChecked}}checked{{end}} item" href="#" data-id="{{.ID}}" data-id-selector="#label_{{.ID}}"><span class="octicon {{if .IsChecked}}octicon-check{{end}}"></span><span class="label color" style="background-color: {{.Color}}"></span> {{.Name}}</a>
|
<a class="{{if .IsChecked}}checked{{end}} item" href="#" data-id="{{.ID}}" data-id-selector="#label_{{.ID}}"><span class="octicon {{if .IsChecked}}octicon-check{{end}}"></span><span class="label color" style="background-color: {{.Color}}"></span> {{.Name}}</a>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
@ -59,32 +59,59 @@
|
||||||
<a class="{{if not .IsChecked}}hide{{end}} item" id="label_{{.ID}}" href="{{$.RepoLink}}/issues?labels={{.ID}}"><span class="label color" style="background-color: {{.Color}}"></span> <span class="text">{{.Name}}</span></a>
|
<a class="{{if not .IsChecked}}hide{{end}} item" id="label_{{.ID}}" href="{{$.RepoLink}}/issues?labels={{.ID}}"><span class="label color" style="background-color: {{.Color}}"></span> <span class="text">{{.Name}}</span></a>
|
||||||
{{end}}
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
<!-- <div class="ui divider"></div>
|
|
||||||
<div class="ui {{if .Labels}}disabled{{end}} dropdown jump item">
|
<div class="ui divider"></div>
|
||||||
|
|
||||||
|
<input id="milestone_id" name="milestone_id" type="hidden" value="{{.milestone_id}}">
|
||||||
|
<div class="ui {{if not (or .OpenMilestones .ClosedMilestones)}}disabled{{end}} jump select-milestone dropdown">
|
||||||
<span class="text">
|
<span class="text">
|
||||||
<strong>{{.i18n.Tr "repo.issues.new.milestone"}}</strong>
|
<strong>{{.i18n.Tr "repo.issues.new.milestone"}}</strong>
|
||||||
<span class="octicon octicon-gear"></span>
|
<span class="octicon octicon-gear"></span>
|
||||||
</span>
|
</span>
|
||||||
<div class="menu">
|
<div class="menu">
|
||||||
<a class="item" href="{{$.RepoLink}}/issues?type={{$.ViewType}}&state={{$.State}}&milestone={{$.MilestoneID}}">{{.i18n.Tr "repo.issues.filter_label_no_select"}}</a>
|
<div class="no-select item">{{.i18n.Tr "repo.issues.new.clear_milestone"}}</div>
|
||||||
{{range .Labels}}
|
{{if .OpenMilestones}}
|
||||||
<a class="item" href="{{$.RepoLink}}/issues?type={{$.ViewType}}&state={{$.State}}&labels={{.ID}}&milestone={{$.MilestoneID}}"><span class="octicon {{if .IsChecked}}octicon-check{{end}}"></span><span class="label color" style="background-color: {{.Color}}"></span> {{.Name}}</a>
|
<div class="divider"></div>
|
||||||
|
<div class="header">
|
||||||
|
<i class="octicon octicon-milestone"></i>
|
||||||
|
{{.i18n.Tr "repo.issues.new.open_milestone"}}
|
||||||
|
</div>
|
||||||
|
{{range .OpenMilestones}}
|
||||||
|
<div class="item" data-id="{{.ID}}" data-href="{{$.RepoLink}}/issues?milestone={{.ID}}"> {{.Name}}</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
{{end}}
|
||||||
|
{{if .ClosedMilestones}}
|
||||||
|
<div class="divider"></div>
|
||||||
|
<div class="header">
|
||||||
|
<i class="octicon octicon-milestone"></i>
|
||||||
|
{{.i18n.Tr "repo.issues.new.closed_milestone"}}
|
||||||
|
</div>
|
||||||
|
{{range .ClosedMilestones}}
|
||||||
|
<a class="item" data-id="{{.ID}}" data-href="{{$.RepoLink}}/issues?milestone={{.ID}}"> {{.Name}}</a>
|
||||||
|
{{end}}
|
||||||
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="ui list">
|
<div class="ui select-milestone list">
|
||||||
<span class="item">filter_label_no_select</span>
|
<span class="no-select item {{if .Milestone}}hide{{end}}">{{.i18n.Tr "repo.issues.new.no_milestone"}}</span>
|
||||||
|
<div class="selected">
|
||||||
|
{{if .Milestone}}
|
||||||
|
<a class="item" href="{{.RepoLink}}/issues?milestone={{.Milestone.ID}}"> {{.Milestone.Name}}</a>
|
||||||
|
{{end}}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="ui divider"></div>
|
|
||||||
<div class="ui {{if .Labels}}disabled{{end}} dropdown jump item">
|
<!-- <div class="ui divider"></div>
|
||||||
|
|
||||||
|
<div class="ui {{if not .Assignees}}disabled{{end}} dropdown jump item">
|
||||||
<span class="text">
|
<span class="text">
|
||||||
<strong>{{.i18n.Tr "repo.issues.new.assignee"}}</strong>
|
<strong>{{.i18n.Tr "repo.issues.new.assignee"}}</strong>
|
||||||
<span class="octicon octicon-gear"></span>
|
<span class="octicon octicon-gear"></span>
|
||||||
</span>
|
</span>
|
||||||
<div class="menu">
|
<div class="menu">
|
||||||
<a class="item" href="{{$.RepoLink}}/issues?type={{$.ViewType}}&state={{$.State}}&milestone={{$.MilestoneID}}">{{.i18n.Tr "repo.issues.filter_label_no_select"}}</a>
|
<div class="item">{{.i18n.Tr "repo.issues.new.clear_assignee"}}</a>
|
||||||
{{range .Labels}}
|
{{range .Assignees}}
|
||||||
<a class="item" href="{{$.RepoLink}}/issues?type={{$.ViewType}}&state={{$.State}}&labels={{.ID}}&milestone={{$.MilestoneID}}"><span class="octicon {{if .IsChecked}}octicon-check{{end}}"></span><span class="label color" style="background-color: {{.Color}}"></span> {{.Name}}</a>
|
<a class="item" href="#"><span class="octicon {{if eq .ID $.AssigneeID}}octicon-check{{end}}"></span> {{.Name}}</a>
|
||||||
{{end}}
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue