diff options
Diffstat (limited to 'templates/repo')
-rw-r--r-- | templates/repo/issue/labels.tmpl | 170 | ||||
-rw-r--r-- | templates/repo/issue/labels/edit_delete_label.tmpl | 59 | ||||
-rw-r--r-- | templates/repo/issue/labels/label_list.tmpl | 97 | ||||
-rw-r--r-- | templates/repo/issue/labels/label_load_template.tmpl | 30 | ||||
-rw-r--r-- | templates/repo/issue/labels/label_new.tmpl | 27 | ||||
-rw-r--r-- | templates/repo/issue/new_form.tmpl | 10 | ||||
-rw-r--r-- | templates/repo/issue/view_content/sidebar.tmpl | 10 |
7 files changed, 239 insertions, 164 deletions
diff --git a/templates/repo/issue/labels.tmpl b/templates/repo/issue/labels.tmpl index 4719c8f1fb..d3df3b5944 100644 --- a/templates/repo/issue/labels.tmpl +++ b/templates/repo/issue/labels.tmpl @@ -10,173 +10,17 @@ </div> {{end}} </div> - {{if not .Repository.IsArchived}} - <div class="ui new-label segment hide"> - <form class="ui form" action="{{$.RepoLink}}/labels/new" method="post"> - {{.CsrfTokenHtml}} - <div class="ui grid"> - <div class="three wide column"> - <div class="ui small input"> - <input class="new-label-input emoji-input" name="title" placeholder="{{.i18n.Tr "repo.issues.new_label_placeholder"}}" autofocus required maxlength="50"> - </div> - </div> - <div class="five wide column"> - <div class="ui small fluid input"> - <input class="new-label-desc-input" name="description" placeholder="{{.i18n.Tr "repo.issues.new_label_desc_placeholder"}}" maxlength="200"> - </div> - </div> - <div class="color picker column"> - <input class="color-picker" name="color" value="#70c24a" required maxlength="7"> - </div> - <div class="column precolors"> - {{template "repo/issue/label_precolors"}} - </div> - <div class="buttons"> - <div class="ui blue small basic cancel button">{{.i18n.Tr "repo.milestones.cancel"}}</div> - <button class="ui green small button">{{.i18n.Tr "repo.issues.create_label"}}</button> - </div> - </div> - </form> - </div> - {{end}} <div class="ui divider"></div> - - <div class="ui right floated secondary filter menu"> - <!-- Sort --> - <div class="ui dropdown type jump item"> - <span class="text"> - {{.i18n.Tr "repo.issues.filter_sort"}} - <i class="dropdown icon"></i> - </span> - <div class="menu"> - <a class="{{if or (eq .SortType "alphabetically") (not .SortType)}}active{{end}} item" href="{{$.Link}}?sort=alphabetically&state={{$.State}}">{{.i18n.Tr "repo.issues.label.filter_sort.alphabetically"}}</a> - <a class="{{if eq .SortType "reversealphabetically"}}active{{end}} item" href="{{$.Link}}?sort=reversealphabetically&state={{$.State}}">{{.i18n.Tr "repo.issues.label.filter_sort.reverse_alphabetically"}}</a> - <a class="{{if eq .SortType "leastissues"}}active{{end}} item" href="{{$.Link}}?sort=leastissues&state={{$.State}}">{{.i18n.Tr "repo.milestones.filter_sort.least_issues"}}</a> - <a class="{{if eq .SortType "mostissues"}}active{{end}} item" href="{{$.Link}}?sort=mostissues&state={{$.State}}">{{.i18n.Tr "repo.milestones.filter_sort.most_issues"}}</a> - </div> - </div> - </div> + {{if and (or .CanWriteIssues .CanWritePulls) (not .Repository.IsArchived)}} + {{template "repo/issue/labels/label_new" .}} + {{end}} {{template "base/alert" .}} - <div class="ui black basic label">{{.i18n.Tr "repo.issues.label_count" .NumLabels}}</div> - <div class="label list"> - {{if and (or $.CanWriteIssues $.CanWritePulls) (eq .NumLabels 0) (not $.Repository.IsArchived) }} - <div class="ui centered grid"> - <div class="twelve wide column eight wide computer column"> - <div class="ui attached left aligned segment"> - <!-- <h4 class="ui header"> - {{.i18n.Tr "repo.issues.label_templates.title"}} - <a target="_blank" rel="noopener noreferrer" - href="https://discuss.gogs.io/t/how-to-use-predefined-label-templates/599"> - <span class="octicon octicon-question"></span> - </a> - </h4> --> - <p>{{.i18n.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">{{.i18n.Tr "repo.issues.label_templates.helper"}}</div> - <div class="menu"> - {{range $template, $labels := .LabelTemplates}} - <div class="item" data-value="{{$template}}">{{$template}}<br/><i>({{$labels}})</i></div> - {{end}} - </div> - </div> - </div> - <button type="submit" class="ui blue button">{{.i18n.Tr "repo.issues.label_templates.use"}}</button> - </form> - </div> - </div> - </div> - {{end}} - - <div class="ui divider"></div> - - {{range .Labels}} - <li class="item"> - <div class="ui grid"> - <div class="three wide column"> - <div class="ui label has-emoji" style="color: {{.ForegroundColor}}; background-color: {{.Color}}">{{svg "octicon-tag" 16}} {{.Name}}</div> - </div> - <div class="seven wide column"> - {{.Description}} - </div> - <div class="three wide column"> - <a class="ui right open-issues" href="{{$.RepoLink}}/issues?labels={{.ID}}">{{svg "octicon-issue-opened" 16}} {{$.i18n.Tr "repo.issues.label_open_issues" .NumOpenIssues}}</a> - </div> - <div class="three wide column"> - {{if and (not $.Repository.IsArchived) (or $.CanWriteIssues $.CanWritePulls)}} - <a class="ui right delete-button" href="#" data-url="{{$.RepoLink}}/labels/delete" data-id="{{.ID}}">{{svg "octicon-trashcan" 16}} {{$.i18n.Tr "repo.issues.label_delete"}}</a> - <a class="ui right edit-label-button" href="#" data-id="{{.ID}}" data-title="{{.Name}}" data-description="{{.Description}}" data-color={{.Color}}>{{svg "octicon-pencil" 16}} {{$.i18n.Tr "repo.issues.label_edit"}}</a> - {{end}} - </div> - </div> - </li> - {{end}} - </div> + {{template "repo/issue/labels/label_list" .}} </div> </div> -{{if and (or .CanWriteIssues .CanWritePulls) (not .Repository.IsArchived)}} - <div class="ui small basic delete modal"> - <div class="ui icon header"> - <i class="trash icon"></i> - {{.i18n.Tr "repo.issues.label_deletion"}} - </div> - <div class="content"> - <p>{{.i18n.Tr "repo.issues.label_deletion_desc"}}</p> - </div> - <div class="actions"> - <div class="ui red basic inverted cancel button"> - <i class="remove icon"></i> - {{.i18n.Tr "modal.no"}} - </div> - <div class="ui green basic inverted ok button"> - <i class="checkmark icon"></i> - {{.i18n.Tr "modal.yes"}} - </div> - </div> - </div> - - <div class="ui small edit-label modal"> - <div class="header"> - {{.i18n.Tr "repo.issues.label_modify"}} - </div> - <div class="content"> - <form class="ui edit-label form" action="{{$.RepoLink}}/labels/edit" method="post"> - {{.CsrfTokenHtml}} - <input id="label-modal-id" name="id" type="hidden"> - <div class="ui grid"> - <div class="three wide column"> - <div class="ui small input"> - <input class="new-label-input emoji-input" name="title" placeholder="{{.i18n.Tr "repo.issues.new_label_placeholder"}}" autofocus required maxlength="50"> - </div> - </div> - <div class="five wide column"> - <div class="ui small fluid input"> - <input class="new-label-desc-input" name="description" placeholder="{{.i18n.Tr "repo.issues.new_label_desc_placeholder"}}" maxlength="200"> - </div> - </div> - <div class="color picker column"> - <input class="color-picker" name="color" value="#70c24a" required maxlength="7"> - </div> - <div class="column precolors"> - {{template "repo/issue/label_precolors"}} - </div> - </div> - </form> - </div> - <div class="actions"> - <div class="ui negative button"> - {{.i18n.Tr "modal.no"}} - </div> - <div class="ui positive right labeled icon button"> - {{.i18n.Tr "modal.modify"}} - <i class="checkmark icon"></i> - </div> - </div> - </div> +{{if and (or .CanWriteIssues .CanWritePulls) (not .Repository.IsArchived) }} +{{template "repo/issue/labels/edit_delete_label" .}} {{end}} +</div> {{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 0000000000..1ddfd39ee4 --- /dev/null +++ b/templates/repo/issue/labels/edit_delete_label.tmpl @@ -0,0 +1,59 @@ +<div class="ui small basic delete modal"> + <div class="ui icon header"> + <i class="trash icon"></i> + {{.i18n.Tr "repo.issues.label_deletion"}} + </div> + <div class="content"> + <p>{{.i18n.Tr "repo.issues.label_deletion_desc"}}</p> + </div> + <div class="actions"> + <div class="ui red basic inverted cancel button"> + <i class="remove icon"></i> + {{.i18n.Tr "modal.no"}} + </div> + <div class="ui green basic inverted ok button"> + <i class="checkmark icon"></i> + {{.i18n.Tr "modal.yes"}} + </div> + </div> + </div> + + <div class="ui small edit-label modal"> + <div class="header"> + {{.i18n.Tr "repo.issues.label_modify"}} + </div> + <div class="content"> + <form class="ui edit-label form" action="{{$.Link}}/edit" method="post"> + {{.CsrfTokenHtml}} + <input id="label-modal-id" name="id" type="hidden"> + <div class="ui grid"> + <div class="three wide column"> + <div class="ui small input"> + <input class="new-label-input emoji-input" name="title" placeholder="{{.i18n.Tr "repo.issues.new_label_placeholder"}}" autofocus required maxlength="50"> + </div> + </div> + <div class="five wide column"> + <div class="ui small fluid input"> + <input class="new-label-desc-input" name="description" placeholder="{{.i18n.Tr "repo.issues.new_label_desc_placeholder"}}" maxlength="200"> + </div> + </div> + <div class="color picker column"> + <input class="color-picker" name="color" value="#70c24a" required maxlength="7"> + </div> + <div class="column precolors"> + {{template "repo/issue/label_precolors"}} + </div> + </div> + </form> + </div> + <div class="actions"> + <div class="ui negative button"> + {{.i18n.Tr "modal.no"}} + </div> + <div class="ui positive right labeled icon button"> + {{.i18n.Tr "modal.modify"}} + <i class="checkmark icon"></i> + </div> + </div> + </div> + diff --git a/templates/repo/issue/labels/label_list.tmpl b/templates/repo/issue/labels/label_list.tmpl new file mode 100644 index 0000000000..ce33d76fc1 --- /dev/null +++ b/templates/repo/issue/labels/label_list.tmpl @@ -0,0 +1,97 @@ +<h4 class="ui top attached header"> + {{.i18n.Tr "repo.issues.label_count" .NumLabels}} + <div class="ui right"> + <div class="ui right floated secondary filter menu"> + <!-- Sort --> + <div class="ui dropdown type jump item"> + <span class="text"> + {{.i18n.Tr "repo.issues.filter_sort"}} + <i class="dropdown icon"></i> + </span> + <div class="menu"> + <a class="{{if or (eq .SortType "alphabetically") (not .SortType)}}active{{end}} item" href="{{$.Link}}?sort=alphabetically&state={{$.State}}">{{.i18n.Tr "repo.issues.label.filter_sort.alphabetically"}}</a> + <a class="{{if eq .SortType "reversealphabetically"}}active{{end}} item" href="{{$.Link}}?sort=reversealphabetically&state={{$.State}}">{{.i18n.Tr "repo.issues.label.filter_sort.reverse_alphabetically"}}</a> + <a class="{{if eq .SortType "leastissues"}}active{{end}} item" href="{{$.Link}}?sort=leastissues&state={{$.State}}">{{.i18n.Tr "repo.milestones.filter_sort.least_issues"}}</a> + <a class="{{if eq .SortType "mostissues"}}active{{end}} item" href="{{$.Link}}?sort=mostissues&state={{$.State}}">{{.i18n.Tr "repo.milestones.filter_sort.most_issues"}}</a> + </div> + </div> + </div> + </div> <!-- filter menu --> +</h4> + +<div class="ui attached segment"> + <div class="labelspage"> + {{if and (not $.PageIsOrgSettingsLabels) (or $.CanWriteIssues $.CanWritePulls) (eq .NumLabels 0) (not $.Repository.IsArchived) }} + {{template "repo/issue/labels/label_load_template" .}} + <div class="ui divider"></div> + {{else if and ($.PageIsOrgSettingsLabels) (eq .NumLabels 0)}} + {{template "repo/issue/labels/label_load_template" .}} + {{end}} + {{range .Labels}} + <li class="item"> + <div class="ui grid middle aligned"> + <div class="four wide column"> + <div class="ui label has-emoji" style="color: {{.ForegroundColor}}; background-color: {{.Color}}">{{svg "octicon-tag" 16}} {{.Name}}</div> + </div> + <div class="six wide column"> + <div class="ui has-emoji"> + {{.Description}} + </div> + </div> + <div class="three wide column"> + {{if $.PageIsOrgSettingsLabels}} + <a class="ui right open-issues" href="/issues?labels={{.ID}}">{{svg "octicon-issue-opened" 16}} {{$.i18n.Tr "repo.issues.label_open_issues" .NumOpenIssues}}</a> + {{else}} + <a class="ui right open-issues" href="{{$.RepoLink}}/issues?labels={{.ID}}">{{svg "octicon-issue-opened" 16}} {{$.i18n.Tr "repo.issues.label_open_issues" .NumOpenIssues}}</a> + {{end}} + </div> + <div class="three wide column"> + {{if and (not $.PageIsOrgSettingsLabels ) (not $.Repository.IsArchived) (or $.CanWriteIssues $.CanWritePulls)}} + <a class="ui right delete-button" href="#" data-url="{{$.Link}}/delete" data-id="{{.ID}}">{{svg "octicon-trashcan" 16}} {{$.i18n.Tr "repo.issues.label_delete"}}</a> + <a class="ui right edit-label-button" href="#" data-id="{{.ID}}" data-title="{{.Name}}" data-description="{{.Description}}" data-color={{.Color}}>{{svg "octicon-pencil" 16}} {{$.i18n.Tr "repo.issues.label_edit"}}</a> + {{else if $.PageIsOrgSettingsLabels}} + <a class="ui right delete-button" href="#" data-url="{{$.Link}}/delete" data-id="{{.ID}}">{{svg "octicon-trashcan" 16}} {{$.i18n.Tr "repo.issues.label_delete"}}</a> + <a class="ui right edit-label-button" href="#" data-id="{{.ID}}" data-title="{{.Name}}" data-description="{{.Description}}" data-color={{.Color}}>{{svg "octicon-pencil" 16}} {{$.i18n.Tr "repo.issues.label_edit"}}</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"> + {{$.i18n.Tr "repo.org_labels_desc" | Str2html}} + {{if .IsOrganizationOwner}} + <a class="ui" href="{{.OrganizationLink}}/settings/labels">({{$.i18n.Tr "repo.org_labels_desc_manage"}})</a>: + {{end}} + </div> + </div> + </li> + {{if (not $.PageIsOrgSettingsLabels)}} + <div class="orglabel"> + {{range .OrgLabels}} + <li class="item"> + <div class="ui grid middle aligned"> + <div class="three wide column"> + <div class="ui label has-emoji" style="color: {{.ForegroundColor}}; background-color: {{.Color}}">{{svg "octicon-tag" 16}} {{.Name}}</div> + </div> + <div class="seven wide column"> + <div class="ui has-emoji"> + {{.Description}} + </div> + </div> + <div class="three wide column"> + <a class="ui right open-issues" href="{{$.RepoLink}}/issues?labels={{.ID}}">{{svg "octicon-issue-opened" 16}} {{$.i18n.Tr "repo.issues.label_open_issues" .NumOpenRepoIssues}}</a> + </div> + <div class="three wide column"> + </div> + </div> + </li> + {{end}} + </div> + {{end}} + {{end}} + </div> +</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 0000000000..76ee77658a --- /dev/null +++ b/templates/repo/issue/labels/label_load_template.tmpl @@ -0,0 +1,30 @@ +<div class="ui centered grid"> + <div class="twelve wide computer column"> + <div class="ui attached left aligned segment"> + <!-- <h4 class="ui header"> + {{.i18n.Tr "repo.issues.label_templates.title"}} + <a target="_blank" rel="noopener noreferrer" + href="https://discuss.gogs.io/t/how-to-use-predefined-label-templates/599"> + <span class="octicon octicon-question"></span> + </a> + </h4> --> + <p>{{.i18n.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">{{.i18n.Tr "repo.issues.label_templates.helper"}}</div> + <div class="menu"> + {{range $template, $labels := .LabelTemplates}} + <div class="item" data-value="{{$template}}">{{$template}}<br/><i>({{$labels}})</i></div> + {{end}} + </div> + </div> + </div> + <button type="submit" class="ui blue button">{{.i18n.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 0000000000..15a6c029a3 --- /dev/null +++ b/templates/repo/issue/labels/label_new.tmpl @@ -0,0 +1,27 @@ +<div class="ui new-label segment hide"> + <form class="ui form" action="{{$.Link}}/new" method="post"> + {{.CsrfTokenHtml}} + <div class="ui grid"> + <div class="three wide column"> + <div class="ui small input"> + <input class="new-label-input emoji-input" name="title" placeholder="{{.i18n.Tr "repo.issues.new_label_placeholder"}}" autofocus required maxlength="50"> + </div> + </div> + <div class="three wide column"> + <div class="ui small fluid input"> + <input class="new-label-desc-input" name="description" placeholder="{{.i18n.Tr "repo.issues.new_label_desc_placeholder"}}" maxlength="200"> + </div> + </div> + <div class="color picker column"> + <input class="color-picker" name="color" value="#70c24a" required maxlength="7"> + </div> + <div class="column precolors"> + {{template "repo/issue/label_precolors"}} + </div> + <div class="buttons"> + <div class="ui blue small basic cancel button">{{.i18n.Tr "repo.milestones.cancel"}}</div> + <button class="ui green small button">{{.i18n.Tr "repo.issues.create_label"}}</button> + </div> + </div> + </form> +</div> diff --git a/templates/repo/issue/new_form.tmpl b/templates/repo/issue/new_form.tmpl index 524b849c14..a53bbdc685 100644 --- a/templates/repo/issue/new_form.tmpl +++ b/templates/repo/issue/new_form.tmpl @@ -38,7 +38,7 @@ {{template "repo/issue/branch_selector_field" .}} <input id="label_ids" name="label_ids" type="hidden" value="{{.label_ids}}"> - <div class="ui {{if not .Labels}}disabled{{end}} floating jump select-label dropdown"> + <div class="ui {{if and (not .Labels) (not .OrgLabels)}}disabled{{end}} floating jump select-label dropdown"> <span class="text"> <strong>{{.i18n.Tr "repo.issues.new.labels"}}</strong> {{svg "octicon-gear" 16}} @@ -49,6 +49,11 @@ <a class="{{if .IsChecked}}checked{{end}} item has-emoji" href="#" data-id="{{.ID}}" data-id-selector="#label_{{.ID}}"><span class="octicon-check {{if not .IsChecked}}invisible{{end}}">{{svg "octicon-check" 16}}</span><span class="label color" style="background-color: {{.Color}}"></span> {{.Name}} {{if .Description }}<br><small class="desc">{{.Description}}</small>{{end}}</a> {{end}} + <div class="ui divider"></div> + {{range .OrgLabels}} + <a class="{{if .IsChecked}}checked{{end}} item has-emoji" href="#" data-id="{{.ID}}" data-id-selector="#label_{{.ID}}"><span class="octicon-check {{if not .IsChecked}}invisible{{end}}">{{svg "octicon-check" 16}}</span><span class="label color" style="background-color: {{.Color}}"></span> {{.Name}} + {{if .Description }}<br><small class="desc">{{.Description}}</small>{{end}}</a> + {{end}} </div> </div> <div class="ui labels list"> @@ -56,6 +61,9 @@ {{range .Labels}} <a class="{{if not .IsChecked}}hide{{end}} item" id="label_{{.ID}}" href="{{$.RepoLink}}/issues?labels={{.ID}}"><span class="label color" style="background-color: {{.Color}}"></span> <span class="text has-emoji">{{.Name}}</span></a> {{end}} + {{range .OrgLabels}} + <a class="{{if not .IsChecked}}hide{{end}} item" id="label_{{.ID}}" href="/issues?labels={{.ID}}"><span class="label color" style="background-color: {{.Color}}"></span> <span class="text has-emoji">{{.Name}}</span></a> + {{end}} </div> <div class="ui divider"></div> diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl index 1d1f1916da..d0275c23f4 100644 --- a/templates/repo/issue/view_content/sidebar.tmpl +++ b/templates/repo/issue/view_content/sidebar.tmpl @@ -15,6 +15,11 @@ <a class="{{if .IsChecked}}checked{{end}} item has-emoji" href="#" data-id="{{.ID}}" data-id-selector="#label_{{.ID}}"><span class="octicon-check {{if not .IsChecked}}invisible{{end}}">{{svg "octicon-check" 16}}</span><span class="label color" style="background-color: {{.Color}}"></span> {{.Name}} {{if .Description }}<br><small class="desc">{{.Description}}</small>{{end}}</a> {{end}} + <div class="ui divider"></div> + {{range .OrgLabels}} + <a class="{{if .IsChecked}}checked{{end}} item has-emoji" href="#" data-id="{{.ID}}" data-id-selector="#label_{{.ID}}"><span class="octicon-check {{if not .IsChecked}}invisible{{end}}">{{svg "octicon-check" 16}}</span><span class="label color" style="background-color: {{.Color}}"></span> {{.Name}} + {{if .Description }}<br><small class="desc">{{.Description}}</small>{{end}}</a> + {{end}} </div> </div> <div class="ui labels list"> @@ -23,6 +28,11 @@ <div class="item"> <a class="ui label has-emoji {{if not .IsChecked}}hide{{end}}" id="label_{{.ID}}" href="{{$.RepoLink}}/issues?labels={{.ID}}" style="color: {{.ForegroundColor}}; background-color: {{.Color}}" title="{{.Description}}">{{.Name}}</a> </div> + {{end}} + {{range .OrgLabels}} + <div class="item"> + <a class="ui label has-emoji {{if not .IsChecked}}hide{{end}}" id="label_{{.ID}}" href="{{$.RepoLink}}/issues?labels={{.ID}}" style="color: {{.ForegroundColor}}; background-color: {{.Color}}" title="{{.Description}}">{{.Name}}</a> + </div> {{end}} </div> |