Show More
@@ -208,6 +208,7 b' class ChangesetController(BaseRepoContro' | |||||
208 |
|
208 | |||
209 | c.statuses = [] |
|
209 | c.statuses = [] | |
210 | c.comments = [] |
|
210 | c.comments = [] | |
|
211 | c.unresolved_comments = [] | |||
211 | if len(c.commit_ranges) == 1: |
|
212 | if len(c.commit_ranges) == 1: | |
212 | commit = c.commit_ranges[0] |
|
213 | commit = c.commit_ranges[0] | |
213 | c.comments = CommentsModel().get_comments( |
|
214 | c.comments = CommentsModel().get_comments( | |
@@ -226,6 +227,9 b' class ChangesetController(BaseRepoContro' | |||||
226 | for pr in prs: |
|
227 | for pr in prs: | |
227 | c.comments.extend(pr.comments) |
|
228 | c.comments.extend(pr.comments) | |
228 |
|
229 | |||
|
230 | c.unresolved_comments = CommentsModel()\ | |||
|
231 | .get_commit_unresolved_todos(commit.raw_id) | |||
|
232 | ||||
229 | # Iterate over ranges (default commit view is always one commit) |
|
233 | # Iterate over ranges (default commit view is always one commit) | |
230 | for commit in c.commit_ranges: |
|
234 | for commit in c.commit_ranges: | |
231 | c.changes[commit.raw_id] = [] |
|
235 | c.changes[commit.raw_id] = [] | |
@@ -275,7 +279,6 b' class ChangesetController(BaseRepoContro' | |||||
275 | # sort comments by how they were generated |
|
279 | # sort comments by how they were generated | |
276 | c.comments = sorted(c.comments, key=lambda x: x.comment_id) |
|
280 | c.comments = sorted(c.comments, key=lambda x: x.comment_id) | |
277 |
|
281 | |||
278 |
|
||||
279 | if len(c.commit_ranges) == 1: |
|
282 | if len(c.commit_ranges) == 1: | |
280 | c.commit = c.commit_ranges[0] |
|
283 | c.commit = c.commit_ranges[0] | |
281 | c.parent_tmpl = ''.join( |
|
284 | c.parent_tmpl = ''.join( |
@@ -146,6 +146,23 b' class CommentsModel(BaseModel):' | |||||
146 |
|
146 | |||
147 | return todos |
|
147 | return todos | |
148 |
|
148 | |||
|
149 | def get_commit_unresolved_todos(self, commit_id, show_outdated=True): | |||
|
150 | ||||
|
151 | todos = Session().query(ChangesetComment) \ | |||
|
152 | .filter(ChangesetComment.revision == commit_id) \ | |||
|
153 | .filter(ChangesetComment.resolved_by == None) \ | |||
|
154 | .filter(ChangesetComment.comment_type | |||
|
155 | == ChangesetComment.COMMENT_TYPE_TODO) | |||
|
156 | ||||
|
157 | if not show_outdated: | |||
|
158 | todos = todos.filter( | |||
|
159 | coalesce(ChangesetComment.display_state, '') != | |||
|
160 | ChangesetComment.COMMENT_OUTDATED) | |||
|
161 | ||||
|
162 | todos = todos.all() | |||
|
163 | ||||
|
164 | return todos | |||
|
165 | ||||
149 | def create(self, text, repo, user, commit_id=None, pull_request=None, |
|
166 | def create(self, text, repo, user, commit_id=None, pull_request=None, | |
150 | f_path=None, line_no=None, status_change=None, |
|
167 | f_path=None, line_no=None, status_change=None, | |
151 | status_change_type=None, comment_type=None, |
|
168 | status_change_type=None, comment_type=None, |
@@ -241,6 +241,9 b' function scrollToElement(element, percen' | |||||
241 | time = (time === undefined ? 100 : time); |
|
241 | time = (time === undefined ? 100 : time); | |
242 |
|
242 | |||
243 | var $element = $(element); |
|
243 | var $element = $(element); | |
|
244 | if ($element.length == 0) { | |||
|
245 | throw('Cannot scroll to {0}'.format(element)) | |||
|
246 | } | |||
244 | var elOffset = $element.offset().top; |
|
247 | var elOffset = $element.offset().top; | |
245 | var elHeight = $element.height(); |
|
248 | var elHeight = $element.height(); | |
246 | var windowHeight = $(window).height(); |
|
249 | var windowHeight = $(window).height(); |
@@ -461,6 +461,7 b' var CommentsController = function() {' | |||||
461 | }; |
|
461 | }; | |
462 |
|
462 | |||
463 | this.scrollToComment = function(node, offset, outdated) { |
|
463 | this.scrollToComment = function(node, offset, outdated) { | |
|
464 | var offset = offset || 1; | |||
464 | var outdated = outdated || false; |
|
465 | var outdated = outdated || false; | |
465 | var klass = outdated ? 'div.comment-outdated' : 'div.comment-current'; |
|
466 | var klass = outdated ? 'div.comment-outdated' : 'div.comment-current'; | |
466 |
|
467 | |||
@@ -486,6 +487,7 b' var CommentsController = function() {' | |||||
486 | nextIdx = 0; |
|
487 | nextIdx = 0; | |
487 | } |
|
488 | } | |
488 | var $next = $(klass).eq(nextIdx); |
|
489 | var $next = $(klass).eq(nextIdx); | |
|
490 | ||||
489 | var $cb = $next.closest('.cb'); |
|
491 | var $cb = $next.closest('.cb'); | |
490 | $cb.removeClass('cb-collapsed'); |
|
492 | $cb.removeClass('cb-collapsed'); | |
491 |
|
493 |
@@ -155,6 +155,23 b'' | |||||
155 | </div> |
|
155 | </div> | |
156 | </div> |
|
156 | </div> | |
157 |
|
157 | |||
|
158 | <div class="fieldset"> | |||
|
159 | <div class="left-label"> | |||
|
160 | ${_('Unresolved TODOs')}: | |||
|
161 | </div> | |||
|
162 | <div class="right-content"> | |||
|
163 | <div class="comments-number"> | |||
|
164 | % if c.unresolved_comments: | |||
|
165 | % for co in c.unresolved_comments: | |||
|
166 | <a class="permalink" href="#comment-${co.comment_id}" onclick="Rhodecode.comments.scrollToComment($('#comment-${co.comment_id}'))"> #${co.comment_id}</a>${'' if loop.last else ','} | |||
|
167 | % endfor | |||
|
168 | % else: | |||
|
169 | ${_('There are no unresolved TODOs')} | |||
|
170 | % endif | |||
|
171 | </div> | |||
|
172 | </div> | |||
|
173 | </div> | |||
|
174 | ||||
158 | </div> <!-- end summary-detail --> |
|
175 | </div> <!-- end summary-detail --> | |
159 |
|
176 | |||
160 | <div id="commit-stats" class="sidebar-right"> |
|
177 | <div id="commit-stats" class="sidebar-right"> |
General Comments 0
You need to be logged in to leave comments.
Login now