diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 6b772d2392544..07242950cba3a 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -941,6 +941,8 @@ projects.board.edit_title = "New Board Name" projects.board.new_title = "New Board Name" projects.board.new_submit = "Submit" projects.board.new = "New Board" +projects.board.set_default = "Set Default" +projects.board.set_default_desc = "Set this board as default for all uncategorized issues and pulls" projects.board.delete = "Delete Board" projects.board.deletion_desc = "Deleting a project board moves all related issues to 'Uncategorized'. Continue?" projects.open = Open diff --git a/templates/repo/projects/view.tmpl b/templates/repo/projects/view.tmpl index b27773f710b06..4840395141ae3 100644 --- a/templates/repo/projects/view.tmpl +++ b/templates/repo/projects/view.tmpl @@ -85,6 +85,12 @@ {{svg "octicon-pencil"}} {{$.i18n.Tr "repo.projects.board.edit"}} + {{if not .Default}} + + {{svg "octicon-pin"}} + {{$.i18n.Tr "repo.projects.board.set_default"}} + + {{end}} {{svg "octicon-trashcan"}} {{$.i18n.Tr "repo.projects.board.delete"}} @@ -109,17 +115,31 @@ + + + {{$.i18n.Tr "repo.projects.board.set_default"}} + + + + {{$.i18n.Tr "repo.projects.board.set_default_desc"}} + + + + + {{$.i18n.Tr "settings.cancel"}} + {{$.i18n.Tr "repo.projects.board.set_default"}} + + + + {{$.i18n.Tr "repo.projects.board.delete"}} - - - - {{$.i18n.Tr "repo.projects.board.deletion_desc"}} - - + + {{$.i18n.Tr "repo.projects.board.deletion_desc"}} + diff --git a/web_src/js/features/projects.js b/web_src/js/features/projects.js index 13318c9f89e56..d5edfeef9b093 100644 --- a/web_src/js/features/projects.js +++ b/web_src/js/features/projects.js @@ -59,6 +59,24 @@ export default async function initProject() { }); }); + $('.set-default-project-board').each(function () { + $(this).click(function (e) { + e.preventDefault(); + + $.ajax({ + url: $(this).data('url'), + headers: { + 'X-Csrf-Token': csrf, + 'X-Remote': true, + }, + contentType: 'application/json', + method: 'POST', + }).done(() => { + setTimeout(window.location.reload(true), 2000); + }); + }); + }); + $('.delete-project-board').each(function () { $(this).click(function (e) { e.preventDefault();