Fixed numerous bugs in seeds.rb that were preventing it from being
idempotent, such as not clearing out Users table before trying to create
Test Learners.
Cleaned up non-DRY code in seeds.rb and many of the templates.
Fixed templates so that they use radiobuttons to collect learner's
input; currently the default templates use 'choice' for the initial
choice (value will be a letter A-E) and 'final_choice' for the final
choice, to make it easy to distinguish these in the EventLogs, but that
can be changed easily.
Everywhere I looked there were files that have hardcoded tabs into them;
these were changed to spaces and to a uniform indentation scheme
consistent with rest of codebase.  Please don't use tabs!!  Figure out
the editor setting you need to always insert spaces rather than tabs.
Cleaned up the non-DRY HTML and CSS and replaced the broken frontend.js
(which is not "frontend" anything but code to highlight a chosen answer
and display "Why did you choose C?" in Justification textarea) with
template.js, which provides same functionality and also gives a
convenient place to bind the AJAX call that should occur when learner
selects an answer choice before hitting Submit.
Added template_helper.rb to provide a simple function to safely map from
an integer 0..n to a letter of the alphabet A..Z, pinning at 25.
Previously, there was non-DRY, multiple-if-then-clause logic that was
cut-and-pasted to three or four different templates.
Added template.css.scss to provide styles specific to
instructor-authored Template pages.
Removed all the unused "if JSON" code from TemplatesController.
TemplatesController#show now gives a preview of the template roughly as
it will appear in a real flow.  Part of making this work is to set a
controller instance variable @preview, which if non-nil disables the
JavaScript timer action.  It should probably also disable other
JavaScripty things.
Changed Cucumber scenarios for Templates in accordance with these new
views.
The timer() helper's first argument is now optional (as the docs state
it should be) and defaults to the value of @timer as setup by the
controller.
DRY'd out app/views/templates/* and moved them to Haml, making them
about a quarter the size they were before. The orginal views were
scaffolded and had a lot of cruft.
Made it impossible (via the UI) to delete a template, since Derrick
points out this could screw up referential integrity in the future.
It's easy to put this back in if we want, and in fact the controller
action that does it is still exposed and can be triggered via HTTP;
there's just no button to do it.
merge from master to testLearner