Enabled pagination on the web UI so that a user can see the full list of snippets that they have submitted in chunks of 10. They are ordered by the date they were submitted using the presort feature of Riak Search. Fixed up an issue in the map/reduce counter for vote counts which was causing things to crash. Stupid mistake really!
In my ignorance I was using strings all over the shop when I should have instead been using binaries. This commit fixes this and all the "string" value use binaries. mochijson2 has been stripped out and instead we're now using Jiffy, as it's a bit faster (NIF) and I like the syntax a bit more. Encoding of atoms is completely gone now, all elements in the JSON are just binaries. As a result, csd_json has been ditched.
Instead of M/R we are now using Riak Search to pull snippets out. This returns the values in chronological order instead of reverse chron. We have the data we need to deal with paging, but the UI doesn't yet support paging as we aren't doing anything with the result. Also fixed up a small issue with the webmachine logger while I was at it given that we're now using the latest version of WM.
JS Map/reduce jobs are a fail. This commit includes changes which allows for the map/reduce for vote counts to be conducted using deployed erlang modules. The commit includes a makefile change to allow for the modules to be compiled and loaded into Riak. This commit is specific to my environment, but so is everything else so why not! Modules are stored in the `apps/csd_core/riak_modules` folder to keep them separate from the application's source. Two different types of map reduce are removed and one added. The counting of values when the user is logged in is combined into the same query as when the user is not logged in.
* Fixed up the inconsistency in the way the "Which" value in the vote map/reduce job was coming back. * Removed the nginx config and went back to a functioning haproxy config. Removing a moving part is a good iea. * Added the csd_static_resource to handle the static files. For the sake of this application this is more than enough, it will be noted that production use wouldn't rely on this resource. * Added routes to point the static file URIs to the appropriate folders on the file system.
* User names are now rendered when you view a profile page that isn't your own (if it's your own then you just see "Your"). * Tidied up the APIs for snippets and users as some functions weren't used or some overloads could be removed. * Removed the timeout from the nginx config which seemed to be having the opposite effect.
* csd_core_server wasn't necessary because it wasn't retaining any state. As a result it was removed. * csd_db was added as a replacement to csd_core_server. This was put in place to abstract riak a little from the caller and to hide the detail of using the pooler module. * All the entity modules (csd_user, csd_snippet, csd_vote) now use the new csd_db module. * csd_core_sup wasn't needed now that csd_core_server is gone. * Application startup is now simplified and just has the job of making sure that the pooler has started.
* Users who aren't signed in can't vote. * Signed in users can vote, vote detail is written to Riak. * Vote queries now come out of Riak thanks to 2i and map/red. * Sorting of submissions on the user page now works. TODO: just a little bit of polishing of code, commenting things and tidying up bits here and there. Then it's time to start work on the blog post which describes all the changes... there are a LOT!
* Broke up the snippet view into a few other views. * Made the UI animate when the snippet is shown. * UI animates again when the vote is cast. * Made sure colours were adjusted as well. * Commented out some functionality thats not yet implemented in the back end and added some randomness to the front end to make it look like things were happening. * Also commented out the bits which hide the vote buttons, this will obviously go back in down the track when the server-side is done. TODO: Need to implement server-side tracking of votes. Need to store the UserID and Name in a user bucket in Riak. Need to stop multiple votes from the same user (both client and server).
* Snippet view has voting buttons, graphs and a vote count. * Green means the snippet is winning, red is losing. Blue will be neutral. * Removed the DTL views that aren't going to be used any more. * Nginx config tweaks. * Document title now changes with the view that is rendered.
* Travis CI build status is now in the readme. * New snippet and snippet view has had an overhaul, and now looks semi-decent. * A few minor bug fixes. Still need to get this damned sorting working. Also need to fix up the ID generation of the snippets, as it's not that great.
* Back end now stores and retrieves snippets for the logged in user. * Snippets are stored with the user login ID (from Twitter) used as a 2i for looking up the values. * Snippets for a user can be listed. * New front end, driven by Backbone, now allows listing and submission of snippets. * csd_riak contains more functionailty for dealing with mapreduce and for dealing with indexes. * csd_snippet had some functionality pused into csd_snippet_store so that concerns could be separated. * csd_snippet is what invokes calls to the csd_core_server, so that is now kept from the caller who doesn't need to know it is there. More work required on the UI, but we're getting there.
* Fixed up configuration via config module. * Implemented the oauth resources. * Added dep to erlang-oauth (rebar friendly). * Moved webmachine config and adjusted code to load it from new location. * Put template rendering into a view module. * Adjusted Makefile with new config params. * Started adding the DTL hierarchy. * Added Twitter API functionality. * Added a home view which renders differently depending on if you are logged in or not. * Added checks to make sure user isn't already logged in, added support for storing login information into cookie. Next up: Storing session-based data in Riak.