Split CSS into multiple files

The application.scss was starting to feel random, so this commit splits
it into a number of partials.

The separation is relatively well delineated, with the exception of
"global", which is, for now, still a small but somewhat random grab-bag
of miscellaneous stuff.

Change-Id: Ice51e3e4e5fb81de34397a46d9e36d9712dad337
Reviewed-on: https://gerrit.causes.com/27000
Reviewed-by: Greg Hurrell <greg@causes.com>
Tested-by: Greg Hurrell <greg@causes.com>
Use classes instead of ids for charts

This is a step towards flexibility and reusability. We're currently only
showing one chart per page, but we could conceivably want to show
multiple charts in the future.

This commit gets us a little closer to being able to do that, at low
cost. The styles, at least, are now completely re-usable, although the
JavaScript will need some more work if we want this stuff to appear more
than once on a given page.

Change-Id: If6a8c4ec0fdc94705e8c25924933662e2c2e15ba
Reviewed-on: https://gerrit.causes.com/27001
Reviewed-by: Greg Hurrell <greg@causes.com>
Tested-by: Greg Hurrell <greg@causes.com>
Fix spec bustage

The specs have been busted for a while now, for a couple of reasons:

  (1) We added Twigg::Commit#body but didn't update the factory to
      supply a body
  (2) Our edge-case handling for empty commits was broken because an
      error thrown as a result of an empty body would prevent the
      Twigg::Commit#stat from being set-up, triggering an ArgumentError
      which would be swallowed (as a result of our desire to gracefully
      handle truly empty repos)

This commit fixes both issues by:

  (1) Adding bodies to items produced by the commit factory; I just
      grabbed a handful of commit messages from Twigg itself and put
      those in the fixtures YAML file; for now, at least, I opted to
      remove the Gerrit-generated annotations from the messages as
      they're mostly just noise for the purposes of this factory
  (2) Re-jigging the Twigg::Repo#parse_log method to always set up a
      base `#body` and `#stat` variable before proceeding to parse a
      commit

Note that the `rescue nil` in `#parse_log` might seem like a bad idea
which could mask errors, but here we just got bitten by our failure to
actually run the spec suite regularly; the spec suite does a fine job of
ensuring that things actually work against a variety of normal and edge
cases.

We'll hopefully be more likely to notice this in the near future, once
Travis CI integration is in place; for that, see:

  https://github.com/causes/twigg/issues/12

Change-Id: Ibcc63261c7ebd5fc157563744511cef9cc5b7dcd
Reviewed-on: https://gerrit.causes.com/27002
Reviewed-by: Greg Hurrell <greg@causes.com>
Tested-by: Greg Hurrell <greg@causes.com>
Move stylesheets into "/assets" subdirectory

This is a step towards getting a real-ish "asset pipeline" in Sinatra.

I'd like to improve the organization of the JS in the web app, so I'll
be adding Sprockets in a subsequent commit. That will enable me to
compile JS into a single file from various sources.

Sass can already do something very similar for us, so I'm going to let
it keep doing its thing. The fact that we use Compass is a complicating
factor which makes it desirable to leave the Sass set-up as-is (I just
tried getting Sprockets to work with Sass + Compass in Sinatra and it is
a little painful; Sass without Compass is ok, but as soon as Compass is
in the mix things get tricky, so I'm going to leave the currently
working configuration in place).

Nevertheless, the very next step is going to be using Sprockets to
handle JS, so we may as well group all this stuff together under
"/assets" where it can be neatly organized and conceptually grouped
together.

Change-Id: I68dcef46595350f7055e95809ffdf92d092fc403
Reviewed-on: https://gerrit.causes.com/27003
Reviewed-by: Greg Hurrell <greg@causes.com>
Tested-by: Greg Hurrell <greg@causes.com>
Pipe application JavaScript through Sprockets

With this commit we now have a mini "asset pipeline" for application
JavaScript. I'm not really concerned about minifying and concatenating
all the vendored code (asset-related performance is not really a problem
here; to make Twigg fast the lowest-hanging and juiciest fruit will be
adding caching[0]), but I do want to impose saner organization over the
non-vendored JavaScript in the app.

This commit adds Sprockets to handle the compilation, and moves our
application.js file into assets/javascripts/. In a subsequent commit
I'll start to break the JavaScript into multiple files, and then
reassemble them with Sprockets.

[0]: https://github.com/causes/twigg/issues/1

Change-Id: I16af0fce15560253efb66e6fe7c49f3f5ef72b92
Reviewed-on: https://gerrit.causes.com/27004
Reviewed-by: Greg Hurrell <greg@causes.com>
Tested-by: Greg Hurrell <greg@causes.com>
Split application.js into separate files

To prevent application.js from becoming a random grab bag of unorganized
stuff, split its contents out into distinct files with well-defined
concerns.

Note that I chose to explicitly require the sub-files one-by-one rather
than using the `require_tree` directive, because I'll be wanting to
retain control over the order in which JS code is evaluated and
executed.

A subsequent commit will deal with a couple of places where we are using
in-template (footer) JS.

Change-Id: I2501c87026d9bb87a6d1402ac17356f1aae2228a
Reviewed-on: https://gerrit.causes.com/27005
Reviewed-by: Greg Hurrell <greg@causes.com>
Tested-by: Greg Hurrell <greg@causes.com>
Load commit charts asynchronously

My initial intent here was to remove a couple of straggling references
to nvd3, but it became clear that the best way to do so would be to load
the chart data asynchronously rather than passing it into the partial
explicitly.

There is some duplication, particularly around the way progress is shown
and errors are displayed, but I'll address that in a future commit.

Note that until we implement caching[0], this will be slower than it
needs to be, because we effectively calculate most of the data twice.

[0]: https://github.com/causes/twigg/issues/1

Change-Id: Iabe58ec3c2a0371cb5a2a7ac20ca077249220630
Reviewed-on: https://gerrit.causes.com/27006
Reviewed-by: Greg Hurrell <greg@causes.com>
Tested-by: Greg Hurrell <greg@causes.com>
DRY up progress bar display

Dry up the progress bar display by extracting the common markup out into
a partial.

Change-Id: I4e21d8a8097496d98a5af837c47e3374804d8580
Reviewed-on: https://gerrit.causes.com/27007
Reviewed-by: Greg Hurrell <greg@causes.com>
Tested-by: Greg Hurrell <greg@causes.com>