Skip to content

Commit 0261995

Browse files
committed
Allow adding comments to directories in the code browser
Fixes #39. Due to a different table id, top comments were not shown for directories in the code browser. Change the `selectorToInsertBefore` to support both files and directories. The code browser supports keyboard shortcuts for navigating directories which conflict with the add comment dialog, so now any keypresses within the dialog will not be propagated to avoid this. Made the dialog modal to reflect this. Add whitespace to selector list.
1 parent 7e475ca commit 0261995

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

code_comments/htdocs/code-comments.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,11 @@ var underscore = _.noConflict();
167167
},
168168
render: function() {
169169
this.$el.html(this.template({formatting_help_url: CodeComments.formatting_help_url}))
170-
.dialog({ autoOpen: false, title: 'Add Comment', close: this.close });
170+
.dialog({ autoOpen: false, title: 'Add Comment', close: this.close, modal: true });
171+
// Prevent keypresses in the dialog from being intercepted by other scripts
172+
this.$el.keydown(function(e) {
173+
event.stopPropagation();
174+
});
171175
this.$('button.add-comment').button();
172176
return this;
173177
},

code_comments/web.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def changeset_js_data(self, req, data):
109109
return {'page': 'changeset', 'revision': data['new_rev'], 'path': '', 'selectorToInsertBefore': 'div.diff:first'}
110110

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

114114
def attachment_js_data(self, req, data):
115115
path = req.path_info.replace('/attachment/', 'attachment:/')

0 commit comments

Comments
 (0)