first-commit

This commit is contained in:
2025-08-25 15:46:12 +08:00
commit f4d95dfff4
5665 changed files with 705359 additions and 0 deletions

View File

@@ -0,0 +1,89 @@
{{if and $.CanWriteProjects (not $.Repository.IsArchived)}}
<div class="flex-text-block tw-justify-between tw-mb-4">
<div class="small-menu-items ui compact tiny menu list-header-toggle">
<a class="item{{if not .IsShowClosed}} active{{end}}" href="?state=open&q={{$.Keyword}}">
{{svg "octicon-project-symlink" 16 "tw-mr-2"}}
{{ctx.Locale.PrettyNumber .OpenCount}}&nbsp;{{ctx.Locale.Tr "repo.issues.open_title"}}
</a>
<a class="item{{if .IsShowClosed}} active{{end}}" href="?state=closed&q={{$.Keyword}}">
{{svg "octicon-check" 16 "tw-mr-2"}}
{{ctx.Locale.PrettyNumber .ClosedCount}}&nbsp;{{ctx.Locale.Tr "repo.issues.closed_title"}}
</a>
</div>
<a class="ui small primary button" href="{{$.Link}}/new">{{ctx.Locale.Tr "repo.projects.new"}}</a>
</div>
{{end}}
{{template "base/alert" .}}
<div class="list-header">
<!-- Search -->
<form class="list-header-search ui form ignore-dirty">
<input type="hidden" name="state" value="{{$.State}}">
{{template "shared/search/combo" dict "Value" .Keyword "Placeholder" (ctx.Locale.Tr "search.project_kind")}}
</form>
<div class="list-header-filters">
<!-- Sort -->
<div class="item ui small dropdown jump">
<span class="text">
{{ctx.Locale.Tr "repo.issues.filter_sort"}}
</span>
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
<div class="menu">
<a class="{{if eq .SortType "oldest"}}active {{end}}item" href="?q={{$.Keyword}}&sort=oldest&state={{$.State}}">{{ctx.Locale.Tr "repo.issues.filter_sort.oldest"}}</a>
<a class="{{if eq .SortType "alphabetically"}}active {{end}}item" href="?q={{$.Keyword}}&sort=alphabetically&state={{$.State}}">{{ctx.Locale.Tr "repo.issues.label.filter_sort.alphabetically"}}</a>
<a class="{{if eq .SortType "reversealphabetically"}}active {{end}}item" href="?q={{$.Keyword}}&sort=reversealphabetically&state={{$.State}}">{{ctx.Locale.Tr "repo.issues.label.filter_sort.reverse_alphabetically"}}</a>
<a class="{{if eq .SortType "recentupdate"}}active {{end}}item" href="?q={{$.Keyword}}&sort=recentupdate&state={{$.State}}">{{ctx.Locale.Tr "repo.issues.filter_sort.recentupdate"}}</a>
<a class="{{if eq .SortType "leastupdate"}}active {{end}}item" href="?q={{$.Keyword}}&sort=leastupdate&state={{$.State}}">{{ctx.Locale.Tr "repo.issues.filter_sort.leastupdate"}}</a>
</div>
</div>
</div>
</div>
<div class="milestone-list">
{{range .Projects}}
<li class="milestone-card">
<h3 class="flex-text-block tw-m-0 tw-gap-3">
{{svg .IconName 16}}
<a class="muted tw-break-anywhere" href="{{.Link ctx}}">{{.Title}}</a>
</h3>
<div class="milestone-toolbar">
<div class="group">
<div class="flex-text-block">
{{svg "octicon-issue-opened" 14}}
{{ctx.Locale.PrettyNumber .NumOpenIssues}}&nbsp;{{ctx.Locale.Tr "repo.issues.open_title"}}
</div>
<div class="flex-text-block">
{{svg "octicon-check" 14}}
{{ctx.Locale.PrettyNumber .NumClosedIssues}}&nbsp;{{ctx.Locale.Tr "repo.issues.closed_title"}}
</div>
</div>
{{if and $.CanWriteProjects (not $.Repository.IsArchived)}}
<div class="group">
<a class="flex-text-inline" href="{{.Link ctx}}/edit">{{svg "octicon-pencil" 14}}{{ctx.Locale.Tr "repo.issues.label_edit"}}</a>
{{if .IsClosed}}
<a class="link-action flex-text-inline" href data-url="{{.Link ctx}}/open">{{svg "octicon-check" 14}}{{ctx.Locale.Tr "repo.projects.open"}}</a>
{{else}}
<a class="link-action flex-text-inline" href data-url="{{.Link ctx}}/close">{{svg "octicon-skip" 14}}{{ctx.Locale.Tr "repo.projects.close"}}</a>
{{end}}
<a class="link-action flex-text-inline text red" href data-modal-confirm="#repo-project-delete-modal" data-url="{{.Link ctx}}/delete">{{svg "octicon-trash" 14}}{{ctx.Locale.Tr "repo.issues.label_delete"}}</a>
</div>
{{end}}
</div>
{{if .Description}}
<div class="render-content markup">{{.RenderedContent}}</div>
{{end}}
</li>
{{end}}
{{template "base/paginate" .}}
</div>
{{if and $.CanWriteProjects (not $.Repository.IsArchived)}}
<div class="ui small modal" id="repo-project-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}}

View File

@@ -0,0 +1,75 @@
<h2 class="ui dividing header">
{{if .PageIsEditProjects}}
{{ctx.Locale.Tr "repo.projects.edit"}}
<div class="sub header">{{ctx.Locale.Tr "repo.projects.edit_subheader"}}</div>
{{else}}
{{ctx.Locale.Tr "repo.projects.new"}}
<div class="sub header">{{ctx.Locale.Tr "repo.projects.new_subheader"}}</div>
{{end}}
</h2>
{{template "base/alert" .}}
<form class="ui form" action="{{.Link}}" method="post">
{{.CsrfTokenHtml}}
<div>
<input type="hidden" id="redirect" name="redirect" value="{{.redirect}}">
<div class="field {{if .Err_Title}}error{{end}}">
<label>{{ctx.Locale.Tr "repo.projects.title"}}</label>
<input name="title" placeholder="{{ctx.Locale.Tr "repo.projects.title"}}" value="{{.title}}" autofocus required>
</div>
<div class="field">
<label>{{ctx.Locale.Tr "repo.projects.description"}}</label>
{{/* TODO: repo-level project and org-level project have different behaviros to render */}}
{{/* the "Repository" is nil when the project is org-level */}}
{{template "shared/combomarkdowneditor" (dict
"MarkdownPreviewInRepo" $.Repository
"MarkdownPreviewContext" (Iif $.Repository "" .HomeLink)
"MarkdownPreviewMode" (Iif $.Repository "comment")
"TextareaName" "content"
"TextareaContent" .content
"TextareaPlaceholder" (ctx.Locale.Tr "repo.projects.description_placeholder")
)}}
</div>
{{if not .PageIsEditProjects}}
<div class="field">
<label>{{ctx.Locale.Tr "repo.projects.template.desc"}}</label>
<div class="ui selection dropdown">
<input type="hidden" name="template_type" value="{{.type}}">
<div class="default text">{{ctx.Locale.Tr "repo.projects.template.desc_helper"}}</div>
<div class="menu">
{{range $element := .TemplateConfigs}}
<div class="item" data-id="{{$element.TemplateType}}" data-value="{{$element.TemplateType}}">{{ctx.Locale.Tr $element.Translation}}</div>
{{end}}
</div>
</div>
</div>
{{end}}
<div class="field">
<label>{{ctx.Locale.Tr "repo.projects.card_type.desc"}}</label>
<div class="ui selection dropdown">
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
{{range $element := .CardTypes}}
{{if or (eq $.card_type $element.CardType) (and (not $.PageIsEditProjects) (eq $element.CardType 1))}}
<input type="hidden" name="card_type" value="{{$element.CardType}}">
<div class="default text">{{ctx.Locale.Tr $element.Translation}}</div>
{{end}}
{{end}}
<div class="menu">
{{range $element := .CardTypes}}
<div class="item" data-id="{{$element.CardType}}" data-value="{{$element.CardType}}">{{ctx.Locale.Tr $element.Translation}}</div>
{{end}}
</div>
</div>
</div>
</div>
<div class="divider"></div>
<div class="flex-text-block tw-justify-end">
<a class="ui cancel button" href="{{$.CancelLink}}">
{{ctx.Locale.Tr "repo.milestones.cancel"}}
</a>
<button class="ui primary button">
{{if .PageIsEditProjects}}{{ctx.Locale.Tr "repo.projects.modify"}}{{else}}{{ctx.Locale.Tr "repo.projects.create"}}{{end}}
</button>
</div>
</form>

View File

@@ -0,0 +1,149 @@
{{$canWriteProject := and .CanWriteProjects (or (not .Repository) (not .Repository.IsArchived))}}
<div class="ui container fluid padded projects-view">
<div class="ui container flex-text-block project-header">
<h2>{{.Project.Title}}</h2>
<div class="tw-flex-1"></div>
<div class="ui secondary menu tw-m-0">
{{$queryLink := QueryBuild "?" "labels" .SelectLabels "assignee" $.AssigneeID "archived_labels" (Iif $.ShowArchivedLabels "true")}}
{{template "repo/issue/filter_item_label" dict "Labels" .Labels "QueryLink" $queryLink "SupportArchivedLabel" true}}
{{template "repo/issue/filter_item_user_assign" dict
"QueryParamKey" "assignee"
"QueryLink" $queryLink
"UserSearchList" $.Assignees
"SelectedUserId" $.AssigneeID
"TextFilterTitle" (ctx.Locale.Tr "repo.issues.filter_assignee")
"TextFilterMatchNone" (ctx.Locale.Tr "repo.issues.filter_assignee_no_assignee")
"TextFilterMatchAny" (ctx.Locale.Tr "repo.issues.filter_assignee_any_assignee")
}}
</div>
{{if $canWriteProject}}
<div class="ui compact mini menu">
<a class="item screen-full">
{{svg "octicon-screen-full"}}
{{ctx.Locale.Tr "projects.enter_fullscreen"}}
</a>
<a class="item screen-normal tw-hidden">
{{svg "octicon-screen-normal"}}
{{ctx.Locale.Tr "projects.exit_fullscreen"}}
</a>
<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 link-action" data-url="{{.Link}}/delete?id={{.Project.ID}}"
data-modal-confirm-header="{{ctx.Locale.Tr "repo.projects.deletion"}}"
data-modal-confirm-content="{{ctx.Locale.Tr "repo.projects.deletion_desc"}}"
>
{{svg "octicon-trash"}}
{{ctx.Locale.Tr "repo.issues.label_delete"}}
</button>
<button class="item btn show-modal show-project-column-modal-edit" data-modal="#project-column-modal-edit"
data-modal-header="{{ctx.Locale.Tr "repo.projects.column.new"}}"
data-modal-project-column-title-label="{{ctx.Locale.Tr "repo.projects.column.new_title"}}"
data-modal-project-column-button-save="{{ctx.Locale.Tr "repo.projects.column.new_submit"}}"
data-modal-project-column-id=""
data-modal-project-column-title-input=""
data-modal-project-column-color-input=""
>
{{svg "octicon-plus"}}
{{ctx.Locale.Tr "new_project_column"}}
</button>
</div>
{{end}}
</div>
<div class="ui container project-description">
{{$.Project.RenderedContent}}
<div class="divider"></div>
</div>
<div id="project-board" class="board {{if $canWriteProject}}sortable{{end}}" data-project-borad-writable="{{$canWriteProject}}" {{if $canWriteProject}}data-url="{{$.Link}}/move"{{end}}>
{{range .Columns}}
<div class="project-column" {{if .Color}}style="background: {{.Color}} !important; color: {{ContrastColor .Color}} !important"{{end}} data-id="{{.ID}}" data-sorting="{{.Sorting}}" data-url="{{$.Link}}/{{.ID}}">
<div class="project-column-header{{if $canWriteProject}} tw-cursor-grab{{end}}">
<div class="ui circular label project-column-issue-count">
{{.NumIssues}}
</div>
<div class="project-column-title-text gt-ellipsis">{{.Title}}</div>
{{if $canWriteProject}}
<div class="ui dropdown tw-p-1">
{{svg "octicon-kebab-horizontal"}}
<div class="menu">
<a class="item button show-modal show-project-column-modal-edit" data-modal="#project-column-modal-edit"
data-modal-header="{{ctx.Locale.Tr "repo.projects.column.edit"}}"
data-modal-project-column-title-label="{{ctx.Locale.Tr "repo.projects.column.edit_title"}}"
data-modal-project-column-button-save="{{ctx.Locale.Tr "repo.projects.column.edit"}}"
data-modal-project-column-id="{{.ID}}"
data-modal-project-column-title-input="{{.Title}}"
data-modal-project-column-color-input="{{.Color}}"
>
{{svg "octicon-pencil"}} {{ctx.Locale.Tr "repo.projects.column.edit"}}
</a>
{{if not .Default}}
<a class="item button link-action" data-url="{{$.Link}}/{{.ID}}/default"
data-modal-confirm-header="{{ctx.Locale.Tr "repo.projects.column.set_default"}}"
data-modal-confirm-content="{{ctx.Locale.Tr "repo.projects.column.set_default_desc"}}"
>
{{svg "octicon-pin"}} {{ctx.Locale.Tr "repo.projects.column.set_default"}}
</a>
<a class="item button link-action" data-url="{{$.Link}}/{{.ID}}" data-link-action-method="DELETE"
data-modal-confirm-header="{{ctx.Locale.Tr "repo.projects.column.delete"}}"
data-modal-confirm-content="{{ctx.Locale.Tr "repo.projects.column.deletion_desc"}}"
>
{{svg "octicon-trash"}} {{ctx.Locale.Tr "repo.projects.column.delete"}}
</a>
{{end}}
</div>
</div>
{{end}}
</div>
<div class="divider"{{if .Color}} style="color: {{ContrastColor .Color}} !important"{{end}}></div>
<div class="ui cards" data-url="{{$.Link}}/{{.ID}}" data-project="{{$.Project.ID}}" data-board="{{.ID}}" id="board_{{.ID}}">
{{range (index $.IssuesMap .ID)}}
<div class="issue-card tw-break-anywhere {{if $canWriteProject}}tw-cursor-grab{{end}}" data-issue="{{.ID}}">
{{template "repo/issue/card" (dict "Issue" . "Page" $)}}
</div>
{{end}}
</div>
</div>
{{end}}
</div>
</div>
{{if $canWriteProject}}
<div class="ui small modal" id="project-column-modal-edit">
<div class="header">edit</div>
<div class="content">
<form class="ui form ignore-dirty" method="post" data-action-base-link="{{$.Link}}">
<input class="project-column-id" type="hidden" name="id">
<div class="required field">
<label class="project-column-title-label" for="project-column-title-input">title</label>
<input id="project-column-title-input" name="title" required>
</div>
<div class="field">
<label class="project-column-color-label" for="project-column-color-input">color</label>
<div class="color-picker-combo" data-global-init="initColorPicker">
<input maxlength="7" placeholder="#c320f6" id="project-column-color-input" name="color">
{{template "repo/issue/label_precolors"}}
</div>
</div>
<div class="actions">
<button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button>
<button type="submit" class="ui primary button project-column-button-save">save</button>
</div>
</form>
</div>
</div>
{{end}}