Skip to content

Commit 2f9797e

Browse files
committed
fix
1 parent 4acf021 commit 2f9797e

File tree

4 files changed

+11
-8
lines changed

4 files changed

+11
-8
lines changed

templates/repo/diff/options_dropdown.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<div class="ui dropdown tiny basic button icon-button tooltip" data-content="{{.locale.Tr "repo.diff.options_button"}}">
22
{{svg "octicon-kebab-horizontal"}}
33
<div class="menu">
4-
<a class="item tiny basic toggle button" id="show-file-list-btn">{{.locale.Tr "repo.diff.show_diff_stats"}}</a>
4+
<a class="item" id="show-file-list-btn">{{.locale.Tr "repo.diff.show_diff_stats"}}</a>
55
{{if .Issue.Index}}
66
<a class="item" href="{{$.RepoLink}}/pulls/{{.Issue.Index}}.patch" download="{{.Issue.Index}}.patch">{{.locale.Tr "repo.diff.download_patch"}}</a>
77
<a class="item" href="{{$.RepoLink}}/pulls/{{.Issue.Index}}.diff" download="{{.Issue.Index}}.diff">{{.locale.Tr "repo.diff.download_diff"}}</a>

templates/repo/diff/whitespace_dropdown.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@
2828
</a>
2929
</div>
3030
</div>
31-
<a class="ui tiny basic toggle button icon-button tooltip" href="?style={{if .IsSplitStyle}}unified{{else}}split{{end}}&whitespace={{$.WhitespaceBehavior}}" data-content="{{if .IsSplitStyle}}{{.locale.Tr "repo.diff.show_unified_view"}}{{else}}{{.locale.Tr "repo.diff.show_split_view"}}{{end}}">{{if .IsSplitStyle}}{{svg "gitea-join"}}{{else}}{{svg "gitea-split"}}{{end}}</a>
31+
<a class="ui tiny basic button icon-button tooltip" href="?style={{if .IsSplitStyle}}unified{{else}}split{{end}}&whitespace={{$.WhitespaceBehavior}}" data-content="{{if .IsSplitStyle}}{{.locale.Tr "repo.diff.show_unified_view"}}{{else}}{{.locale.Tr "repo.diff.show_split_view"}}{{end}}">{{if .IsSplitStyle}}{{svg "gitea-join"}}{{else}}{{svg "gitea-split"}}{{end}}</a>

templates/repo/settings/webhook/history.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
{{else}}
1919
<span class="text red">{{svg "octicon-alert"}}</span>
2020
{{end}}
21-
<a class="ui primary sha label toggle button" data-target="#info-{{.ID}}">{{.UUID}}</a>
21+
<a class="ui primary sha label toggle button show-panel" data-panel="#info-{{.ID}}">{{.UUID}}</a>
2222
<div class="ui right">
2323
<span class="text grey time">
2424
{{.DeliveredString}}

web_src/js/features/common-global.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,6 @@ export function initGlobalCommon() {
120120
$('.tabular.menu .item').tab();
121121
$('.tabable.menu .item').tab();
122122

123-
$('.toggle.button').on('click', function () {
124-
toggleElem($($(this).data('target')));
125-
});
126-
127123
// make table <tr> and <td> elements clickable like a link
128124
$('tr[data-href], td[data-href]').on('click', function (e) {
129125
const href = $(this).data('href');
@@ -327,8 +323,15 @@ export function initGlobalButtons() {
327323
});
328324

329325
$('.show-panel.button').on('click', function (e) {
326+
// a '.show-panel.button' can show a panel, by `data-panel="selector"`
327+
// if the button is a "toggle" button, it toggles the panel
330328
e.preventDefault();
331-
showElem($(this).data('panel'));
329+
const sel = $(this).attr('data-panel');
330+
if (this.classList.contains('toggle')) {
331+
toggleElem(sel);
332+
} else {
333+
showElem(sel);
334+
}
332335
});
333336

334337
$('.hide-panel.button').on('click', function (e) {

0 commit comments

Comments
 (0)