mirror of
https://gitee.com/gitea/gitea.git
synced 2024-12-05 21:28:45 +08:00
ab78c39e41
This PR refactors a bunch of projects-related code, mostly the templates. The following things were done: - rename boards to columns in frontend code - use the new `ctx.Locale.Tr` method - cleanup template, remove useless newlines, classes, comments - merge org-/user and repo level project template together - move "new column" button into project toolbar - move issue card (shared by projects and pinned issues) to shared template, remove useless duplicated styles - add search function to projects (to make the layout more similar to milestones list where it is inherited from 😆) - maybe more changes I forgot I've done 😆 Closes #24893 After: ![Bildschirmfoto vom 2023-08-10 23-02-00](https://github.com/go-gitea/gitea/assets/47871822/cab61456-1d23-4373-8163-e567f1b3b5f9) ![Bildschirmfoto vom 2023-08-10 23-02-26](https://github.com/go-gitea/gitea/assets/47871822/94b55d60-5572-48eb-8111-538a52d8bcc6) ![Bildschirmfoto vom 2023-08-10 23-02-46](https://github.com/go-gitea/gitea/assets/47871822/a0358f4b-4e05-4194-a7bc-6e0ecba5a9b6) --------- Co-authored-by: silverwind <me@silverwind.io>
194 lines
7.7 KiB
Handlebars
194 lines
7.7 KiB
Handlebars
{{$canWriteProject := and .CanWriteProjects (or (not .Repository) (not .Repository.IsArchived))}}
|
|
|
|
<div class="gt-df gt-sb gt-ac gt-mb-4">
|
|
<h2 class="gt-mb-0">{{.Project.Title}}</h2>
|
|
{{if $canWriteProject}}
|
|
<div class="ui compact mini menu">
|
|
<a class="item" href="{{.Link}}/edit?redirect=project">
|
|
{{svg "octicon-pencil"}}
|
|
{{ctx.Locale.Tr "repo.issues.label_edit"}}
|
|
</a>
|
|
{{if .Project.IsClosed}}
|
|
<button class="item btn link-action" data-url="{{.Link}}/open">
|
|
{{svg "octicon-check"}}
|
|
{{ctx.Locale.Tr "repo.projects.open"}}
|
|
</button>
|
|
{{else}}
|
|
<button class="item btn link-action" data-url="{{.Link}}/close">
|
|
{{svg "octicon-skip"}}
|
|
{{ctx.Locale.Tr "repo.projects.close"}}
|
|
</button>
|
|
{{end}}
|
|
<button class="item btn delete-button" data-url="{{.Link}}/delete" data-id="{{.Project.ID}}">
|
|
{{svg "octicon-trash"}}
|
|
{{ctx.Locale.Tr "repo.issues.label_delete"}}
|
|
</button>
|
|
<button class="item btn show-modal" data-modal="#new-project-column-item">
|
|
{{svg "octicon-plus"}}
|
|
{{ctx.Locale.Tr "new_project_column"}}
|
|
</button>
|
|
</div>
|
|
<div class="ui small modal new-project-column-modal" id="new-project-column-item">
|
|
<div class="header">
|
|
{{ctx.Locale.Tr "repo.projects.column.new"}}
|
|
</div>
|
|
<div class="content">
|
|
<form class="ui form">
|
|
<div class="required field">
|
|
<label for="new_project_column">{{ctx.Locale.Tr "repo.projects.column.new_title"}}</label>
|
|
<input class="new-project-column" id="new_project_column" name="title" required>
|
|
</div>
|
|
|
|
<div class="field color-field">
|
|
<label for="new_project_column_color">{{ctx.Locale.Tr "repo.projects.column.color"}}</label>
|
|
<div class="color picker column">
|
|
<input class="color-picker" maxlength="7" placeholder="#c320f6" id="new_project_column_color_picker" name="color">
|
|
<div class="column precolors">
|
|
{{template "repo/issue/label_precolors"}}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="text right actions">
|
|
<button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button>
|
|
<button data-url="{{$.Link}}" class="ui primary button" id="new_project_column_submit">{{ctx.Locale.Tr "repo.projects.column.new_submit"}}</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
{{end}}
|
|
</div>
|
|
|
|
<div class="content">{{$.Project.RenderedContent|Str2html}}</div>
|
|
|
|
<div class="divider"></div>
|
|
|
|
<div id="project-board">
|
|
<div class="board {{if .CanWriteProjects}}sortable{{end}}">
|
|
{{range .Columns}}
|
|
<div class="ui segment project-column" style="background: {{.Color}} !important;" data-id="{{.ID}}" data-sorting="{{.Sorting}}" data-url="{{$.Link}}/{{.ID}}">
|
|
<div class="project-column-header">
|
|
<div class="ui large label project-column-title gt-py-2">
|
|
<div class="ui small circular grey label project-column-issue-count">
|
|
{{.NumIssues}}
|
|
</div>
|
|
{{.Title}}
|
|
</div>
|
|
{{if and $canWriteProject (ne .ID 0)}}
|
|
<div class="ui dropdown jump item">
|
|
<div class="gt-px-3" tabindex="-1">
|
|
{{svg "octicon-kebab-horizontal"}}
|
|
</div>
|
|
<div class="menu user-menu" tabindex="-1">
|
|
<a class="item show-modal button" data-modal="#edit-project-column-modal-{{.ID}}">
|
|
{{svg "octicon-pencil"}}
|
|
{{ctx.Locale.Tr "repo.projects.column.edit"}}
|
|
</a>
|
|
{{if not .Default}}
|
|
<a class="item show-modal button default-project-column-show"
|
|
data-modal="#default-project-column-modal-{{.ID}}"
|
|
data-modal-default-project-column-header="{{ctx.Locale.Tr "repo.projects.column.set_default"}}"
|
|
data-modal-default-project-column-content="{{ctx.Locale.Tr "repo.projects.column.set_default_desc"}}"
|
|
data-url="{{$.Link}}/{{.ID}}/default">
|
|
{{svg "octicon-pin"}}
|
|
{{ctx.Locale.Tr "repo.projects.column.set_default"}}
|
|
</a>
|
|
{{else}}
|
|
<a class="item show-modal button default-project-column-show"
|
|
data-modal="#default-project-column-modal-{{.ID}}"
|
|
data-modal-default-project-column-header="{{ctx.Locale.Tr "repo.projects.column.unset_default"}}"
|
|
data-modal-default-project-column-content="{{ctx.Locale.Tr "repo.projects.column.unset_default_desc"}}"
|
|
data-url="{{$.Link}}/{{.ID}}/unsetdefault">
|
|
{{svg "octicon-pin-slash"}}
|
|
{{ctx.Locale.Tr "repo.projects.column.unset_default"}}
|
|
</a>
|
|
{{end}}
|
|
<a class="item show-modal button show-delete-project-column-modal"
|
|
data-modal="#delete-project-column-modal-{{.ID}}"
|
|
data-url="{{$.Link}}/{{.ID}}">
|
|
{{svg "octicon-trash"}}
|
|
{{ctx.Locale.Tr "repo.projects.column.delete"}}
|
|
</a>
|
|
|
|
<div class="ui small modal edit-project-column-modal" id="edit-project-column-modal-{{.ID}}">
|
|
<div class="header">
|
|
{{ctx.Locale.Tr "repo.projects.column.edit"}}
|
|
</div>
|
|
<div class="content">
|
|
<form class="ui form">
|
|
<div class="required field">
|
|
<label for="new_project_column_title">{{ctx.Locale.Tr "repo.projects.column.edit_title"}}</label>
|
|
<input class="project-column-title-input" id="new_project_column_title" name="title" value="{{.Title}}" required>
|
|
</div>
|
|
|
|
<div class="field color-field">
|
|
<label for="new_project_column_color">{{ctx.Locale.Tr "repo.projects.column.color"}}</label>
|
|
<div class="color picker column">
|
|
<input class="color-picker" maxlength="7" placeholder="#c320f6" id="new_project_column_color" name="color" value="{{.Color}}">
|
|
<div class="column precolors">
|
|
{{template "repo/issue/label_precolors"}}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="text right actions">
|
|
<button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button>
|
|
<button data-url="{{$.Link}}/{{.ID}}" class="ui primary button edit-project-column-button">{{ctx.Locale.Tr "repo.projects.column.edit"}}</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="ui g-modal-confirm modal default-project-column-modal" id="default-project-column-modal-{{.ID}}">
|
|
<div class="header">
|
|
<span id="default-project-column-header"></span>
|
|
</div>
|
|
<div class="content">
|
|
<label id="default-project-column-content"></label>
|
|
</div>
|
|
{{template "base/modal_actions_confirm" (dict "locale" ctx.Locale "ModalButtonTypes" "confirm")}}
|
|
</div>
|
|
|
|
<div class="ui g-modal-confirm modal" id="delete-project-column-modal-{{.ID}}">
|
|
<div class="header">
|
|
{{ctx.Locale.Tr "repo.projects.column.delete"}}
|
|
</div>
|
|
<div class="content">
|
|
<label>
|
|
{{ctx.Locale.Tr "repo.projects.column.deletion_desc"}}
|
|
</label>
|
|
</div>
|
|
{{template "base/modal_actions_confirm" (dict "locale" ctx.Locale "ModalButtonTypes" "confirm")}}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{{end}}
|
|
</div>
|
|
|
|
<div class="divider"></div>
|
|
|
|
<div class="ui cards {{if $.CanWriteProjects}}gt-cursor-grab{{end}}" data-url="{{$.Link}}/{{.ID}}" data-project="{{$.Project.ID}}" data-board="{{.ID}}" id="board_{{.ID}}">
|
|
{{range (index $.IssuesMap .ID)}}
|
|
<div class="issue-card gt-word-break" data-issue="{{.ID}}">
|
|
{{template "repo/issue/card" (dict "Issue" . "Page" $)}}
|
|
</div>
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
|
|
{{if .CanWriteProjects}}
|
|
<div class="ui g-modal-confirm delete modal">
|
|
<div class="header">
|
|
{{svg "octicon-trash"}}
|
|
{{ctx.Locale.Tr "repo.projects.deletion"}}
|
|
</div>
|
|
<div class="content">
|
|
<p>{{ctx.Locale.Tr "repo.projects.deletion_desc"}}</p>
|
|
</div>
|
|
{{template "base/modal_actions_confirm" .}}
|
|
</div>
|
|
{{end}}
|