eldarion/phileo — pull request #3 by maelstrom (2011-11-28 02:17:29+00:00)
Title: Improve the default widget

The default widget has numerous problems, including:

- Unnecessary duplication of JavaScript code,
- Failure to work without JavaScript, and
- Bugs when multiple widgets are included on the same page

I fixed these issues by:

- Turning the JavaScript code in to a jQuery plugin, removing most of the initialization code from the individual widget templates to a external JavaScript file, and adding a {% phileo_js %} tag to load this plugin.
- Giving each like button a unique ID, so multiple like buttons can appear on a single page
- Made the widget a plain old form. This way, it works without JavaScript. Additionally, the CSRF stuff is included in the form by default, so the ajax_csrf.js script is obsolete