Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
wxiaoguang committed Mar 24, 2023
1 parent 4acf021 commit 2f9797e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion templates/repo/diff/options_dropdown.tmpl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="ui dropdown tiny basic button icon-button tooltip" data-content="{{.locale.Tr "repo.diff.options_button"}}">
{{svg "octicon-kebab-horizontal"}}
<div class="menu">
<a class="item tiny basic toggle button" id="show-file-list-btn">{{.locale.Tr "repo.diff.show_diff_stats"}}</a>
<a class="item" id="show-file-list-btn">{{.locale.Tr "repo.diff.show_diff_stats"}}</a>
{{if .Issue.Index}}
<a class="item" href="{{$.RepoLink}}/pulls/{{.Issue.Index}}.patch" download="{{.Issue.Index}}.patch">{{.locale.Tr "repo.diff.download_patch"}}</a>
<a class="item" href="{{$.RepoLink}}/pulls/{{.Issue.Index}}.diff" download="{{.Issue.Index}}.diff">{{.locale.Tr "repo.diff.download_diff"}}</a>
Expand Down
2 changes: 1 addition & 1 deletion templates/repo/diff/whitespace_dropdown.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@
</a>
</div>
</div>
<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>
<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>
2 changes: 1 addition & 1 deletion templates/repo/settings/webhook/history.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
{{else}}
<span class="text red">{{svg "octicon-alert"}}</span>
{{end}}
<a class="ui primary sha label toggle button" data-target="#info-{{.ID}}">{{.UUID}}</a>
<a class="ui primary sha label toggle button show-panel" data-panel="#info-{{.ID}}">{{.UUID}}</a>
<div class="ui right">
<span class="text grey time">
{{.DeliveredString}}
Expand Down
13 changes: 8 additions & 5 deletions web_src/js/features/common-global.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,6 @@ export function initGlobalCommon() {
$('.tabular.menu .item').tab();
$('.tabable.menu .item').tab();

$('.toggle.button').on('click', function () {
toggleElem($($(this).data('target')));
});

// make table <tr> and <td> elements clickable like a link
$('tr[data-href], td[data-href]').on('click', function (e) {
const href = $(this).data('href');
Expand Down Expand Up @@ -327,8 +323,15 @@ export function initGlobalButtons() {
});

$('.show-panel.button').on('click', function (e) {
// a '.show-panel.button' can show a panel, by `data-panel="selector"`
// if the button is a "toggle" button, it toggles the panel
e.preventDefault();
showElem($(this).data('panel'));
const sel = $(this).attr('data-panel');
if (this.classList.contains('toggle')) {
toggleElem(sel);
} else {
showElem(sel);
}
});

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

0 comments on commit 2f9797e

Please sign in to comment.