diff --git a/deme_django/cms/templates/textdocument/show.html b/deme_django/cms/templates/textdocument/show.html index 31658893..870bcbb4 100755 --- a/deme_django/cms/templates/textdocument/show.html +++ b/deme_django/cms/templates/textdocument/show.html @@ -23,6 +23,9 @@ $(document).ready(function () { DemeCanvasPointing.setup(); + var comment_id = {% if highlighted_comment_id %}'{{ highlighted_comment_id }}'{% else %}null{% endif %}; + var transclusion_id = {% if highlighted_transclusion_id %}'{{ highlighted_transclusion_id }}'{% else %}null{% endif %}; + highlight_comment(comment_id, transclusion_id, true, true); }); function highlight_comment(comment_id, transclusion_id, scroll_body, scroll_comments) { @@ -48,7 +51,7 @@ // Scroll to the proper place in the comment sidebar if (scroll_comments) { var y = $('#right_pane_comment_' + comment_id).offset().top - $('#fixed_right_pane').offset().top; - $('#fixed_right_pane').scrollTop(y); + $('#fixed_right_pane').animate({scrollTop:y}, 500); } } if (transclusion_id != null) { @@ -61,7 +64,7 @@ // Scroll to the proper place in the document body if (scroll_body) { var y = $('#inline_transclusion_' + transclusion_id).offset().top; - $(document.body).scrollTop(y); + $(document.body).animate({scrollTop:y}, 500); } } // Setup the canvas pointing line between transclusion and comment @@ -292,14 +295,9 @@ {% endifagentcanglobal %} {% endifagentcanglobal %} -
Show Located Comments
- + +
Hide Located Comments
- {% endifagentcan %} {% endblock content %} diff --git a/deme_django/cms/templatetags/item_tags.py b/deme_django/cms/templatetags/item_tags.py index 53286281..793605c3 100644 --- a/deme_django/cms/templatetags/item_tags.py +++ b/deme_django/cms/templatetags/item_tags.py @@ -705,15 +705,17 @@ def render(self, context): result.append(u'
') result.append(u'') def add_comment_to_div(comment_info, parents): + comment = comment_info['comment'] transclusions_to = [] for node in parents + (comment_info,): transclusions_to.extend(node['transclusions_to']) + relevant_transclusions = [x for x in transclusions_to if x.from_item_version_number == x.from_item.version_number] + relevant_transclusions.sort(key=lambda x: (x.to_item_id != comment.pk, x.from_item_id == item.pk, x.from_item_index)) for node in parents + (comment_info,): if node['siblings'][-1]['comment'].pk == node['comment'].pk: result.append(u'
') else: result.append(u'
') - comment = comment_info['comment'] original_comment = parents[0]['comment'] if parents else comment result.append(u'