Skip to content

Commit

Permalink
Frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
6543 committed Dec 27, 2020
1 parent 5285b30 commit 0a4be1a
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 6 deletions.
2 changes: 2 additions & 0 deletions options/locale/locale_en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
32 changes: 26 additions & 6 deletions templates/repo/projects/view.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@
{{svg "octicon-pencil"}}
{{$.i18n.Tr "repo.projects.board.edit"}}
</a>
{{if not .Default}}
<a class="item show-modal button" data-modal="#set-default-project-board-modal-{{.ID}}">
{{svg "octicon-pin"}}
{{$.i18n.Tr "repo.projects.board.set_default"}}
</a>
{{end}}
<a class="item show-modal button" data-modal="#delete-board-modal-{{.ID}}">
{{svg "octicon-trashcan"}}
{{$.i18n.Tr "repo.projects.board.delete"}}
Expand All @@ -109,17 +115,31 @@
</div>
</div>

<div class="ui basic modal" id="set-default-project-board-modal-{{.ID}}">
<div class="ui icon header">
{{$.i18n.Tr "repo.projects.board.set_default"}}
</div>
<div class="content center">
<label>
{{$.i18n.Tr "repo.projects.board.set_default_desc"}}
</label>
</div>
<form class="ui form" method="post">
<div class="text right actions">
<div class="ui cancel button">{{$.i18n.Tr "settings.cancel"}}</div>
<button class="ui red button set-default-project-board" data-url="{{$.RepoLink}}/projects/{{$.Project.ID}}/{{.ID}}/default">{{$.i18n.Tr "repo.projects.board.set_default"}}</button>
</div>
</form>
</div>

<div class="ui basic modal" id="delete-board-modal-{{.ID}}">
<div class="ui icon header">
{{$.i18n.Tr "repo.projects.board.delete"}}
</div>
<div class="content center">
<input type="hidden" name="action" value="delete">
<div class="field">
<label>
{{$.i18n.Tr "repo.projects.board.deletion_desc"}}
</label>
</div>
<label>
{{$.i18n.Tr "repo.projects.board.deletion_desc"}}
</label>
</div>
<form class="ui form" method="post">
<div class="text right actions">
Expand Down
18 changes: 18 additions & 0 deletions web_src/js/features/projects.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 0a4be1a

Please sign in to comment.