views:

468

answers:

6

I want to open-source my notes similarly as at DjangoBook. I have not found any similar open-source system as at the website. I am particularly interested in the vertical commenting system.

This suggests me that I need to build one by myself for open-source.

How would you build a similar commenting system as at the website?

+1  A: 

I thought the DjangoBook site was built with Django, which would seem to imply it uses the Django comments framework.

UPDATE: There's a note here which attributes a lot of the code for the comment system to Jack Slocum. The link on the DjangoBook page is dead, so I couldn't find any additional info, but it may be that the code referred to is for the YUI/AJAX pieces that make the contextual commenting possible.

Harper Shelby
@Harper: You mean that the Django has a built-in commenting system similar as at DjangoBook?
Masi
It has a built in comment system, but it doesn't do the inline comments like DjangoBook does.
tghw
+2  A: 

Each paragraph (<p>) in the document has an ID (cn0, cn1, etc.) and a class (cn). This is the only part of the comment system rendered near the text. Also on the page is the div that acts as the popup, which also contains the comment form.

The rest is done with Javascript. When the page is loaded, they send an AJAX request back to get the number and location of all the comments in the document. It looks like:

[[0,4],[3,2],...]

With this, it adds a div in the margin with the speech bubble and number of comments on that line.

When you click on the bubbles, another AJAX request is initiated to get the comments for that bubble. In this case, they send down the actual HTML to be rendered instead of a JSON object like before.

On the backend (this is all conjecture now) they're tying each set of comments to a document and a location in that document (this allows them to show all comments for a document at once). I would probably use the built-in comments app to do this, and either package both items into one foreign key, by creating a model to link the document and location, or by subclassing the Comment model itself.

Hope this gets you in the right direction. You can probably learn more by looking at their Javascript, but it's been minified, so it's a little hard to read(UPDATE: found unminified js). They're building on YUI, but the code is pretty straight forward.

tghw
@tghw: Do you know how to make the js -file readable effectively. I run in Vim's visual mode "=" for indendation, but I am not happy with the result.
Masi
No, but I did find the URL of the full, unminified JS. I've updated the link above.
tghw
@tghw: Thank you for the updates! --- Which tool did you use to find out the new link? --- I did not find the newest .js -file by Firefug.
Masi
Just guessed, the original file was djangobook-all-min.js, so i tried djangobook-all.js, nothing there, but djangobook.js did it.
tghw
+1  A: 

A long time ago (2 years'ish) someone created a Django project to mimic the DjangoBook called Open Book Platform.

It has been dormant for a long time and might not even work properly on Django 0.96 let alone 1.0.x. However, when I just visited to get the URL I notice there's been some activity in the last month.

Van Gale
@Van Gale: Thank you for the link and the piece of history! --- I did not know that Django is rather a "copy" of another platform. --- Do you know whether the developers are the same in Django and Open Book Platform? --- It seems that Open Book Platform uses the word Django often. This suggests me that they are the same developers. --- However, the Chinese in Open Book Platform suggests that there have been many developers, since one European seems to be a creator of Django.
Masi
err, Open Book Platform is a project that was developed using an older version of Django. It's a project, using Django, to mimic how DjangoBook worked. Sorry for not being clear. You could probably get it running on current version of Django with a little work. And yes, it looks like the new maintainers of the project are Chinese, no idea what their plans are.
Van Gale
A: 

You may want to try using WordPress with CommentPress plugin that is adding similar behaviour.

Sorin Sbarnea
A: 

Remark box is built on the same principles as the DjangoBook comment system, its a free service for small sites.

And unlike the projects or plug-ins others have mentioned on this thread, it can be used on any HTML page, integration is just a few JavaScript lines.

Their front page has a live demo http://www.remarkbox.com/

drubio
+1  A: 

You may be interested by Wooki. It's a collaborative writing platform, 100% open source and free. It was based on Django Book system.

Take a look : http://wookicentral.com

Robin K