1
1
import $ from 'jquery' ;
2
2
import { initCompReactionSelector } from './comp/ReactionSelector.js' ;
3
3
import { initRepoIssueContentHistory } from './repo-issue-content.js' ;
4
- import { initViewedCheckboxListenerFor , countAndUpdateViewedFiles } from './pull-view-file .js' ;
4
+ import { initDiffFileTree } from './repo-diff-filetree .js' ;
5
5
import { validateTextareaNonEmpty } from './comp/ComboMarkdownEditor.js' ;
6
+ import { initViewedCheckboxListenerFor , countAndUpdateViewedFiles , initExpandAndCollapseFilesButton } from './pull-view-file.js' ;
6
7
7
8
const { csrfToken} = window . config ;
8
9
9
- export function initRepoDiffReviewButton ( ) {
10
+ function initRepoDiffReviewButton ( ) {
10
11
const $reviewBox = $ ( '#review-box' ) ;
11
12
const $counter = $reviewBox . find ( '.review-comments-counter' ) ;
12
13
@@ -25,7 +26,7 @@ export function initRepoDiffReviewButton() {
25
26
} ) ;
26
27
}
27
28
28
- export function initRepoDiffFileViewToggle ( ) {
29
+ function initRepoDiffFileViewToggle ( ) {
29
30
$ ( '.file-view-toggle' ) . on ( 'click' , function ( ) {
30
31
const $this = $ ( this ) ;
31
32
$this . parent ( ) . children ( ) . removeClass ( 'active' ) ;
@@ -37,7 +38,7 @@ export function initRepoDiffFileViewToggle() {
37
38
} ) ;
38
39
}
39
40
40
- export function initRepoDiffConversationForm ( ) {
41
+ function initRepoDiffConversationForm ( ) {
41
42
$ ( document ) . on ( 'submit' , '.conversation-holder form' , async ( e ) => {
42
43
e . preventDefault ( ) ;
43
44
@@ -152,7 +153,7 @@ function loadMoreFiles(url, callback) {
152
153
} ) ;
153
154
}
154
155
155
- export function initRepoDiffShowMore ( ) {
156
+ function initRepoDiffShowMore ( ) {
156
157
$ ( document ) . on ( 'click' , 'a#diff-show-more-files' , ( e ) => {
157
158
e . preventDefault ( ) ;
158
159
@@ -186,3 +187,15 @@ export function initRepoDiffShowMore() {
186
187
} ) ;
187
188
} ) ;
188
189
}
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