|
26 | 26 | comparator: function(comment) { |
27 | 27 | return comment.get('time'); |
28 | 28 | }, |
29 | | - fetchComments: function( commentsToFetch ) { |
30 | | - var lineQuery = ( 'line' == commentsToFetch ) ? 'line__gt' : 'line', |
31 | | - params = { |
32 | | - data: { |
33 | | - path: CodeComments.path || undefined, |
34 | | - revision: CodeComments.revision, |
35 | | - type: CodeComments.page, |
36 | | - } |
37 | | - }; |
38 | | - params.data[lineQuery] = 0; |
39 | | - |
40 | | - return this.fetch( params ); |
| 29 | + defaultFetchParams: { |
| 30 | + path: CodeComments.path || undefined, |
| 31 | + revision: CodeComments.revision, |
| 32 | + type: CodeComments.page |
| 33 | + }, |
| 34 | + fetchTopComments: function() { |
| 35 | + return this.fetch( { data: _.extend( { line: 0 }, this.defaultFetchParams ) } ); |
| 36 | + }, |
| 37 | + fetchLineComments: function() { |
| 38 | + return this.fetch( { data: _.extend( { line__gt: 0 }, this.defaultFetchParams ) } ); |
41 | 39 | } |
42 | 40 | }); |
43 | 41 |
|
|
81 | 79 | render: function() { |
82 | 80 | $(this.el).html(this.template()); |
83 | 81 | this.$('button').button(); |
84 | | - TopComments.fetchComments(); |
| 82 | + TopComments.fetchTopComments(); |
85 | 83 | return this; |
86 | 84 | }, |
87 | 85 |
|
|
109 | 107 | this.viewPerLine = {}; |
110 | 108 | }, |
111 | 109 | render: function() { |
112 | | - LineComments.fetchComments( 'line' ); |
| 110 | + LineComments.fetchLineComments(); |
113 | 111 | }, |
114 | 112 | addOne: function(comment) { |
115 | 113 | var line = comment.get('line'); |
|
0 commit comments