mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Issue due date api (#3890)
* Implemented basic api endpoint to manage deadlines * Fixed checking for permissions * Updating a deadline from the ui is now entirely done via the api * cleanup * Cosmetics * fixed lint + fmt * Added swagger model definition for deadline response * Updated gitea-sdk * Updated gitea-sdk * More cleanup * Generate swagger json * Merge branch 'master' of https://github.com/go-gitea/gitea into issue-due-date-api # Conflicts: # public/swagger.v1.json * Fixed permission to update a deadline via api * Re-added form to change a deadline * Added client-side validation + not ignore error messages from the api * Added locale for error message * Merge branch 'master' of https://github.com/go-gitea/gitea # Conflicts: # models/issue_comment.go * Proper date validation * Fixed indention * moved css to css file * added documentation for error codes * after merge cleanup * Added swagger description * DO NOTHING BUT TRIGGER THAT F*CKIN CI SO IT PICKS UP THE LATEST COMMIT AS IT SHOULD * DO NOTHING BUT TRIGGER THAT F*CKIN CI SO IT PICKS UP THE LATEST COMMIT AS IT SHOULD * regenerated stylesheets
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -2447,14 +2447,44 @@ function initTopicbar() {
|
||||
}
|
||||
});
|
||||
}
|
||||
function toggleDuedateForm() {
|
||||
$('#add_deadline_form').fadeToggle(150);
|
||||
function toggleDeadlineForm() {
|
||||
$('#deadlineForm').fadeToggle(150);
|
||||
}
|
||||
|
||||
function deleteDueDate(url) {
|
||||
$.post(url, {
|
||||
'_csrf': csrf,
|
||||
},function( data ) {
|
||||
window.location.reload();
|
||||
function setDeadline() {
|
||||
var deadline = $('#deadlineDate').val();
|
||||
updateDeadline(deadline);
|
||||
}
|
||||
|
||||
function updateDeadline(deadlineString) {
|
||||
$('#deadline-err-invalid-date').hide();
|
||||
$('#deadline-loader').addClass('loading');
|
||||
|
||||
var realDeadline = null;
|
||||
if (deadlineString !== '') {
|
||||
|
||||
var newDate = Date.parse(deadlineString)
|
||||
|
||||
if (isNaN(newDate)) {
|
||||
$('#deadline-loader').removeClass('loading');
|
||||
$('#deadline-err-invalid-date').show();
|
||||
return false;
|
||||
}
|
||||
realDeadline = new Date(newDate);
|
||||
}
|
||||
|
||||
$.ajax($('#update-issue-deadline-form').attr('action') + '/deadline', {
|
||||
data: JSON.stringify({
|
||||
'due_date': realDeadline,
|
||||
}),
|
||||
contentType: 'application/json',
|
||||
type: 'POST',
|
||||
success: function () {
|
||||
window.location.reload();
|
||||
},
|
||||
error: function () {
|
||||
$('#deadline-loader').removeClass('loading');
|
||||
$('#deadline-err-invalid-date').show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@@ -98,6 +98,13 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#deadlineForm input{
|
||||
width: 12.8rem;
|
||||
border-radius: 4px 0 0 4px;
|
||||
border-right: 0;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
.header-wrapper {
|
||||
background-color: #FAFAFA;
|
||||
|
95
public/swagger.v1.json
vendored
95
public/swagger.v1.json
vendored
@@ -2320,6 +2320,68 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/repos/{owner}/{repo}/issues/{index}/deadline": {
|
||||
"post": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"issue"
|
||||
],
|
||||
"summary": "Set an issue deadline. If set to null, the deadline is deleted.",
|
||||
"operationId": "issueEditIssueDeadline",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "owner of the repo",
|
||||
"name": "owner",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "name of the repo",
|
||||
"name": "repo",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "index of the issue to create or update a deadline on",
|
||||
"name": "index",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/EditDeadlineOption"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"201": {
|
||||
"$ref": "#/responses/IssueDeadline"
|
||||
},
|
||||
"403": {
|
||||
"description": "Not repo writer",
|
||||
"schema": {
|
||||
"$ref": "#/responses/forbidden"
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Issue not found",
|
||||
"schema": {
|
||||
"$ref": "#/responses/empty"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/repos/{owner}/{repo}/issues/{index}/labels": {
|
||||
"get": {
|
||||
"produces": [
|
||||
@@ -6145,6 +6207,21 @@
|
||||
},
|
||||
"x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
|
||||
},
|
||||
"EditDeadlineOption": {
|
||||
"description": "EditDeadlineOption options for creating a deadline",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"due_date"
|
||||
],
|
||||
"properties": {
|
||||
"due_date": {
|
||||
"type": "string",
|
||||
"format": "date-time",
|
||||
"x-go-name": "Deadline"
|
||||
}
|
||||
},
|
||||
"x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
|
||||
},
|
||||
"EditHookOption": {
|
||||
"description": "EditHookOption options when modify one hook",
|
||||
"type": "object",
|
||||
@@ -6635,6 +6712,18 @@
|
||||
},
|
||||
"x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
|
||||
},
|
||||
"IssueDeadline": {
|
||||
"description": "IssueDeadline represents an issue deadline",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"due_date": {
|
||||
"type": "string",
|
||||
"format": "date-time",
|
||||
"x-go-name": "Deadline"
|
||||
}
|
||||
},
|
||||
"x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
|
||||
},
|
||||
"IssueLabelsOption": {
|
||||
"description": "IssueLabelsOption a collection of labels",
|
||||
"type": "object",
|
||||
@@ -7635,6 +7724,12 @@
|
||||
"$ref": "#/definitions/Issue"
|
||||
}
|
||||
},
|
||||
"IssueDeadline": {
|
||||
"description": "IssueDeadline",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/IssueDeadline"
|
||||
}
|
||||
},
|
||||
"IssueList": {
|
||||
"description": "IssueList",
|
||||
"schema": {
|
||||
|
Reference in New Issue
Block a user