11import $ from 'jquery' ;
22import { initCompReactionSelector } from './comp/ReactionSelector.js' ;
33import { initRepoIssueContentHistory } from './repo-issue-content.js' ;
4- import { initViewedCheckboxListenerFor , countAndUpdateViewedFiles } from './pull-view-file .js' ;
4+ import { initDiffFileTree } from './repo-diff-filetree .js' ;
55import { validateTextareaNonEmpty } from './comp/ComboMarkdownEditor.js' ;
6+ import { initViewedCheckboxListenerFor , countAndUpdateViewedFiles , initExpandAndCollapseFilesButton } from './pull-view-file.js' ;
67
78const { csrfToken} = window . config ;
89
9- export function initRepoDiffReviewButton ( ) {
10+ function initRepoDiffReviewButton ( ) {
1011 const $reviewBox = $ ( '#review-box' ) ;
1112 const $counter = $reviewBox . find ( '.review-comments-counter' ) ;
1213
@@ -25,7 +26,7 @@ export function initRepoDiffReviewButton() {
2526 } ) ;
2627}
2728
28- export function initRepoDiffFileViewToggle ( ) {
29+ function initRepoDiffFileViewToggle ( ) {
2930 $ ( '.file-view-toggle' ) . on ( 'click' , function ( ) {
3031 const $this = $ ( this ) ;
3132 $this . parent ( ) . children ( ) . removeClass ( 'active' ) ;
@@ -37,7 +38,7 @@ export function initRepoDiffFileViewToggle() {
3738 } ) ;
3839}
3940
40- export function initRepoDiffConversationForm ( ) {
41+ function initRepoDiffConversationForm ( ) {
4142 $ ( document ) . on ( 'submit' , '.conversation-holder form' , async ( e ) => {
4243 e . preventDefault ( ) ;
4344
@@ -152,7 +153,7 @@ function loadMoreFiles(url, callback) {
152153 } ) ;
153154}
154155
155- export function initRepoDiffShowMore ( ) {
156+ function initRepoDiffShowMore ( ) {
156157 $ ( document ) . on ( 'click' , 'a#diff-show-more-files' , ( e ) => {
157158 e . preventDefault ( ) ;
158159
@@ -186,3 +187,15 @@ export function initRepoDiffShowMore() {
186187 } ) ;
187188 } ) ;
188189}
190+
191+ export function initRepoDiffView ( ) {
192+ const diffFileList = $ ( '#diff-file-list' ) ;
193+ if ( diffFileList . length === 0 ) return ;
194+ initDiffFileTree ( ) ;
195+ initRepoDiffShowMore ( ) ;
196+ initRepoDiffReviewButton ( ) ;
197+ initRepoDiffFileViewToggle ( ) ;
198+ initRepoDiffConversationForm ( ) ;
199+ initViewedCheckboxListenerFor ( ) ;
200+ initExpandAndCollapseFilesButton ( ) ;
201+ }
0 commit comments