Skip to content

Commit aa54037

Browse files
committed
Move page-level comments to the bottom
If they’re at the top and somebody goes to the page just to look at the file and not at the comments, a huge discussion at the top can be very distracting. We assume that people will go to pages more often to see the files/diffs/commits than to look at comments.
1 parent 84c47ea commit aa54037

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

code_comments/htdocs/code-comments.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ ul.comments>li .text {
8282
border: 0;
8383
margin: 0;
8484
}
85-
#top-comments button {
85+
#page-comments button {
8686
margin-bottom: 16px;
8787
}
8888
tr.with-comments {

code_comments/htdocs/code-comments.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ var underscore = _.noConflict();
3131
revision: CodeComments.revision,
3232
type: CodeComments.page
3333
},
34-
fetchTopComments: function() {
34+
fetchPageComments: function() {
3535
return this.fetch( { data: _.extend( { line: 0 }, this.defaultFetchParams ) } );
3636
},
3737
fetchLineComments: function() {
@@ -63,23 +63,23 @@ var underscore = _.noConflict();
6363
}
6464
});
6565

66-
window.TopCommentsView = Backbone.View.extend({
67-
id: 'top-comments',
66+
window.PageCommentsView = Backbone.View.extend({
67+
id: 'page-comments',
6868

69-
template: _.template(CodeComments.templates.top_comments_block),
69+
template: _.template(CodeComments.templates.page_comments_block),
7070
events: {
7171
'click button': 'showAddCommentDialog'
7272
},
7373

7474
initialize: function() {
75-
TopComments.bind('add', this.addOne, this);
76-
TopComments.bind('reset', this.addAll, this);
75+
PageComments.bind('add', this.addOne, this);
76+
PageComments.bind('reset', this.addAll, this);
7777
},
7878

7979
render: function() {
8080
$(this.el).html(this.template());
8181
this.$('button').button();
82-
TopComments.fetchTopComments();
82+
PageComments.fetchPageComments();
8383
return this;
8484
},
8585

@@ -89,12 +89,12 @@ var underscore = _.noConflict();
8989
},
9090
addAll: function() {
9191
var view = this;
92-
TopComments.each(function(comment) {
92+
PageComments.each(function(comment) {
9393
view.addOne.call(view, comment);
9494
});
9595
},
9696
showAddCommentDialog: function(e) {
97-
AddCommentDialog.open(TopComments);
97+
AddCommentDialog.open(PageComments);
9898
}
9999

100100
});
@@ -302,15 +302,15 @@ var underscore = _.noConflict();
302302
}
303303
} );
304304

305-
window.TopComments = new CommentsList();
305+
window.PageComments = new CommentsList();
306306
window.LineComments = new CommentsList();
307-
window.TopCommentsBlock = new TopCommentsView();
307+
window.PageCommentsBlock = new PageCommentsView();
308308
window.LineCommentsBlock = new LineCommentsView();
309309
window.AddCommentDialog = new AddCommentDialogView();
310310
window.LineCommentBubbles = new LineCommentBubblesView({el: $('#preview, .diff .entries')});
311311
window.Rows = new RowsView( { tableSelector: 'table.code tbody, table.trac-diff tbody' } );
312312

313-
$(CodeComments.selectorToInsertBefore).before(TopCommentsBlock.render().el);
313+
$(CodeComments.selectorToInsertAfter).after(PageCommentsBlock.render().el);
314314
LineCommentsBlock.render();
315315
AddCommentDialog.render();
316316
LineCommentBubbles.render();
File renamed without changes.

code_comments/web.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def get_navigation_items(self, req):
5555
class JSDataForRequests(CodeComments):
5656
implements(IRequestFilter)
5757

58-
js_templates = ['top-comments-block', 'comment', 'add-comment-dialog', 'line-comment', 'comments-for-a-line',]
58+
js_templates = ['page-comments-block', 'comment', 'add-comment-dialog', 'line-comment', 'comments-for-a-line',]
5959

6060
# IRequestFilter methods
6161
def pre_process_request(self, req, handler):
@@ -106,14 +106,14 @@ def templates_js_data(self):
106106
return data
107107

108108
def changeset_js_data(self, req, data):
109-
return {'page': 'changeset', 'revision': data['new_rev'], 'path': '', 'selectorToInsertBefore': 'div.diff:first'}
109+
return {'page': 'changeset', 'revision': data['new_rev'], 'path': '', 'selectorToInsertAfter': 'div.diff div.diff:last'}
110110

111111
def browser_js_data(self, req, data):
112-
return {'page': 'browser', 'revision': data['rev'], 'path': data['path'], 'selectorToInsertBefore': 'table#info, table#dirlist'}
112+
return {'page': 'browser', 'revision': data['rev'], 'path': data['path'], 'selectorToInsertAfter': 'table.code'}
113113

114114
def attachment_js_data(self, req, data):
115115
path = req.path_info.replace('/attachment/', 'attachment:/')
116-
return {'page': 'attachment', 'revision': 0, 'path': path, 'selectorToInsertBefore': 'table#info'}
116+
return {'page': 'attachment', 'revision': 0, 'path': path, 'selectorToInsertAfter': 'div#preview'}
117117

118118
def template_js_data(self, name):
119119
file_name = name + '.html'

0 commit comments

Comments
 (0)