Skip to content

Commit 7212c2d

Browse files
committed
WIP: add tippy button to filters
1 parent 01f43b5 commit 7212c2d

File tree

4 files changed

+80
-1
lines changed

4 files changed

+80
-1
lines changed

templates/repo/issue/filters.tmpl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,17 @@
2121
{{else}}
2222
{{template "repo/issue/filter_list" .}}
2323
{{end}}
24+
25+
<button class="ui compact secondary button js-btn-misc-actions">
26+
&hellip;
27+
</button>
28+
29+
<div class="misc-actions-popup tippy-target">
30+
<div class="flex-items-block misc-actions-panel-list">
31+
<a class="item muted" href="{{$.RepoLink}}/issues/export?{{$.Page.GetParams}}">{{ctx.Locale.Tr "action.export_to_excel"}}</a>
32+
</div>
33+
</div>
34+
2435
</div>
2536
</div>
2637
</div>

templates/repo/issue/list.tmpl

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,12 @@
3131
<a class="ui small primary small button issue-list-new{{if not .PullRequestCtx.Allowed}} disabled{{end}}" href="{{if .PullRequestCtx.Allowed}}{{.PullRequestCtx.BaseRepo.Link}}/compare/{{.PullRequestCtx.BaseRepo.DefaultBranch | PathEscapeSegments}}...{{if ne .Repository.Owner.Name .PullRequestCtx.BaseRepo.Owner.Name}}{{PathEscape .Repository.Owner.Name}}:{{end}}{{.Repository.DefaultBranch | PathEscapeSegments}}{{end}}">{{ctx.Locale.Tr "action.compare_commits_general"}}</a>
3232
{{end}}
3333
{{end}}
34-
<a class="ui small primary button issue-list-export" href="{{.RepoLink}}/issues/export?{{.Page.GetParams}}">{{ctx.Locale.Tr "action.export_to_excel"}}</a>
34+
3535
</div>
3636

3737
{{template "repo/issue/filters" .}}
3838

39+
3940
<div id="issue-actions" class="issue-list-toolbar tw-hidden">
4041
<div class="issue-list-toolbar-left">
4142
{{template "repo/issue/openclose" .}}
@@ -51,7 +52,30 @@
5152
</div>
5253
<div class="issue-list-toolbar-right">
5354
{{template "repo/issue/filter_actions" .}}
55+
56+
<!-- Export dropdown button (Tippy.js) placed to the right of filter_actions -->
57+
<div class="issue-export-container" style="display:inline-block; margin-left:8px;">
58+
<button id="issue-export-btn" class="ui small button" type="button" aria-haspopup="true" aria-expanded="false" title="More actions">
59+
&hellip;
60+
</button>
61+
62+
<!-- Hidden popover content for tippy.js -->
63+
<div id="issue-export-popover" style="display:none;">
64+
<div class="dropdown-popover">
65+
<a href="#" class="dropdown-item" id="export-csv">Export CSV</a>
66+
<a href="#" class="dropdown-item" id="export-json">Export JSON</a>
67+
<a href="#" class="dropdown-item" id="export-selected">Export selected</a>
68+
</div>
69+
</div>
70+
71+
<style>
72+
.issue-export-container .dropdown-popover { padding:8px; min-width:160px; background:var(--dropdown-bg,#fff); border-radius:4px; box-shadow:0 2px 8px rgba(0,0,0,0.12); }
73+
.issue-export-container .dropdown-item { display:block; padding:6px 8px; color:var(--link-color,#0366d6); text-decoration:none; }
74+
.issue-export-container .dropdown-item:hover { background:var(--hover-bg,#f6f8fa); }
75+
</style>
76+
</div>
5477
</div>
78+
5579
</div>
5680
{{template "shared/issuelist" dict "." . "listType" "repo"}}
5781
</div>

web_src/css/repo/issue-list.css

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,29 @@
8484
margin-right: 8px;
8585
text-align: left;
8686
}
87+
88+
/* used by the misc-actions popup */
89+
.misc-actions-panel-field,
90+
.misc-actions-list {
91+
margin: 10px;
92+
}
93+
94+
.misc-actions-tab .item {
95+
padding: 5px 10px;
96+
background: none;
97+
color: var(--color-text-light-2);
98+
}
99+
100+
.misc-actions-tab .item.active {
101+
color: var(--color-text-dark);
102+
border-bottom: 3px solid currentcolor;
103+
}
104+
105+
.misc-actions-tab + .divider {
106+
margin: -1px 0 0;
107+
}
108+
109+
.misc-actions-panel-list .item {
110+
margin: 5px 0;
111+
}
112+

web_src/js/features/repo-issue-list.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {DELETE, POST} from '../modules/fetch.ts';
88
import {parseDom} from '../utils.ts';
99
import {fomanticQuery} from '../modules/fomantic/base.ts';
1010
import type {SortableEvent} from 'sortablejs';
11+
import {createTippy} from '../modules/tippy.ts';
1112

1213
function initRepoIssueListCheckboxes() {
1314
const issueSelectAll = document.querySelector<HTMLInputElement>('.issue-checkbox-all');
@@ -223,11 +224,28 @@ async function initIssuePinSort() {
223224
});
224225
}
225226

227+
function initMiscActionsButton(btn: HTMLButtonElement) {
228+
const elPanel = btn.nextElementSibling;
229+
createTippy(btn, {
230+
content: elPanel,
231+
trigger: 'click',
232+
placement: 'bottom-end',
233+
interactive: true,
234+
hideOnClick: true,
235+
arrow: false,
236+
});
237+
}
238+
239+
async function initRepoIssueMiscActions() {
240+
queryElems(document, '.js-btn-misc-actions', initMiscActionsButton);
241+
}
242+
226243
export function initRepoIssueList() {
227244
if (document.querySelector('.page-content.repository.issue-list, .page-content.repository.milestone-issue-list')) {
228245
initRepoIssueListCheckboxes();
229246
queryElems(document, '.ui.dropdown.user-remote-search', (el) => initDropdownUserRemoteSearch(el));
230247
initIssuePinSort();
248+
initRepoIssueMiscActions();
231249
} else if (document.querySelector('.page-content.dashboard.issues')) {
232250
// user or org home: issue list, pull request list
233251
queryElems(document, '.ui.dropdown.user-remote-search', (el) => initDropdownUserRemoteSearch(el));

0 commit comments

Comments
 (0)