File tree Expand file tree Collapse file tree 4 files changed +11
-8
lines changed Expand file tree Collapse file tree 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 tooltip" data-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 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>
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 @@ -120,10 +120,6 @@ export function initGlobalCommon() {
120
120
$ ( '.tabular.menu .item' ) . tab ( ) ;
121
121
$ ( '.tabable.menu .item' ) . tab ( ) ;
122
122
123
- $ ( '.toggle.button' ) . on ( 'click' , function ( ) {
124
- toggleElem ( $ ( $ ( this ) . data ( 'target' ) ) ) ;
125
- } ) ;
126
-
127
123
// make table <tr> and <td> elements clickable like a link
128
124
$ ( 'tr[data-href], td[data-href]' ) . on ( 'click' , function ( e ) {
129
125
const href = $ ( this ) . data ( 'href' ) ;
@@ -327,8 +323,15 @@ export function initGlobalButtons() {
327
323
} ) ;
328
324
329
325
$ ( '.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
330
328
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
+ }
332
335
} ) ;
333
336
334
337
$ ( '.hide-panel.button' ) . on ( 'click' , function ( e ) {
You can’t perform that action at this time.
0 commit comments