File tree 4 files changed +11
-8
lines changed 4 files changed +11
-8
lines changed Original file line number Diff line number Diff line change 1
1
<div class="ui dropdown tiny basic button icon-button" data-tooltip-content="{{.locale.Tr "repo.diff.options_button"}}">
2
2
{{svg "octicon-kebab-horizontal"}}
3
3
<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>
5
5
{{if .Issue.Index}}
6
6
<a class="item" href="{{$.RepoLink}}/pulls/{{.Issue.Index}}.patch" download="{{.Issue.Index}}.patch">{{.locale.Tr "repo.diff.download_patch"}}</a>
7
7
<a class="item" href="{{$.RepoLink}}/pulls/{{.Issue.Index}}.diff" download="{{.Issue.Index}}.diff">{{.locale.Tr "repo.diff.download_diff"}}</a>
Original file line number Diff line number Diff line change 28
28
</a>
29
29
</div>
30
30
</div>
31
- <a class="ui tiny basic toggle button icon-button" href="?style={{if .IsSplitStyle}}unified{{else}}split{{end}}&whitespace={{$.WhitespaceBehavior}}" data-tooltip-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" href="?style={{if .IsSplitStyle}}unified{{else}}split{{end}}&whitespace={{$.WhitespaceBehavior}}" data-tooltip-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>
Original file line number Diff line number Diff line change 18
18
{{else}}
19
19
<span class="text red">{{svg "octicon-alert"}}</span>
20
20
{{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>
22
22
<div class="ui right">
23
23
<span class="text grey time">
24
24
{{.DeliveredString}}
Original file line number Diff line number Diff line change @@ -118,10 +118,6 @@ export function initGlobalCommon() {
118
118
119
119
$ ( '.tabular.menu .item' ) . tab ( ) ;
120
120
121
- $ ( '.toggle.button' ) . on ( 'click' , function ( ) {
122
- toggleElem ( $ ( $ ( this ) . data ( 'target' ) ) ) ;
123
- } ) ;
124
-
125
121
// prevent multiple form submissions on forms containing .loading-button
126
122
document . addEventListener ( 'submit' , ( e ) => {
127
123
const btn = e . target . querySelector ( '.loading-button' ) ;
@@ -310,8 +306,15 @@ export function initGlobalButtons() {
310
306
} ) ;
311
307
312
308
$ ( '.show-panel.button' ) . on ( 'click' , function ( e ) {
309
+ // a '.show-panel.button' can show a panel, by `data-panel="selector"`
310
+ // if the button is a "toggle" button, it toggles the panel
313
311
e . preventDefault ( ) ;
314
- showElem ( $ ( this ) . data ( 'panel' ) ) ;
312
+ const sel = $ ( this ) . attr ( 'data-panel' ) ;
313
+ if ( this . classList . contains ( 'toggle' ) ) {
314
+ toggleElem ( sel ) ;
315
+ } else {
316
+ showElem ( sel ) ;
317
+ }
315
318
} ) ;
316
319
317
320
$ ( '.hide-panel.button' ) . on ( 'click' , function ( e ) {
You can’t perform that action at this time.
0 commit comments