Skip to content

Commit ed17bec

Browse files
committed
Merge pull request #57 from schwuk/fix_56_url_not_found
Fixes #56 by not hardcoding the `subscription` URL
2 parents 5c9d5fc + cd48bc6 commit ed17bec

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

code_comments/htdocs/code-comments.js

+1
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,7 @@ var underscore = _.noConflict();
326326
initialize: function(){
327327
_.bindAll(this, "render");
328328
this.model.listenTo(this.model, 'change', this.render);
329+
this.model.url = $(this.$el).data('baseUrl') + '/subscription' + $(this.$el).data('path');
329330
this.render();
330331
},
331332

code_comments/subscription.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ def process_request(self, req):
473473
def filter_stream(self, req, method, filename, stream, data):
474474
if re.match(r'^/(changeset|browser|attachment).*', req.path_info):
475475
filter = Transformer('//h1')
476-
stream |= filter.before(self._subscription_button())
476+
stream |= filter.before(self._subscription_button(req.path_info))
477477
return stream
478478

479479
# Internal methods
@@ -505,10 +505,12 @@ def _do_PUT(self, req):
505505
req.send(json.dumps(subscription, cls=SubscriptionJSONEncoder),
506506
'application/json')
507507

508-
def _subscription_button(self):
508+
def _subscription_button(self, path):
509509
"""
510510
Generates a (disabled) button to connect JavaScript to.
511511
"""
512512
return tag.button('Subscribe', id_='subscribe', disabled=True,
513513
title=('Code comment subscriptions require '
514-
'JavaScript to be enabled'))
514+
'JavaScript to be enabled'),
515+
data_base_url=self.env.project_url or self.env.abs_href(),
516+
data_path=path)

0 commit comments

Comments
 (0)