Lots of progress on the bundle feature this week. I also significantly revised my plans for the feature, based on some very helpful feedback from the mailing list. Some other smaller changes - bug fixes, minor feature additions, cosmetic changes - were committed as well.
I’ve committed all the progress I’ve made over the past couple of weeks on bundles. See commit 151. It’s still incomplete, but most of the basic functionality is there. Feel free to test it out for yourself.
Optimising dynamic line-number insertion
The dynamic line-number insertion was extraordinarily slow for long snippets. Optimising it was pretty simple, though - I just had to minimise the number of DOM manipulations and to change the
$.each() call to a standard for loop (see commit 141). I should really have done this from the beginning, but at the time I thought that the initial method was neater and that performance wouldn’t be an issue, which turned out to be very naive.
I added server-side LESS compilation as an option (commit 143). To trigger it, set
localStorage when you don’t want them to be.
Contributions sidebar for user profiles
There is now a sidebar on user profile pages showing what snippets and bundles that user has created (commit 152).
There was a bug in registration before relating to an incorrect usage of the django-registration app. It should be fixed now (commit 160).
Other cosmetic changes
Minor cosmetic changes include:
word-wrap: break-wordto diffs and snippets (so that extremely long words don’t break out of the box - commits 158 and 161)
overflow-xto the snippet history list in the sidebar, to ensure that it never gets too cramped (commit 145)
- Adding a top margin to the diff box to ensure that it is aligned with the sidebar (commit 146)
- Preventing the browser from trying to jump to # when you click the “Highlight code” link (commit 142)
More on bundles
Here’s a revised version of the to-do list for bundles from last week:
- Ensuring that file uploading is secure (for instance, it needs to be able to handle zip bombs without exploding)
- Displaying images and allowing downloads for individual files
- Whitelist for certain mimetypes (e.g., XML) that don’t begin with
text/but should still be considered plain text
- Versioning (the ability to upload subsequent versions of a bundle, each associated with a single incrementing version number)
- Adding license information to uploaded files (see this Perl script)
- Downloads (so that users can easily download the contents of a bundle as an archive file)
- Rating/feedback functionality
- Mercurial integration (eventually)
I’ll be working on the downloads feature first, then versioning and licensing. I’ll probably also come up with other small features while working on these.
Deleting unused code, making use of Django shortcuts and other conveniences when possible, checking concordance with PEP 8, etc.
Position in timeline
- August 1-15: Check out codebase, get it running; read all the code and documentation; start learning Mercurial
- August 16-31: Start working on design; start mocking up models and routes for the components
- September 1 - October 15: Work on the core components, with as much test coverage and documentation as is feasible; start implementing the views, models and templates
- October 16-31: Ensure that documentation is thorough and up to date; write any remaining tests that need to be written; test out the user interface and fix any bugs
(This timeline isn’t really relevant anymore, but I’ll keep including it for reference.)