mirror of https://github.com/go-gitea/gitea
Commit
This commit is contained in:
parent
d247b0ffd1
commit
09c05e8b76
|
@ -147,7 +147,7 @@ type Issue struct {
|
|||
// For view issue page.
|
||||
ShowRole RoleDescriptor `xorm:"-"`
|
||||
|
||||
// Plan time
|
||||
// Time estimate
|
||||
TimeEstimateHours int
|
||||
TimeEstimateMinutes int
|
||||
}
|
||||
|
@ -779,14 +779,14 @@ func ChangeIssueTitle(issue *Issue, doer *user_model.User, oldTitle string) (err
|
|||
}
|
||||
|
||||
// ChangeIssueTimeEstimate changes the plan time of this issue, as the given user.
|
||||
func ChangeIssueTimeEstimate(issue *Issue, doer *user_model.User, planTimeHours, planTimeMinutes int) (err error) {
|
||||
func ChangeIssueTimeEstimate(issue *Issue, doer *user_model.User, timeEstimateHours, timeEstimateMinutes int) (err error) {
|
||||
ctx, committer, err := db.TxContext(db.DefaultContext)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer committer.Close()
|
||||
|
||||
if err = UpdateIssueCols(ctx, &Issue{ID: issue.ID, TimeEstimateHours: planTimeHours, TimeEstimateMinutes: planTimeMinutes}, "time_estimate_hours", "plan_time_minutes"); err != nil {
|
||||
if err = UpdateIssueCols(ctx, &Issue{ID: issue.ID, TimeEstimateHours: timeEstimateHours, TimeEstimateMinutes: timeEstimateMinutes}, "time_estimate_hours", "time_estimate_minutes"); err != nil {
|
||||
return fmt.Errorf("updateIssueCols: %w", err)
|
||||
}
|
||||
|
||||
|
@ -799,8 +799,8 @@ func ChangeIssueTimeEstimate(issue *Issue, doer *user_model.User, planTimeHours,
|
|||
Doer: doer,
|
||||
Repo: issue.Repo,
|
||||
Issue: issue,
|
||||
TimeEstimateHours: planTimeHours,
|
||||
TimeEstimateMinutes: planTimeMinutes,
|
||||
TimeEstimateHours: timeEstimateHours,
|
||||
TimeEstimateMinutes: timeEstimateMinutes,
|
||||
}
|
||||
if _, err = CreateComment(ctx, opts); err != nil {
|
||||
return fmt.Errorf("createComment: %w", err)
|
||||
|
|
|
@ -55,7 +55,7 @@ type Issue struct {
|
|||
Labels []*Label `json:"labels"`
|
||||
Milestone *Milestone `json:"milestone"`
|
||||
TimeEstimateHours int64 `json:"time_estimate_hours"`
|
||||
TimeEstimateMinutes int64 `json:"plan_time_minutes"`
|
||||
TimeEstimateMinutes int64 `json:"time_estimate_minutes"`
|
||||
// deprecated
|
||||
Assignee *User `json:"assignee"`
|
||||
Assignees []*User `json:"assignees"`
|
||||
|
@ -110,7 +110,7 @@ type EditIssueOption struct {
|
|||
// swagger:strfmt date-time
|
||||
Deadline *time.Time `json:"due_date"`
|
||||
TimeEstimateHours int `json:"time_estimate_hours"`
|
||||
TimeEstimateMinutes int `json:"plan_time_minutes"`
|
||||
TimeEstimateMinutes int `json:"time_estimate_minutes"`
|
||||
RemoveDeadline *bool `json:"unset_due_date"`
|
||||
}
|
||||
|
||||
|
|
|
@ -1970,8 +1970,8 @@ func UpdateIssueTitle(ctx *context.Context) {
|
|||
})
|
||||
}
|
||||
|
||||
// UpdateIssuePlanTime change issue's planned time
|
||||
func UpdateIssuePlanTime(ctx *context.Context) {
|
||||
// UpdateIssueTimeEstimate change issue's planned time
|
||||
func UpdateIssueTimeEstimate(ctx *context.Context) {
|
||||
issue := GetActionIssue(ctx)
|
||||
if ctx.Written() {
|
||||
return
|
||||
|
@ -1982,18 +1982,18 @@ func UpdateIssuePlanTime(ctx *context.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
planTimeHours := ctx.FormInt("time_estimate_hours")
|
||||
planTimeMinutes := ctx.FormInt("plan_time_minutes")
|
||||
timeEstimateHours := ctx.FormInt("time_estimate_hours")
|
||||
timeEstimateMinutes := ctx.FormInt("time_estimate_minutes")
|
||||
|
||||
if issue.TimeEstimateHours == planTimeHours && issue.TimeEstimateMinutes == planTimeMinutes {
|
||||
if issue.TimeEstimateHours == timeEstimateHours && issue.TimeEstimateMinutes == timeEstimateMinutes {
|
||||
ctx.JSON(http.StatusOK, map[string]interface{}{
|
||||
"status": "ok",
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if err := issue_service.ChangePlanTime(issue, ctx.Doer, planTimeHours, planTimeMinutes); err != nil {
|
||||
ctx.ServerError("ChangePlanTime", err)
|
||||
if err := issue_service.ChangeTimeEstimate(issue, ctx.Doer, timeEstimateHours, timeEstimateMinutes); err != nil {
|
||||
ctx.ServerError("ChangeTimeEstimate", err)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -1069,7 +1069,7 @@ func RegisterRoutes(m *web.Route) {
|
|||
// So they can apply their own enable/disable logic on routers.
|
||||
m.Group("/{type:issues|pulls}", func() {
|
||||
m.Group("/{index}", func() {
|
||||
m.Post("/plan_time", repo.UpdateIssuePlanTime)
|
||||
m.Post("/time_estimate", repo.UpdateIssueTimeEstimate)
|
||||
m.Post("/title", repo.UpdateIssueTitle)
|
||||
m.Post("/content", repo.UpdateIssueContent)
|
||||
m.Post("/deadline", web.Bind(structs.EditDeadlineOption{}), repo.UpdateIssueDeadline)
|
||||
|
|
|
@ -62,11 +62,11 @@ func ChangeTitle(issue *issues_model.Issue, doer *user_model.User, title string)
|
|||
}
|
||||
|
||||
// ChangeTitle changes the title of this issue, as the given user.
|
||||
func ChangePlanTime(issue *issues_model.Issue, doer *user_model.User, planTimeHours, planTimeMinutes int) (err error) {
|
||||
issue.TimeEstimateHours = planTimeHours
|
||||
issue.TimeEstimateMinutes = planTimeMinutes
|
||||
func ChangeTimeEstimate(issue *issues_model.Issue, doer *user_model.User, timeEstimateHours, timeEstimateMinutes int) (err error) {
|
||||
issue.TimeEstimateHours = timeEstimateHours
|
||||
issue.TimeEstimateMinutes = timeEstimateMinutes
|
||||
|
||||
if err = issues_model.ChangeIssueTimeEstimate(issue, doer, planTimeHours, planTimeMinutes); err != nil {
|
||||
if err = issues_model.ChangeIssueTimeEstimate(issue, doer, timeEstimateHours, timeEstimateMinutes); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -362,11 +362,11 @@
|
|||
<div>
|
||||
<span class="text"><strong>{{.locale.Tr "repo.issues.tracker_time_estimate"}}</strong></span>
|
||||
|
||||
<form method="POST" id="set_plan_time_form" class="gt-mt-3" action="{{.Issue.Link}}/plan_time">
|
||||
<form method="POST" id="set_time_estimate_form" class="gt-mt-3" action="{{.Issue.Link}}/time_estimate">
|
||||
{{$.CsrfTokenHtml}}
|
||||
<div class="ui action input fluid">
|
||||
<input placeholder='{{.locale.Tr "repo.issues.add_time_hours"}}' type="number" min="0" value="{{ ($.Issue.TimeEstimateHours) }}" name="time_estimate_hours">
|
||||
<input placeholder='{{.locale.Tr "repo.issues.add_time_minutes"}}' type="number" min="0" max="59" value="{{ ($.Issue.TimeEstimateMinutes) }}" name="plan_time_minutes" class="ui compact">
|
||||
<input placeholder='{{.locale.Tr "repo.issues.add_time_minutes"}}' type="number" min="0" max="59" value="{{ ($.Issue.TimeEstimateMinutes) }}" name="time_estimate_minutes" class="ui compact">
|
||||
</div>
|
||||
<button class="ui fluid button green tooltip gt-mt-3">
|
||||
{{.locale.Tr "repo.issues.save"}}
|
||||
|
|
|
@ -640,16 +640,16 @@ export function initRepoIssueTitleEdit() {
|
|||
}
|
||||
|
||||
export function initRepoIssuePlanTimeEdit() {
|
||||
$('#set_plan_time_form').on('submit', function(e) {
|
||||
$('#set_time_estimate_form').on('submit', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
const planTimeHours = $(this).find('[name=time_estimate_hours]').val();
|
||||
const planTimeMinutes = $(this).find('[name=plan_time_minutes]').val();
|
||||
const timeEstimateHours = $(this).find('[name=time_estimate_hours]').val();
|
||||
const timeEstimateMinutes = $(this).find('[name=time_estimate_minutes]').val();
|
||||
|
||||
$.post($(this).attr('action'), {
|
||||
_csrf: csrfToken,
|
||||
time_estimate_hours: planTimeHours,
|
||||
plan_time_minutes: planTimeMinutes,
|
||||
time_estimate_hours: timeEstimateHours,
|
||||
time_estimate_minutes: timeEstimateMinutes,
|
||||
}).always(() => {
|
||||
window.location.reload();
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue