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 11<div class="ui dropdown tiny basic button icon-button" data-tooltip-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>
Original file line number Diff line number Diff line change 2828 </a>
2929 </div>
3030</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 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}}
Original file line number Diff line number Diff line change @@ -118,10 +118,6 @@ export function initGlobalCommon() {
118118
119119 $ ( '.tabular.menu .item' ) . tab ( ) ;
120120
121- $ ( '.toggle.button' ) . on ( 'click' , function ( ) {
122- toggleElem ( $ ( $ ( this ) . data ( 'target' ) ) ) ;
123- } ) ;
124-
125121 // prevent multiple form submissions on forms containing .loading-button
126122 document . addEventListener ( 'submit' , ( e ) => {
127123 const btn = e . target . querySelector ( '.loading-button' ) ;
@@ -310,8 +306,15 @@ export function initGlobalButtons() {
310306 } ) ;
311307
312308 $ ( '.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
313311 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+ }
315318 } ) ;
316319
317320 $ ( '.hide-panel.button' ) . on ( 'click' , function ( e ) {
You can’t perform that action at this time.
0 commit comments