diff options
Diffstat (limited to '')
-rw-r--r-- | templates/repo/issue/labels.tmpl | 22 | ||||
-rw-r--r-- | templates/repo/issue/labels/edit_delete_label.tmpl | 72 | ||||
-rw-r--r-- | templates/repo/issue/labels/label.tmpl | 8 | ||||
-rw-r--r-- | templates/repo/issue/labels/label_archived.tmpl | 5 | ||||
-rw-r--r-- | templates/repo/issue/labels/label_list.tmpl | 88 | ||||
-rw-r--r-- | templates/repo/issue/labels/label_load_template.tmpl | 24 | ||||
-rw-r--r-- | templates/repo/issue/labels/label_new.tmpl | 48 | ||||
-rw-r--r-- | templates/repo/issue/labels/labels_selector_field.tmpl | 46 | ||||
-rw-r--r-- | templates/repo/issue/labels/labels_sidebar.tmpl | 11 |
9 files changed, 324 insertions, 0 deletions
diff --git a/templates/repo/issue/labels.tmpl b/templates/repo/issue/labels.tmpl new file mode 100644 index 0000000..230777e --- /dev/null +++ b/templates/repo/issue/labels.tmpl @@ -0,0 +1,22 @@ +{{template "base/head" .}} +<div role="main" aria-label="{{.Title}}" class="page-content repository labels"> + {{template "repo/header" .}} + <div class="ui container"> + <div class="issue-navbar tw-mb-4"> + {{template "repo/issue/navbar" .}} + {{if and (or .CanWriteIssues .CanWritePulls) (not .Repository.IsArchived)}} + <button class="ui small primary new-label button">{{ctx.Locale.Tr "repo.issues.new_label"}}</button> + {{end}} + </div> + {{if and (or .CanWriteIssues .CanWritePulls) (not .Repository.IsArchived)}} + {{template "repo/issue/labels/label_new" .}} + {{end}} + {{template "base/alert" .}} + {{template "repo/issue/labels/label_list" .}} + </div> +</div> + +{{if and (or .CanWriteIssues .CanWritePulls) (not .Repository.IsArchived)}} + {{template "repo/issue/labels/edit_delete_label" .}} +{{end}} +{{template "base/footer" .}} diff --git a/templates/repo/issue/labels/edit_delete_label.tmpl b/templates/repo/issue/labels/edit_delete_label.tmpl new file mode 100644 index 0000000..fcf6921 --- /dev/null +++ b/templates/repo/issue/labels/edit_delete_label.tmpl @@ -0,0 +1,72 @@ +<div class="ui g-modal-confirm delete modal"> + <div class="header"> + {{svg "octicon-trash"}} + {{ctx.Locale.Tr "repo.issues.label_deletion"}} + </div> + <div class="content"> + <p>{{ctx.Locale.Tr "repo.issues.label_deletion_desc"}}</p> + </div> + {{template "base/modal_actions_confirm" .}} +</div> + +<div class="ui small edit-label modal"> + <div class="header"> + {{ctx.Locale.Tr "repo.issues.label_modify"}} + </div> + <div class="content"> + <form class="ui edit-label form ignore-dirty" action="{{$.Link}}/edit" method="post"> + {{.CsrfTokenHtml}} + <input id="label-modal-id" name="id" type="hidden"> + <div class="required field"> + <label for="name">{{ctx.Locale.Tr "repo.issues.label_title"}}</label> + <div class="ui small input"> + <input class="label-name-input" name="title" placeholder="{{ctx.Locale.Tr "repo.issues.new_label_placeholder"}}" autofocus required maxlength="50"> + </div> + </div> + <div class="field label-exclusive-input-field"> + <div class="ui checkbox"> + <input class="label-exclusive-input" name="exclusive" type="checkbox"> + <label>{{ctx.Locale.Tr "repo.issues.label_exclusive"}}</label> + </div> + <br> + <small class="desc">{{ctx.Locale.Tr "repo.issues.label_exclusive_desc"}}</small> + <div class="desc tw-ml-1 tw-mt-2 tw-hidden label-exclusive-warning"> + {{svg "octicon-alert"}} {{ctx.Locale.Tr "repo.issues.label_exclusive_warning"}} + </div> + <br> + </div> + <div class="field label-is-archived-input-field"> + <div class="ui checkbox"> + <input class="label-is-archived-input" name="is_archived" type="checkbox"> + <label>{{ctx.Locale.Tr "repo.issues.label_archive"}}</label> + </div> + <i class="tw-ml-1" data-tooltip-content={{ctx.Locale.Tr "repo.issues.label_archive_tooltip"}}> + {{svg "octicon-info"}} + </i> + </div> + <div class="field"> + <label for="description">{{ctx.Locale.Tr "repo.issues.label_description"}}</label> + <div class="ui small fluid input"> + <input class="label-desc-input" name="description" placeholder="{{ctx.Locale.Tr "repo.issues.new_label_desc_placeholder"}}" maxlength="200"> + </div> + </div> + <div class="field color-field"> + <label for="color">{{ctx.Locale.Tr "repo.issues.label_color"}}</label> + <div class="column js-color-picker-input"> + <input name="color" value="#70c24a"placeholder="#c320f6" required maxlength="7"> + {{template "repo/issue/label_precolors"}} + </div> + </div> + </form> + </div> + <div class="actions"> + <button class="ui small basic cancel button"> + {{svg "octicon-x"}} + {{ctx.Locale.Tr "cancel"}} + </button> + <button class="ui primary small approve button"> + {{svg "fontawesome-save"}} + {{ctx.Locale.Tr "save"}} + </button> + </div> +</div> diff --git a/templates/repo/issue/labels/label.tmpl b/templates/repo/issue/labels/label.tmpl new file mode 100644 index 0000000..7844362 --- /dev/null +++ b/templates/repo/issue/labels/label.tmpl @@ -0,0 +1,8 @@ +<a + class="item {{if not .label.IsChecked}}tw-hidden{{end}}" + id="label_{{.label.ID}}" + href="{{.root.RepoLink}}/{{if or .root.IsPull .root.Issue.IsPull}}pulls{{else}}issues{{end}}?labels={{.label.ID}}"{{/* FIXME: use .root.Issue.Link or create .root.Link */}} + rel="nofollow" +> + {{- RenderLabel $.Context ctx.Locale .label -}} +</a> diff --git a/templates/repo/issue/labels/label_archived.tmpl b/templates/repo/issue/labels/label_archived.tmpl new file mode 100644 index 0000000..feaf77e --- /dev/null +++ b/templates/repo/issue/labels/label_archived.tmpl @@ -0,0 +1,5 @@ +{{if .IsArchived}} + <span class="ui label basic small" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.label_archive_tooltip"}}"> + {{ctx.Locale.Tr "archived"}} + </span> +{{end}} diff --git a/templates/repo/issue/labels/label_list.tmpl b/templates/repo/issue/labels/label_list.tmpl new file mode 100644 index 0000000..8d7fc2c --- /dev/null +++ b/templates/repo/issue/labels/label_list.tmpl @@ -0,0 +1,88 @@ +<h4 class="ui top attached header"> + {{ctx.Locale.Tr "repo.issues.label_count" .NumLabels}} + <div class="ui right"> + <div class="ui secondary menu"> + <!-- Sort --> + <div class="item ui jump dropdown tw-py-2"> + <span class="text"> + {{ctx.Locale.Tr "repo.issues.filter_sort"}} + </span> + {{svg "octicon-triangle-down" 14 "dropdown icon"}} + <div class="menu"> + <a class="{{if or (eq .SortType "alphabetically") (not .SortType)}}active {{end}}item" href="?sort=alphabetically&state={{$.State}}">{{ctx.Locale.Tr "repo.issues.label.filter_sort.alphabetically"}}</a> + <a class="{{if eq .SortType "reversealphabetically"}}active {{end}}item" href="?sort=reversealphabetically&state={{$.State}}">{{ctx.Locale.Tr "repo.issues.label.filter_sort.reverse_alphabetically"}}</a> + <a class="{{if eq .SortType "leastissues"}}active {{end}}item" href="?sort=leastissues&state={{$.State}}">{{ctx.Locale.Tr "repo.milestones.filter_sort.least_issues"}}</a> + <a class="{{if eq .SortType "mostissues"}}active {{end}}item" href="?sort=mostissues&state={{$.State}}">{{ctx.Locale.Tr "repo.milestones.filter_sort.most_issues"}}</a> + </div> + </div> + </div> + </div> <!-- filter menu --> +</h4> + +<div class="ui attached segment"> + {{if and (not $.PageIsOrgSettingsLabels) (or $.CanWriteIssues $.CanWritePulls) (eq .NumLabels 0) (not $.Repository.IsArchived)}} + {{template "repo/issue/labels/label_load_template" .}} + <div class="divider"></div> + {{else if and ($.PageIsOrgSettingsLabels) (eq .NumLabels 0)}} + {{template "repo/issue/labels/label_load_template" .}} + <div class="divider"></div> + {{end}} + + <ul class="issue-label-list"> + {{range .Labels}} + <li class="item"> + <div class="label-title"> + {{RenderLabel $.Context ctx.Locale .}} + {{if .Description}}<br><small class="desc">{{.Description | RenderEmoji $.Context}}</small>{{end}} + </div> + <div class="label-issues"> + {{if $.PageIsOrgSettingsLabels}} + <a class="open-issues" href="{{AppSubUrl}}/issues?labels={{.ID}}">{{svg "octicon-issue-opened"}} {{ctx.Locale.Tr "repo.issues.label_open_issues" .NumOpenIssues}}</a> + {{else}} + <a class="open-issues" href="{{$.RepoLink}}/issues?labels={{.ID}}">{{svg "octicon-issue-opened"}} {{ctx.Locale.Tr "repo.issues.label_open_issues" .NumOpenIssues}}</a> + {{end}} + </div> + <div class="label-operation tw-flex"> + {{template "repo/issue/labels/label_archived" .}} + <div class="tw-flex tw-ml-auto"> + {{if and (not $.PageIsOrgSettingsLabels) (not $.Repository.IsArchived) (or $.CanWriteIssues $.CanWritePulls)}} + <a class="edit-label-button" href="#" data-id="{{.ID}}" data-title="{{.Name}}" {{if .Exclusive}}data-exclusive{{end}} {{if gt .ArchivedUnix 0}}data-is-archived{{end}} data-num-issues="{{.NumIssues}}" data-description="{{.Description}}" data-color={{.Color}}>{{svg "octicon-pencil"}} {{ctx.Locale.Tr "repo.issues.label_edit"}}</a> + <a class="delete-button" href="#" data-url="{{$.Link}}/delete" data-id="{{.ID}}">{{svg "octicon-trash"}} {{ctx.Locale.Tr "repo.issues.label_delete"}}</a> + {{else if $.PageIsOrgSettingsLabels}} + <a class="edit-label-button" href="#" data-id="{{.ID}}" data-title="{{.Name}}" {{if .Exclusive}}data-exclusive{{end}} {{if gt .ArchivedUnix 0}}data-is-archived{{end}} data-num-issues="{{.NumIssues}}" data-description="{{.Description}}" data-color={{.Color}}>{{svg "octicon-pencil"}} {{ctx.Locale.Tr "repo.issues.label_edit"}}</a> + <a class="delete-button" href="#" data-url="{{$.Link}}/delete" data-id="{{.ID}}">{{svg "octicon-trash"}} {{ctx.Locale.Tr "repo.issues.label_delete"}}</a> + {{end}} + </div> + </div> + </li> + {{end}} + + {{if and (not .PageIsOrgSettingsLabels) (.OrgLabels)}} + <li class="item"> + <div class="ui grid middle aligned"> + <div class="ten wide column"> + {{ctx.Locale.Tr "repo.org_labels_desc"}} + {{if .IsOrganizationOwner}} + <a href="{{.OrganizationLink}}/settings/labels">({{ctx.Locale.Tr "repo.org_labels_desc_manage"}})</a>: + {{end}} + </div> + </div> + </li> + + {{range .OrgLabels}} + <li class="item org-label"> + <div class="label-title"> + {{RenderLabel $.Context ctx.Locale .}} + {{if .Description}}<br><small class="desc">{{.Description | RenderEmoji $.Context}}</small>{{end}} + </div> + <div class="label-issues"> + <a class="open-issues" {{if .IsArchived}}data-is-archived{{end}} href="{{$.RepoLink}}/issues?labels={{.ID}}">{{svg "octicon-issue-opened"}} {{ctx.Locale.Tr "repo.issues.label_open_issues" .NumOpenRepoIssues}}</a> + </div> + <div class="label-operation"> + {{template "repo/issue/labels/label_archived" .}} + </div> + </li> + {{end}} + {{end}} + </ul> +</div> diff --git a/templates/repo/issue/labels/label_load_template.tmpl b/templates/repo/issue/labels/label_load_template.tmpl new file mode 100644 index 0000000..0249430 --- /dev/null +++ b/templates/repo/issue/labels/label_load_template.tmpl @@ -0,0 +1,24 @@ +<div class="ui centered grid"> + <div class="twelve wide computer column"> + <div class="ui attached left aligned segment"> + <p>{{ctx.Locale.Tr "repo.issues.label_templates.info"}}</p> + <br> + <form class="ui form center" action="{{.Link}}/initialize" method="post"> + {{.CsrfTokenHtml}} + <div class="field"> + <div class="ui selection dropdown"> + <input type="hidden" name="template_name" value="Default"> + <div class="default text">{{ctx.Locale.Tr "repo.issues.label_templates.helper"}}</div> + <div class="menu"> + {{range .LabelTemplateFiles}} + <div class="item" data-value="{{.DisplayName}}">{{.DisplayName}}<br><p>({{.Description}})</p></div> + {{end}} + </div> + {{svg "octicon-triangle-down" 18 "dropdown icon"}} + </div> + </div> + <button type="submit" class="ui primary button">{{ctx.Locale.Tr "repo.issues.label_templates.use"}}</button> + </form> + </div> + </div> +</div> diff --git a/templates/repo/issue/labels/label_new.tmpl b/templates/repo/issue/labels/label_new.tmpl new file mode 100644 index 0000000..32fd8e7 --- /dev/null +++ b/templates/repo/issue/labels/label_new.tmpl @@ -0,0 +1,48 @@ +<div class="ui small new-label modal"> + <div class="header"> + {{ctx.Locale.Tr "repo.issues.new_label"}} + </div> + <div class="content"> + <form class="ui new-label form ignore-dirty" action="{{$.Link}}/new" method="post"> + {{.CsrfTokenHtml}} + <div class="required field"> + <label for="name">{{ctx.Locale.Tr "repo.issues.label_title"}}</label> + <div class="ui small input"> + <input class="label-name-input" name="title" placeholder="{{ctx.Locale.Tr "repo.issues.new_label_placeholder"}}" autofocus required maxlength="50"> + </div> + </div> + <div class="field label-exclusive-input-field"> + <div class="ui checkbox"> + <input class="label-exclusive-input" name="exclusive" type="checkbox"> + <label>{{ctx.Locale.Tr "repo.issues.label_exclusive"}}</label> + </div> + <br> + <small class="desc">{{ctx.Locale.Tr "repo.issues.label_exclusive_desc"}}</small> + </div> + <div class="field"> + <label for="description">{{ctx.Locale.Tr "repo.issues.label_description"}}</label> + <div class="ui small fluid input"> + <input class="label-desc-input" name="description" placeholder="{{ctx.Locale.Tr "repo.issues.new_label_desc_placeholder"}}" maxlength="200"> + </div> + </div> + <div class="field color-field"> + <label for="color">{{ctx.Locale.Tr "repo.issues.label_color"}}</label> + <div class="js-color-picker-input column"> + <input name="color" value="#70c24a" placeholder="#c320f6" required maxlength="7"> + {{template "repo/issue/label_precolors"}} + </div> + </div> + </form> + </div> + + <div class="actions"> + <button class="ui cancel button"> + {{svg "octicon-x"}} + {{ctx.Locale.Tr "cancel"}} + </button> + <button class="ui primary ok button"> + {{svg "octicon-check"}} + {{ctx.Locale.Tr "repo.issues.create_label"}} + </button> + </div> +</div> diff --git a/templates/repo/issue/labels/labels_selector_field.tmpl b/templates/repo/issue/labels/labels_selector_field.tmpl new file mode 100644 index 0000000..9e54e7a --- /dev/null +++ b/templates/repo/issue/labels/labels_selector_field.tmpl @@ -0,0 +1,46 @@ +<div class="ui {{if or (not .HasIssuesOrPullsWritePermission) .Repository.IsArchived}}disabled{{end}} floating jump select-label dropdown"> + <span class="text muted flex-text-block"> + <strong>{{ctx.Locale.Tr "repo.issues.new.labels"}}</strong> + {{if and .HasIssuesOrPullsWritePermission (not .Repository.IsArchived)}} + {{svg "octicon-gear" 16 "tw-ml-1"}} + {{end}} + </span> + <div class="filter menu ugc-labels" {{if .Issue}}data-action="update" data-issue-id="{{$.Issue.ID}}" data-update-url="{{$.RepoLink}}/issues/labels"{{else}}data-id="#label_ids"{{end}}> + {{if or .Labels .OrgLabels}} + <div class="ui icon search input"> + <i class="icon">{{svg "octicon-search" 16}}</i> + <input class="tw-w-auto" type="text" placeholder="{{ctx.Locale.Tr "repo.issues.filter_labels"}}"> + </div> + {{end}} + <a class="no-select item" href="#">{{ctx.Locale.Tr "repo.issues.new.clear_labels"}}</a> + {{if or .Labels .OrgLabels}} + {{$previousExclusiveScope := "_no_scope"}} + {{range .Labels}} + {{$exclusiveScope := .ExclusiveScope}} + {{if and (ne $previousExclusiveScope "_no_scope") (ne $previousExclusiveScope $exclusiveScope)}} + <div class="divider"></div> + {{end}} + {{$previousExclusiveScope = $exclusiveScope}} + <a class="{{if .IsChecked}}checked{{end}} item" href="#" data-id="{{.ID}}" {{if .IsArchived}}data-is-archived{{end}} data-id-selector="#label_{{.ID}}" data-scope="{{$exclusiveScope}}"><span class="octicon-check {{if not .IsChecked}}tw-invisible{{end}}">{{if $exclusiveScope}}{{svg "octicon-dot-fill"}}{{else}}{{svg "octicon-check"}}{{end}}</span> {{RenderLabel $.Context ctx.Locale .}} + {{if .Description}}<br><small class="desc">{{.Description | RenderEmoji $.Context}}</small>{{end}} + <p class="archived-label-hint">{{template "repo/issue/labels/label_archived" .}}</p> + </a> + {{end}} + <div class="divider"></div> + {{$previousExclusiveScope = "_no_scope"}} + {{range .OrgLabels}} + {{$exclusiveScope := .ExclusiveScope}} + {{if and (ne $previousExclusiveScope "_no_scope") (ne $previousExclusiveScope $exclusiveScope)}} + <div class="divider"></div> + {{end}} + {{$previousExclusiveScope = $exclusiveScope}} + <a class="{{if .IsChecked}}checked{{end}} item" href="#" data-id="{{.ID}}" {{if .IsArchived}}data-is-archived{{end}} data-id-selector="#label_{{.ID}}" data-scope="{{$exclusiveScope}}"><span class="octicon-check {{if not .IsChecked}}tw-invisible{{end}}">{{if $exclusiveScope}}{{svg "octicon-dot-fill"}}{{else}}{{svg "octicon-check"}}{{end}}</span> {{RenderLabel $.Context ctx.Locale .}} + {{if .Description}}<br><small class="desc">{{.Description | RenderEmoji $.Context}}</small>{{end}} + <p class="archived-label-hint">{{template "repo/issue/labels/label_archived" .}}</p> + </a> + {{end}} + {{else}} + <div class="disabled item">{{ctx.Locale.Tr "repo.issues.new.no_items"}}</div> + {{end}} + </div> +</div> diff --git a/templates/repo/issue/labels/labels_sidebar.tmpl b/templates/repo/issue/labels/labels_sidebar.tmpl new file mode 100644 index 0000000..81fc970 --- /dev/null +++ b/templates/repo/issue/labels/labels_sidebar.tmpl @@ -0,0 +1,11 @@ +<div class="ui labels list"> + <span class="no-select {{if .root.HasSelectedLabel}}tw-hidden{{end}}">{{ctx.Locale.Tr "repo.issues.new.no_label"}}</span> + <span class="labels-list ugc-labels"> + {{range .root.Labels}} + {{template "repo/issue/labels/label" dict "root" $.root "label" .}} + {{end}} + {{range .root.OrgLabels}} + {{template "repo/issue/labels/label" dict "root" $.root "label" .}} + {{end}} + </span> +</div> |