summaryrefslogtreecommitdiffstats
path: root/templates/projects
diff options
context:
space:
mode:
authorDaniel Baumann <daniel@debian.org>2024-10-18 20:33:49 +0200
committerDaniel Baumann <daniel@debian.org>2024-12-12 23:57:56 +0100
commite68b9d00a6e05b3a941f63ffb696f91e554ac5ec (patch)
tree97775d6c13b0f416af55314eb6a89ef792474615 /templates/projects
parentInitial commit. (diff)
downloadforgejo-e68b9d00a6e05b3a941f63ffb696f91e554ac5ec.tar.xz
forgejo-e68b9d00a6e05b3a941f63ffb696f91e554ac5ec.zip
Adding upstream version 9.0.3.
Signed-off-by: Daniel Baumann <daniel@debian.org>
Diffstat (limited to '')
-rw-r--r--templates/projects/list.tmpl93
-rw-r--r--templates/projects/new.tmpl66
-rw-r--r--templates/projects/view.tmpl180
3 files changed, 339 insertions, 0 deletions
diff --git a/templates/projects/list.tmpl b/templates/projects/list.tmpl
new file mode 100644
index 0000000..b892cff
--- /dev/null
+++ b/templates/projects/list.tmpl
@@ -0,0 +1,93 @@
+{{if and $.CanWriteProjects (not $.Repository.IsArchived)}}
+ <div class="tw-flex 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>
+ <div class="tw-text-right">
+ <a class="ui small primary button" href="{{$.Link}}/new">{{ctx.Locale.Tr "repo.projects.new"}}</a>
+ </div>
+ </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>
+ <!-- Sort -->
+ <div class="list-header-sort ui dropdown type jump item">
+ <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 "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 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 ctx)}}&nbsp;{{ctx.Locale.Tr "repo.issues.open_title"}}
+ </div>
+ <div class="flex-text-block">
+ {{svg "octicon-check" 14}}
+ {{ctx.Locale.PrettyNumber (.NumClosedIssues ctx)}}&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="delete-button flex-text-inline" href="#" data-url="{{.Link ctx}}/delete">{{svg "octicon-trash" 14}}{{ctx.Locale.Tr "repo.issues.label_delete"}}</a>
+ </div>
+ {{end}}
+ </div>
+ {{if .Description}}
+ <div class="content">
+ {{.RenderedContent}}
+ </div>
+ {{end}}
+ </li>
+ {{end}}
+
+ {{template "base/paginate" .}}
+</div>
+
+{{if and $.CanWriteProjects (not $.Repository.IsArchived)}}
+<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}}
diff --git a/templates/projects/new.tmpl b/templates/projects/new.tmpl
new file mode 100644
index 0000000..bd173b5
--- /dev/null
+++ b/templates/projects/new.tmpl
@@ -0,0 +1,66 @@
+<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>
+ <textarea name="content" placeholder="{{ctx.Locale.Tr "repo.projects.description_placeholder"}}">{{.content}}</textarea>
+ </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="tw-text-right">
+ <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>
diff --git a/templates/projects/view.tmpl b/templates/projects/view.tmpl
new file mode 100644
index 0000000..08b08b9
--- /dev/null
+++ b/templates/projects/view.tmpl
@@ -0,0 +1,180 @@
+{{$canWriteProject := and .CanWriteProjects (or (not .Repository) (not .Repository.IsArchived))}}
+
+<div class="ui container tw-max-w-full">
+ <div class="tw-flex max-sm:tw-flex-col tw-justify-between tw-items-center tw-mb-4 tw-gap-3">
+ <h2 class="tw-mb-0 tw-flex-1 tw-break-anywhere">{{.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_picker">{{ctx.Locale.Tr "repo.projects.column.color"}}</label>
+ <div class="js-color-picker-input column">
+ <input maxlength="7" placeholder="#c320f6" id="new_project_column_color_picker" name="color">
+ {{template "repo/issue/label_precolors"}}
+ </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}}</div>
+
+ <div class="divider"></div>
+</div>
+
+<div id="project-board">
+ <div class="board {{if .CanWriteProjects}}sortable{{end}}"{{if .CanWriteProjects}} 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 large label project-column-title tw-py-1">
+ <div class="ui small circular grey label project-column-issue-count">
+ {{.NumIssues ctx}}
+ </div>
+ <span class="project-column-title-label">{{.Title}}</span>
+ </div>
+ {{if $canWriteProject}}
+ <div class="ui dropdown jump item">
+ <div class="tw-px-2">
+ {{svg "octicon-kebab-horizontal"}}
+ </div>
+ <div class="menu user-menu">
+ <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>
+ <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>
+ {{end}}
+
+ <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="js-color-picker-input column">
+ <input maxlength="7" placeholder="#c320f6" id="new_project_column_color" name="color" value="{{.Color}}">
+ {{template "repo/issue/label_precolors"}}
+ </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 "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 "ModalButtonTypes" "confirm")}}
+ </div>
+ </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 .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}}